View Full Version : Need help with lua
ketjo
04-23-2013, 07:57 PM
Hello all, i made a nice script but i have one problem, i want to make a spot chooser for my script and i realy dont know how to do it, its my question how to write this part of script that will choose which spot to go... i was trying somethink like this
elseif (labelName == "Island") then
if (Island) then
gotoLabel ("SecoundIsland")
else
gotoLabel ("FirstIsland")
end
and this
elseif (labelName == "Island") then
if (Island) then
if (Self.ItemCount(268) <= MinMana) or (Self.Cap() < MinCap) or (Self.ItemCount(236) <= MinHealth) or ((LogoutStamina) and (Self.Stamina() < 840)) then
Walker.Goto("SecoundIsland")
else
Walker.Goto("FirstIsland")
end
can anyone help me ?;f
xitoz
04-23-2013, 08:20 PM
--[[
Island 1 - Easy
Island 2 - Medium
]]--
local SelectIsland = 2
if (labelName == "IslandChecker") then
if SelectIsland == 1 then gotoLabel ("FirstIsland")
elseif SelectIsland == 2 then gotoLabel ("SecondIsland")
end
end
dinmamma
04-23-2013, 08:28 PM
Idk if that's the complete script or not, if it is then it wont work.
Here is an example that would work:
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "Something") then
Do something, for example gotoLabel("Label1")
elseif (labelName == "Something else") then
Do something else, for example gotoLabel("Label2"")
end
end
xitoz
04-23-2013, 08:29 PM
Here's the second part of the script you wanted done:
You'll have to declare MinMana, MinCap & MinHealth as variables though.
elseif (labelName == "FirstIslandChecker") and (Self.ItemCount(268) <= MinMana) or (Self.Cap() < MinCap) or (Self.ItemCount(236) <= MinHealth) then -- check resources on first island
gotoLabel ("FirstIslandRefill") -- refill on first island
else
gotoLabel ("FirstIslandKeepHunting") -- keep hunting on the first island
elseif (labelName == "SecondIslandChecker") and (Self.ItemCount(268) <= MinMana) or (Self.Cap() < MinCap) or (Self.ItemCount(236) <= MinHealth) then -- check resources on second island
gotoLabel ("SecondIslandRefill") -- refill on second island
else
gotoLabel ("SecondIslandKeepHunting") -- -- keep hunting on the second island
end
Pretty messy though
ketjo
04-23-2013, 08:37 PM
thanks :) u really helped me :) it works fine now ;) i'm just now to lua scripting thanks a lot :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.