djnacht
12-30-2015, 06:04 AM
Hello!
I'm a day old to Tibia, XenoBot and Lua, but my vacation time has allowed me to invest most of my day into understanding all this stuff.
For the moment I plan on staying in Dawnport to practice some scripting, and I'm curious if other users check their bots' position before doing anything else in their script.
My code checks to see my characters position and verifies that it is within specific boundaries before starting. It seems to work, but I feel like it is a crude piece of code written by a caveman. Would anyone else care to improve on this, or suggest how I may do so?
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
print("Registered Event Listener, Welcome")
wait(3000)
function onWalkerSelectLabel(LabelName)
if(LabelName == "Start") then
print("Checking Position, Make sure you are in the starting area")
if(Self.Position().z == 5) and (Self.Position().x >= 32054) and (Self.Position().x <= 32075) and (Self.Position().y <= 31901) and (Self.Position().y >= 31880) then
print("Script Starting")
else
print("Go to Starting Position")
Walker.Stop()
end
end
end
I'm a day old to Tibia, XenoBot and Lua, but my vacation time has allowed me to invest most of my day into understanding all this stuff.
For the moment I plan on staying in Dawnport to practice some scripting, and I'm curious if other users check their bots' position before doing anything else in their script.
My code checks to see my characters position and verifies that it is within specific boundaries before starting. It seems to work, but I feel like it is a crude piece of code written by a caveman. Would anyone else care to improve on this, or suggest how I may do so?
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
print("Registered Event Listener, Welcome")
wait(3000)
function onWalkerSelectLabel(LabelName)
if(LabelName == "Start") then
print("Checking Position, Make sure you are in the starting area")
if(Self.Position().z == 5) and (Self.Position().x >= 32054) and (Self.Position().x <= 32075) and (Self.Position().y <= 31901) and (Self.Position().y >= 31880) then
print("Script Starting")
else
print("Go to Starting Position")
Walker.Stop()
end
end
end