Log in

View Full Version : Lua Error.. Need some help :D



Nappy
01-30-2013, 12:39 AM
So I got this error message when the bot got to the Label of bpOpen...

15:33 XenoScript Error:
Script: [Yalahar] Minotaurs - Knight -.lua
Line #: 90
Chunk: ...s\XenoBot\Scripts\[Yalahar] Minotaurs - Knight -.lua
Error: attempt to index a nil value
This is an error with user-input and should not be reported as a bug with XenoBot.



Here are lines 68-93(68-the end)


elseif (Label == "buyPotions") then
Walker.Stop()
if (BuyPots and Self.ItemCount(PotionID) < MaxPotion) then
Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
wait(2000)
if (Self.ItemCount(PotionID) < MaxPotion) then
Self.ShopBuyItemsUpTo(PotionID, MaxPotion)
end
wait(200, 500)
end
Walker.Start()
elseif (Label == "checkPots") then
if (BuyPots and Self.ItemCount(PotionID) < MaxPotion) then
print("Buying Potions")
else
print("Going Spawn")
gotoLabel("goSpawn")
end
elseif (Label == "bpOpen") then
Walker.Stop()
Self.CloseContainers()
wait(900,1000)
Self.OpenMainBackpack(true):OpenChildren(GoldBP):O penChildren(RareBP):OpenChildren(StackableBP)
Walker.Start()
end
end

Im pretty sure that isnt how I do the bp thing so it opens BPs, but IDK... I also didnt have those bps in my main bp may that be the problem?

Spectrus
01-30-2013, 04:45 AM
Calling a member function of the Self class that does not exist. (OpenMainBackpack)



Self.UseItemFromEquipment('backpack')
wait(300, 500)
Container.GetFirst():OpenChildren(GoldBP, RareBP, StackableBP)

Nappy
01-30-2013, 03:50 PM
Perfect! I needed it to open multiple BP's and didnt know how to make it do that.
Thanks ;)

DarkstaR
01-30-2013, 04:12 PM
Actually, OpenMainBackpack should work. It's the way you strung the OpenChildren calls together which made it not work.

Self.OpenMainBackpack():OpenChildren(GoldBP, RareBP, StackableBP)

Nappy
02-02-2013, 12:09 AM
Yea it opened the main, But I didn't know how to make it open multiple Children BPs

Hendy
02-02-2013, 12:20 AM
Nappy GoldBP, RareBP and StackableBP are all variables so in your script you need to either use the actual backpack names in the OpenChildren() or add the variables at set them, like this.


Self.OpenMainBackpack():OpenChildren("Orange Backpack", "Yellow Backpack", "Green backpack")

Or


GoldBP = "Orange Backpack"
RareBP = "Yellow Backpack"
StackableBP = "Green backpack"

Self.OpenMainBackpack():OpenChildren(GoldBP, RareBP, StackableBP)