srunobantana
Member
- Joined
- Oct 24, 2021
- Messages
- 42
- Reaction score
- 19
Could someone provide a talkactions action so I can teleport to positions using the following format? Example:/goto {x = 1420, y = 1911, z = 4}
local talkAction = TalkAction("!gotonew")
function talkAction.onSay(player, words, param, type)
if player:getAccountType() <= ACCOUNT_TYPE_SENIORTUTOR then
return true
end
local x, y, z = param:match("x = (%d+), y = (%d+), z = (%d+)")
player:teleportTo(Position(x, y, z))
return false
end
talkAction:separator(" ")
talkAction:register()
@srunobantana Atleast say something like it's working or like the comment instead of ignoring lol
People help you for free and you just ignore them
local position = TalkAction("/pos", "!pos")
function position.onSay(player, words, param)
if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then
return true
end
local param = string.gsub(param, "%s+", "")
local position = player:getPosition()
local tile = load("return "..param)()
local split = param:split(",")
if type(tile) == "table" and tile.x and tile.y and tile.z then
player:teleportTo(Position(tile.x, tile.y, tile.z))
elseif split and param ~= "" then
player:teleportTo(Position(split[1], split[2], split[3]))
elseif param == "" then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your current position is: \z
" .. position.x .. ", " .. position.y .. ", " .. position.z .. ".")
end
return false
end
position:separator(" ")
position:register()
Try this code is from otserver global (scripts/talkactions):
LUA:local position = TalkAction("/pos", "!pos") function position.onSay(player, words, param) if not player:getGroup():getAccess() or player:getAccountType() < ACCOUNT_TYPE_GOD then return true end local param = string.gsub(param, "%s+", "") local position = player:getPosition() local tile = load("return "..param)() local split = param:split(",") if type(tile) == "table" and tile.x and tile.y and tile.z then player:teleportTo(Position(tile.x, tile.y, tile.z)) elseif split and param ~= "" then player:teleportTo(Position(split[1], split[2], split[3])) elseif param == "" then player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your current position is: \z " .. position.x .. ", " .. position.y .. ", " .. position.z .. ".") end return false end position:separator(" ") position:register()
If works, use comands: /pos or !pos and Params: x, y, z or {x=pos.x, y=pos.y, z=pos.z}
Ex: !pos {x=32202, y=32300, z=7} or !pos 32202, 32300, 7
Ex: /pos {x=32202, y=32300, z=7} or /pos 32202, 32300, 7
Note: If you use brackets "{}" you need to put numbers after axes(x,y,z) exactly as in the example above.
Lua Script Error: [Test Interface]
data/talkactions/scripts/pos.lua
LuaScriptInterface::luaCreateTalkaction(). TalkActions can only be registered in the Scripts interface.
stack traceback:
[C]: in function 'TalkAction'
data/talkactions/scripts/pos.lua:1: in main chunk
Lua Script Error: [Test Interface]
data/talkactions/scripts/pos.lua
data/talkactions/scripts/pos.lua:3: attempt to index local 'position' (a nil value)
stack traceback:
[C]: in function '__newindex'
data/talkactions/scripts/pos.lua:3: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/pos.lua
I am not familiar with MovieBR. I use the repository GitHub - OTCv8/forgottenserver: A free and open-source MMORPG server emulator written in C++, compatible with OTClientV8 (https://github.com/OTCv8/forgottenserver), but I am still encountering some errors. Perhaps the TFS 1.3 version of OTCLIENTV8 may not be the best option.Você provavelmente está usando a base TFS 1.3 do MovieBR, certo? Esse script existe desde a 1.3... Por que você não verificou isso? Eu testei no meu 1.3, e tudo está funcionando bem. oo
![]()
baiakthunder/data/scripts/talkactions/position.lua at master · moviebr/baiakthunder
Baiak Thunder - 8.60 (TFS 1.3) for OpenTibia community. - moviebr/baiakthundergithub.com
Lua Script Error: [Test Interface]
data/talkactions/scripts/pos.lua
LuaScriptInterface::luaCreateTalkaction(). TalkActions can only be registered in the Scripts interface.
stack traceback:
[C]: in function 'TalkAction'
data/talkactions/scripts/pos.lua:1: in main chunk
Lua Script Error: [Test Interface]
data/talkactions/scripts/pos.lua
data/talkactions/scripts/pos.lua:3: attempt to index local 'talk' (a nil value)
stack traceback:
[C]: in function '__newindex'
data/talkactions/scripts/pos.lua:3: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/pos.lua
function onSay(player, words, param, type)
if player:getAccountType() <= ACCOUNT_TYPE_SENIORTUTOR then
return true
end
if param == "" then
player:sendTextMessage(MESSAGE_INFO_DESCR, "Usage: !gotonew 1000 1000 7")
return false
end
local x, y, z = param:match("(%d+)%s+(%d+)%s+(%d+)")
if not x or not y or not z then
player:sendTextMessage(MESSAGE_INFO_DESCR, "Invalid coordinates. Usage: !gotonew 1000 1000 7")
return false
end
x = tonumber(x)
y = tonumber(y)
z = tonumber(z)
local position = Position(x, y, z)
if player:teleportTo(position) then
player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Teleported to: %d %d %d", x, y, z))
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "Unable to teleport to this position.")
end
return false
end
Now let me explain: you took the script, which is a RevScript, and placed it directly in data/talkaction/filename, and that’s why it gave an error. That’s why Marko and someone else mentioned it’s a RevScript. You should have some understanding before testing. It’s good for you to know how RevScript works. So, I posted the latest script, which is a regular talkaction and not a RevScript.data/talkactions/scripts/pos.lua:3: attempt to index local 'talk' (a nil value)
Thank you, my friend! I have always worked with TFS 0.4, and I am deeply grateful for your guidance. You are truly a kind person. I sincerely appreciate it! Everything is working perfectly now; you truly know how to help others.Hey, TFS 1.3 is very outdated, but you're using version 10.98, right? Why didn't you choose TFS 1.4.2, which is more updated? Or better yet, you could use the BlackTek base, which is also version 10.98. It's more up-to-date and still being developed, making it ideal for DBO, NTO, Pokémon, and similar projects.
TFS 1.4.2 1098
![]()
Release The Forgotten Server 1.4.2 · otland/forgottenserver
Version 1.4.* represents our latest stable protocol 10.98 release. What's Changed [1.4] 10.98 forwards compatibility with new OTB and RME in #3866 1.4.2 Release Candidate in #3917 Full Changelog:...github.com
Black tek 1098
![]()
GitHub - Black-Tek/BlackTek-Server: A 2D Top Down (MMORPG) Game Server, with the goal of becoming a rapid development game engine someday
A 2D Top Down (MMORPG) Game Server, with the goal of becoming a rapid development game engine someday - Black-Tek/BlackTek-Servergithub.com
So, I took Marko's script and adjusted some functions.
If the error persists, it seems your 1.3 base, although more updated, doesn't fully support RevScript. I recommend trying without RevScript—just use the direct path data/talkaction/filename.lua and test it. It should work.
data/talkactions/scripts/pos.lua
LUA:function onSay(player, words, param, type) if player:getAccountType() <= ACCOUNT_TYPE_SENIORTUTOR then return true end if param == "" then player:sendTextMessage(MESSAGE_INFO_DESCR, "Usage: !gotonew 1000 1000 7") return false end local x, y, z = param:match("(%d+)%s+(%d+)%s+(%d+)") if not x or not y or not z then player:sendTextMessage(MESSAGE_INFO_DESCR, "Invalid coordinates. Usage: !gotonew 1000 1000 7") return false end x = tonumber(x) y = tonumber(y) z = tonumber(z) local position = Position(x, y, z) if player:teleportTo(position) then player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Teleported to: %d %d %d", x, y, z)) else player:sendTextMessage(MESSAGE_INFO_DESCR, "Unable to teleport to this position.") end return false end
Post automatically merged:
Now let me explain: you took the script, which is a RevScript, and placed it directly in data/talkaction/filename, and that’s why it gave an error. That’s why Marko and someone else mentioned it’s a RevScript. You should have some understanding before testing. It’s good for you to know how RevScript works. So, I posted the latest script, which is a regular talkaction and not a RevScript.
![]()
Revscriptsys
A free and open-source MMORPG server emulator written in C++ - otland/forgottenservergithub.com
Hey, TFS 1.3 is very outdated, but you're using version 10.98, right? Why didn't you choose TFS 1.4.2, which is more updated? Or better yet, you could use the BlackTek base, which is also version 10.98. It's more up-to-date and still being developed, making it ideal for DBO, NTO, Pokémon, and similar projects.
TFS 1.4.2 1098
![]()
Release The Forgotten Server 1.4.2 · otland/forgottenserver
Version 1.4.* represents our latest stable protocol 10.98 release. What's Changed [1.4] 10.98 forwards compatibility with new OTB and RME in #3866 1.4.2 Release Candidate in #3917 Full Changelog:...github.com
Black tek 1098
![]()
GitHub - Black-Tek/BlackTek-Server: A 2D Top Down (MMORPG) Game Server, with the goal of becoming a rapid development game engine someday
A 2D Top Down (MMORPG) Game Server, with the goal of becoming a rapid development game engine someday - Black-Tek/BlackTek-Servergithub.com
So, I took Marko's script and adjusted some functions.
If the error persists, it seems your 1.3 base, although more updated, doesn't fully support RevScript. I recommend trying without RevScript—just use the direct path data/talkaction/filename.lua and test it. It should work.
data/talkactions/scripts/pos.lua
LUA:function onSay(player, words, param, type) if player:getAccountType() <= ACCOUNT_TYPE_SENIORTUTOR then return true end if param == "" then player:sendTextMessage(MESSAGE_INFO_DESCR, "Usage: !gotonew 1000 1000 7") return false end local x, y, z = param:match("(%d+)%s+(%d+)%s+(%d+)") if not x or not y or not z then player:sendTextMessage(MESSAGE_INFO_DESCR, "Invalid coordinates. Usage: !gotonew 1000 1000 7") return false end x = tonumber(x) y = tonumber(y) z = tonumber(z) local position = Position(x, y, z) if player:teleportTo(position) then player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Teleported to: %d %d %d", x, y, z)) else player:sendTextMessage(MESSAGE_INFO_DESCR, "Unable to teleport to this position.") end return false end
Post automatically merged:
Now let me explain: you took the script, which is a RevScript, and placed it directly in data/talkaction/filename, and that’s why it gave an error. That’s why Marko and someone else mentioned it’s a RevScript. You should have some understanding before testing. It’s good for you to know how RevScript works. So, I posted the latest script, which is a regular talkaction and not a RevScript.
![]()
Revscriptsys
A free and open-source MMORPG server emulator written in C++ - otland/forgottenservergithub.com
So, if the problem is solved, please upvote as the best answer so that others who are still looking for a solution can find it more easily.Thank you, my friend! I have always worked with TFS 0.4, and I am deeply grateful for your guidance. You are truly a kind person. I sincerely appreciate it! Everything is working perfectly now; you truly know how to help others.
Post automatically merged: