Bastiat
09-30-2012, 05:53 AM
I'm having trouble getting my script to work reliably.. I tried several times but it seems to work only randomly.. Sometimes it works, usually it doesn't, sometimes it buys only 1 royal spear instead of the proper amount. It's giving a headache help please!!
local idlmanas = 70-(Self.ItemCount(268))
local idlspears = 20-(Self.ItemCount(7378))
local GTW = (idlmanas*50)+(idlspears*15)
--== LABEL MANAGER ==--
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
local func = loadstring(labelName)
if(func)then func()
end
end
--== SHOPPERS ==--
function buyPots()
delayWalker(math.random(10000, 15000))
Self.SayToNpc({"hi", "vials", "no", "yes", "trade"}, 65)
wait(1000, 5000)
Self.ShopBuyItem(268, idlmanas)
end
function buySpears()
delayWalker(math.random(10000, 15000))
Self.SayToNpc({"hi", "trade"}, 65)
wait(1000, 5000)
Self.ShopBuyItem(7378, idlspears)
end
--== DEPOSITERS ==--
function DepositGold()
delayWalker(math.random(10000, 15000))
Self.SayToNpc({"hi", "deposit all", "yes", "withdraw " .. GTW, "yes", "balance"}, 65)
end
function DepositItems()
delayWalker(math.random(15000, 20000))
Self.DepositItems(
3369, -- warrior helmet
7438, -- elvish bow
3073, -- wand of cosmic energy
5922, -- holy orchid
5880, -- iron ore
5896, -- bear paw
3037, -- yellow gem
7398, -- cyclops trophy
7401, -- minotaur trophy
7425, -- taurus mace
5921, -- heaven blossom
3351, -- steel helmet
3384, -- dark helmet
2991, -- doll
3033, -- small amethyst
5897, -- wolf paw
5902, -- honeycomb
3307, -- scimitar
10196, -- orc tooth
11473, -- purple robe
3093, -- club ring
3082, -- elven amulet
5940, -- wolf tooth chain
3091, -- sword ring
3012, -- wolf tooth chain
3092, -- axe ring
236, -- strong health potion
11465, -- elven astral observer
11477, -- orcish gear
3061, -- life crystal
11480, -- skull belt
237, -- strong mana potion
5878, -- minotaur leather
11472, -- minotaur horn
9657, -- cyclops toe
11482, -- piece of warrior armor
11464, -- elven scouting glass
9635, -- elvish talisman
266, -- health potion
11451, -- broken crossbow
11479, -- orc leather
9651, -- scorpion tail
3347, -- hunting spear
11483, -- piece of archer armor
3298, -- throwing knife
3661, -- grave flower
3738, -- sling herb
3147, -- blank rune
3448, -- poison arrow
3582, -- ham
7363, -- piercing bolt
12600, -- coal
3577 -- meat
)
end
The fact that SOMETIMES the script works as it should just makes me even more confused. I'm not even sure syntax is the issue.
local idlmanas = 70-(Self.ItemCount(268))
local idlspears = 20-(Self.ItemCount(7378))
local GTW = (idlmanas*50)+(idlspears*15)
--== LABEL MANAGER ==--
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
local func = loadstring(labelName)
if(func)then func()
end
end
--== SHOPPERS ==--
function buyPots()
delayWalker(math.random(10000, 15000))
Self.SayToNpc({"hi", "vials", "no", "yes", "trade"}, 65)
wait(1000, 5000)
Self.ShopBuyItem(268, idlmanas)
end
function buySpears()
delayWalker(math.random(10000, 15000))
Self.SayToNpc({"hi", "trade"}, 65)
wait(1000, 5000)
Self.ShopBuyItem(7378, idlspears)
end
--== DEPOSITERS ==--
function DepositGold()
delayWalker(math.random(10000, 15000))
Self.SayToNpc({"hi", "deposit all", "yes", "withdraw " .. GTW, "yes", "balance"}, 65)
end
function DepositItems()
delayWalker(math.random(15000, 20000))
Self.DepositItems(
3369, -- warrior helmet
7438, -- elvish bow
3073, -- wand of cosmic energy
5922, -- holy orchid
5880, -- iron ore
5896, -- bear paw
3037, -- yellow gem
7398, -- cyclops trophy
7401, -- minotaur trophy
7425, -- taurus mace
5921, -- heaven blossom
3351, -- steel helmet
3384, -- dark helmet
2991, -- doll
3033, -- small amethyst
5897, -- wolf paw
5902, -- honeycomb
3307, -- scimitar
10196, -- orc tooth
11473, -- purple robe
3093, -- club ring
3082, -- elven amulet
5940, -- wolf tooth chain
3091, -- sword ring
3012, -- wolf tooth chain
3092, -- axe ring
236, -- strong health potion
11465, -- elven astral observer
11477, -- orcish gear
3061, -- life crystal
11480, -- skull belt
237, -- strong mana potion
5878, -- minotaur leather
11472, -- minotaur horn
9657, -- cyclops toe
11482, -- piece of warrior armor
11464, -- elven scouting glass
9635, -- elvish talisman
266, -- health potion
11451, -- broken crossbow
11479, -- orc leather
9651, -- scorpion tail
3347, -- hunting spear
11483, -- piece of archer armor
3298, -- throwing knife
3661, -- grave flower
3738, -- sling herb
3147, -- blank rune
3448, -- poison arrow
3582, -- ham
7363, -- piercing bolt
12600, -- coal
3577 -- meat
)
end
The fact that SOMETIMES the script works as it should just makes me even more confused. I'm not even sure syntax is the issue.