Log in

View Full Version : could use some help by an experienced scripter



Geovl96
04-27-2013, 12:13 PM
problem is solved, thanks to everyone who helped


remove thread

kubax36
04-27-2013, 01:31 PM
if u want someone to help u then u need to paste your script here also, not only errors

Geovl96
04-27-2013, 01:58 PM
coulden't fit it all but here is the important part


-----------------[KNIGHT] Thais MT Sternum by Geovl------------------------

local minCap = 50 --Cap to leave spawn--

local manasToLeave = 30 --Manas to go hunt--
local wantedManas = 150 --How many manas to buy--
local manaPotID = 268 --Manapotion ID (Default is mana potion (268)--
local manaCost = 50 --Cost of mana potion (mana potion=50, strong mana potion=80)--
local healthsToLeave = 10 --Manas to go hunt--
local wantedHPs = 30 --How many health potions to buy--
local healthPotID = 236 --HealthpotionID (Default is strong health potion (236)--
local healthCost = 80 --Cost of health potion (health potion=50, strong health potions=80)--
--Backpacks--a

--You need to have 1 main bp and 3 bps inside--

--Main BP--
--StackablesBP--
--ItemsBP--
--GoldBP--

--Make sure that they are all open when you run xbst and execute script--

--DONT CHANGE ANYTHING BELOW THIS LINE--


print("[KNIGHT] Thais MT Sternum by Geovl")

registerEventListener(WALKER_SELECTLABEL, "SelectLabel")
function onWalkerSelectLabel(labelName)

if (labelName == "inDP") then
if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < then healthsToLeave))) then
gotoLabel("Resupply")
else
gotoLabel("goHunt")
end

elseif (labelName == "reachDepot") then
Self.ReachDepot()

elseif (labelName == "depositGold") then
setWalkerEnabled(false)
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700,1400))
Self.SayToNpc("deposit all")
sleep(math.random(300,1000))
Self.SayToNpc("yes")
sleep(math.random(300,1000))
Self.WithdrawMoney((manaCost*(wantedManas-Self.ItemCount(manaPotID))))
sleep(math.random(300,1000))
Self.WithdrawMoney((healthCost*(wantedHPs-Self.ItemCount(healthPotID))))
sleep(math.random(300,1000))
Self.SayToNpc("yes")
sleep(math.random(300,1000))
Self.SayToNpc("balance")
setWalkerEnabled(true)

elseif (labelName == "depositItems) then
Self.DepositItems
(
{9657, 1},
{7398, 1},
{7452, 2},
{3269, 2},
{3052, 2}
)

elseif (labelname == "atManaShop" then
setWalkerEnabled(false)
delayWalker(7000)
Self.Say"(hi"
sleep(math.random(800,1700))
Self.SayToNpc("trade")
sleep(math.random(2000, 2400))
buyManas(manaPotID, (wantedManas-Self.Itemcount(manaPotID)))
sleep(math.random(800,1700))
buyHealths(healthPotID, (wantedHPs-Self.Itemcount(healthPotID)))
sleep(math.random(800,1700))
setWalkerEnabled(true)

elseif (labelName == "resetBP")
setWalkerEnabled(false)
resetBackpacks()
setWalkerEnabled(true)

elseif (labelName == "checker") then
if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave)) or ((Self.ItemCount(healthPotID < then healthsToLeave)) then
gotoLabel("Resupply")
else
gotoLabel("atHunt")
end

elseif (labelName == "goneBack" then
gotoLabel("inDP")

end
end
end

function buyManas(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 100)
if(Self.ShopBuyItem(item, amnt) == 0)then
return printf("ERROR", tostring(item))
end
wait(200,500)
count = (count - amnt)
until count <= 0
end

function buyHealths(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 100)
if(Self.ShopBuyItem(item, amnt) == 0)then
return printf("ERROR", tostring(item))
end
wait(200,500)
count = (count - amnt)
until count <= 0
end

kubax36
04-27-2013, 02:28 PM
replace this

if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < then healthsToLeave))) then
to this

if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < healthsToLeave))) then

it was error from 33 line of script, havent checked anything else. If u will get another error just paste it there and i will try to help you.

Hendy
04-27-2013, 02:48 PM
Also change this at the label, atManaShop

Self.Say"(hi"

To

Self.Say("hi")

Geovl96
04-27-2013, 03:12 PM
replace this

if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < then healthsToLeave))) then
to this

if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < healthsToLeave))) then

it was error from 33 line of script, havent checked anything else. If u will get another error just paste it there and i will try to help you.


Hmm still having some issues


}

LUA Error:

{ RAW: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua:33: ')' expected near 'then'

Parsed:

{

Line #: 33
Chunk: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua
Error: ')' expected near 'then'}

}

LUA Error:

{ RAW: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua:60: unfinished string near '"depositItems) then'

Parsed:

{

Line #: 60
Chunk: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua
Error: unfinished string near '"depositItems) then'}

}

LUA Error:

{ RAW: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua:62: ambiguous syntax (function call x new statement) near '('

Parsed:

{

Line #: 62
Chunk: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua
Error: ambiguous syntax (function call x new statement) near '('}

}

LUA Error:

{ RAW: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua:68: ')' expected near 'then'

Parsed:

{

Line #: 68
Chunk: ...\Users\George VL\Documents\XenoBot\Scripts\[KNIGHT] Thais MT Sternum.lua
Error: ')' expected near 'then'}

}

Geovl96
04-27-2013, 03:23 PM
if someone got some time and wants to help me through skype/facebook or something id really appreciate it, ill pay 5$

kubax36
04-27-2013, 08:59 PM
if someone got some time and wants to help me through skype/facebook or something id really appreciate it, ill pay 5$

its not a fucking IBot or RedBot forum, if someone know how to help u and have time then will help you for free


-----------------[KNIGHT] Thais MT Sternum by Geovl------------------------

local minCap = 50 --Cap to leave spawn--

local manasToLeave = 30 --Manas to go hunt--
local wantedManas = 150 --How many manas to buy--
local manaPotID = 268 --Manapotion ID (Default is mana potion (268)--
local manaCost = 50 --Cost of mana potion (mana potion=50, strong mana potion=80)--
local healthsToLeave = 10 --Manas to go hunt--
local wantedHPs = 30 --How many health potions to buy--
local healthPotID = 236 --HealthpotionID (Default is strong health potion (236)--
local healthCost = 80 --Cost of health potion (health potion=50, strong health potions=80)--
local GoldBP = "Brocade Backpack"
--Backpacks--a

--You need to have 1 main bp and 3 bps inside--

--Main BP--
--StackablesBP--
--ItemsBP--
--GoldBP--

--Make sure that they are all open when you run xbst and execute script--

--DONT CHANGE ANYTHING BELOW THIS LINE--


print("[KNIGHT] Thais MT Sternum by Geovl")


registerEventListener(WALKER_SELECTLABEL, "SelectLabel")
function onWalkerSelectLabel(labelName)

if (labelName == "inDP") then
if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < healthsToLeave)))) then
gotoLabel("Resupply")
else
gotoLabel("goHunt")
end


elseif (labelName == "reachDepot") then
Self.ReachDepot()

elseif (labelName == "depositGold") then
setWalkerEnabled(false)
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700,1400))
Self.SayToNpc("deposit all")
sleep(math.random(300,1000))
Self.SayToNpc("yes")
sleep(math.random(300,1000))
Self.WithdrawMoney((manaCost*(wantedManas-Self.ItemCount(manaPotID))))
sleep(math.random(300,1000))
Self.WithdrawMoney((healthCost*(wantedHPs-Self.ItemCount(healthPotID))))
sleep(math.random(300,1000))
Self.SayToNpc("yes")
sleep(math.random(300,1000))
Self.SayToNpc("balance")
setWalkerEnabled(true)

elseif (labelName == "depositItems") then
Self.DepositItems({9657, 1}, {7398, 1}, {7452, 2}, {3269, 2}, {3052, 2})

elseif (labelname == "atManaShop") then
setWalkerEnabled(false)
delayWalker(7000)
Self.Say("hi")
sleep(math.random(800,1700))
Self.SayToNpc("trade")
sleep(math.random(2000, 2400))
buyManas(manaPotID, (wantedManas-Self.Itemcount(manaPotID)))
sleep(math.random(800,1700))
buyHealths(healthPotID, (wantedHPs-Self.Itemcount(healthPotID)))
sleep(math.random(800,1700))
setWalkerEnabled(true)

elseif (labelName == "resetBP") then
setWalkerEnabled(false)
Container.Close(GoldBP)
wait(900)
wait (1000)
Container.GetFirst():OpenChildren(GoldBP)
setWalkerEnabled(true)

elseif (labelName == "checker") then
if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < healthsToLeave)))) then
gotoLabel("Resupply")
else
gotoLabel("atHunt")
end

elseif (labelName == "goneBack") then
gotoLabel("inDP")

end
end
function buyManas(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 100)
if(Self.ShopBuyItem(item, amnt) == 0)then
return printf("ERROR", tostring(item))
end
wait(200,500)
count = (count - amnt)
until count <= 0
end

function buyHealths(item, count)
count = tonumber(count) or 1
repeat
local amnt = math.min(count, 100)
if(Self.ShopBuyItem(item, amnt) == 0)then
return printf("ERROR", tostring(item))
end
wait(200,500)
count = (count - amnt)
until count <= 0
end
check it now, i changed your bp resetter, u need to change your gold bp name in settings

Geovl96
04-27-2013, 09:46 PM
awesome! after some small tweaks now the script is running awesome, but i still have 1 problem and that is that when he gets to "atManaShop" and is supposted to buy manas/hps he just skips it and walks to hunt instead :/ tried everything else and it worked flawlessly, need some help with shop thingy then im putting in two more checkers and its ready for testing

dinmamma
04-27-2013, 10:25 PM
elseif (labelname == "atManaShop") then
setWalkerEnabled(false)
delayWalker(7000)
Self.Say("hi")
sleep(math.random(800,1700))
Self.SayToNpc("trade")
sleep(math.random(2000, 2400))
buyManas(manaPotID, (wantedManas-Self.Itemcount(manaPotID)))
sleep(math.random(800,1700))
buyHealths(healthPotID, (wantedHPs-Self.Itemcount(healthPotID)))
sleep(math.random(800,1700))
setWalkerEnabled(true)
buyManas is not a native XenoBot function, idk if it's a forgee one or something. In that case you would need forgees function lib and call for it in the start of ur script.

Edit: nvm the function is at the end of ur script anyways.

kubax36
04-27-2013, 10:28 PM
-----------------[KNIGHT] Thais MT Sternum by Geovl------------------------

local minCap = 50 --Cap to leave spawn--

local manasToLeave = 30 --Manas to go hunt--
local wantedManas = 150 --How many manas to buy--
local manaPotID = 268 --Manapotion ID (Default is mana potion (268)--
local manaCost = 50 --Cost of mana potion (mana potion=50, strong mana potion=80)--
local healthsToLeave = 10 --Manas to go hunt--
local wantedHPs = 30 --How many health potions to buy--
local healthPotID = 236 --HealthpotionID (Default is strong health potion (236)--
local healthCost = 80 --Cost of health potion (health potion=50, strong health potions=80)--
local GoldBP = "Brocade Backpack"
--Backpacks--a

--You need to have 1 main bp and 3 bps inside--

--Main BP--
--StackablesBP--
--ItemsBP--
--GoldBP--

--Make sure that they are all open when you run xbst and execute script--

--DONT CHANGE ANYTHING BELOW THIS LINE--


print("[KNIGHT] Thais MT Sternum by Geovl")


registerEventListener(WALKER_SELECTLABEL, "SelectLabel")
function onWalkerSelectLabel(labelName)

if (labelName == "inDP") then
if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < healthsToLeave)))) then
gotoLabel("Resupply")
else
gotoLabel("goHunt")
end


elseif (labelName == "reachDepot") then
Self.ReachDepot()

elseif (labelName == "depositGold") then
setWalkerEnabled(false)
delayWalker(5000)
Self.Say("hi")
sleep(math.random(700,1400))
Self.SayToNpc("deposit all")
sleep(math.random(300,1000))
Self.SayToNpc("yes")
sleep(math.random(300,1000))
Self.WithdrawMoney((manaCost*(wantedManas-Self.ItemCount(manaPotID))))
sleep(math.random(300,1000))
Self.WithdrawMoney((healthCost*(wantedHPs-Self.ItemCount(healthPotID))))
sleep(math.random(300,1000))
Self.SayToNpc("yes")
sleep(math.random(300,1000))
Self.SayToNpc("balance")
setWalkerEnabled(true)

elseif (labelName == "depositItems") then
Self.DepositItems({9657, 1}, {7398, 1}, {7452, 2}, {3269, 2}, {3052, 2})

elseif (labelname == "atManaShop") then
setWalkerEnabled(false)
Self.SayToNpc({"Hi", "Trade"}, 65)
wait(900, 1200)
Self.ShopBuyItemsUpTo(manaPotID, wantedManas)
wait(200, 500)
Self.ShopBuyItemsUpTo(healthPotID, wantedHPs)
setWalkerEnabled(true)

elseif (labelName == "resetBP") then
setWalkerEnabled(false)
Container.Close(GoldBP)
wait(900)
wait (1000)
Container.GetFirst():OpenChildren(GoldBP)
setWalkerEnabled(true)

elseif (labelName == "checker") then
if (Self.Cap() < minCap or ((Self.ItemCount(manaPotID < manasToLeave))) or ((Self.ItemCount(healthPotID < healthsToLeave)))) then
gotoLabel("Resupply")
else
gotoLabel("atHunt")
end

elseif (labelName == "goneBack") then
gotoLabel("inDP")

end
end
now should work at manashop also

Geovl96
04-27-2013, 10:37 PM
hmm wierdly enough he just keeps getting to the buymanas label and then he just goes on to hunt, i have been trying different codes from other scripts to get the buy manas thing to work but wierldy it just wont work even though bank works fine.... It doesnt even disable walker when it gets to the label i checked it now :/ any ideas? really appreciate the help btw

dinmamma
04-27-2013, 10:42 PM
And you are sure that you have hp and mp under the values that are "wanted"? So it really needs to resupply. Otherwise it would just stop and start the walker again.
I know it sounds stupid, but sometimes even the easy mistakes happen :)

Geovl96
04-27-2013, 10:49 PM
hehe yeah im sure :) dinmamma check pm please :)

kubax36
04-27-2013, 10:54 PM
hmm wierdly enough he just keeps getting to the buymanas label and then he just goes on to hunt, i have been trying different codes from other scripts to get the buy manas thing to work but wierldy it just wont work even though bank works fine.... It doesnt even disable walker when it gets to the label i checked it now :/ any ideas? really appreciate the help btw

check if labelname is same in walker and in Lua, check capital letters, it need to be exactly same

Geovl96
04-27-2013, 10:56 PM
it is! really wierd :/

Geovl96
04-27-2013, 11:16 PM
ok well the problem is that when he gets to the label that he is supposted to he skips it (as if it would be falsely written in the lua, but it isnt)