PDA

View Full Version : Paladin Spear Buyer help



Tepre
08-29-2012, 04:11 AM
So for what ever reason this script does not seem to be working.It talks to the Npc opens the trade window then walks away, some help would be great as I am just learning.:confused:

SpearBuy = 30
SpearMin = 12
SpearId = 7378

-----------------------------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "Spear") then
setBotEnabled(false)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(1000,2000)
Self.ShopBuyItem(SpearId,(SpearBuy-Self.ItemCount(SpearId)))
wait(1000,2000)
setBotEnabled(true)
end
end

Taywedge
08-29-2012, 04:54 AM
So for what ever reason this script does not seem to be working.It talks to the Npc opens the trade window then walks away, some help would be great as I am just learning.:confused:

SpearBuy = 30
SpearMin = 12
SpearId = 7378

-----------------------------------------------------------------------------------------------------
dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "Spear") then
setBotEnabled(false)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(1000,2000)
Self.ShopBuyItem(SpearId,(SpearBuy-Self.ItemCount(SpearId)))
wait(1000,2000)
setBotEnabled(true)
end
end

Use this edited version. You forgot the dofile("Forgee.lua") in your script, assuming you have Forgee's Library. If not please download it from here:http://forums.xenobot.net/showthread.php?2392-Lua-functions-by-Forgee&highlight=forgee+library
Place that .lua in your "scripts" folder, DO NOT EXECUTE, and you should be good. Any problems please post them :)

Edit: How lame of me, I forgot to credit Forgee :/ well anyways all credits go to Forgee for his amazing Library which I use frequently :)

Kingdom
08-29-2012, 04:59 AM
up @ no need for dofile, is old.. learned by darkstar

Fixed your config, and added also a label called bank so it refills correct cash after x spears.




SpearBuy = 30
Spearprice = 15
SpearMin = 15
SpearId = 7378

-----------------------------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "Bank") then
setWalkerEnabled(false)
Self.SayToNpc({"hi", "deposit all", "yes", "balance"}, 65)
wait(900, 1200)
Self.WithdrawMoney((Spearprice*(SpearBuy-Self.ItemCount(SpearId))))
wait(900, 1200)
Self.SayToNpc("yes")
wait(900, 1200)
setWalkerEnabled(true)
elseif (labelName == "Spear") then
setWalkerEnabled(false)
wait(900, 1200)
Self.SayToNpc({"Hi", "flasks", "yes", "yes", "yes", "Trade"}, 65)
wait(1200, 2000)
Self.ShopBuyItem(SpearId, SpearBuy-Self.ItemCount(SpearId))
wait(900, 1200)
setWalkerEnabled(true)
end
end