Log in

View Full Version : Restar Backpacks



metalhector222
05-10-2013, 11:38 PM
Greetings!

I need a simple a easy scripts to close and re-open the main back and the others backs! please!

Xeno Scripts
05-10-2013, 11:53 PM
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)

Insert this in your lua file. It will reopen your bps and minimize them after.

metalhector222
05-10-2013, 11:56 PM
This is a full basic scripts?

metalhector222
05-10-2013, 11:57 PM
19:25 XenoScript Error:
Script: OpenBackpacks.lua
Line #: 1
Chunk: C:?Users?Kazuya?Documents?XenoBot?Scripts?OpenBack packs.lua
Error: '<eof>' expected near 'elseif'
This is an error with user-input and should not be reported as a bug with XenoBot.

Sorry, I'm new in LUA code! :(

Xeno Scripts
05-11-2013, 12:00 AM
19:25 XenoScript Error:
Script: OpenBackpacks.lua
Line #: 1
Chunk: C:?Users?Kazuya?Documents?XenoBot?Scripts?OpenBack packs.lua
Error: '<eof>' expected near 'elseif'
This is an error with user-input and should not be reported as a bug with XenoBot.

Sorry, I'm new in LUA code! :(

Try copy my script again, you have the wrong code :P

metalhector222
05-11-2013, 12:09 AM
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)

Insert this in your lua file. It will reopen your bps and minimize them after.

I added end But still does'nt working :(


resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)
end


19:35 XenoScript Error:
Script: OpenBackpacks.lua
Line #: 1
Chunk: ...s?Kazuya?Documents?XenoBot?Scripts?OpenBackpack s.lua
Error: attempt to call global 'resetBackpacks' (a nil value)
This is an error with user-input and should not be reported as a bug with XenoBot.

Xeno Scripts
05-11-2013, 12:10 AM
Yeah, I copied wrong.

And sorry, I forgot you must have Forgee's library!

puttzor
05-11-2013, 12:10 AM
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)

I have no idea if the script works but I see that your missing an end. I think it should be


resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)
end

I don't believe there is a there is function call resetBackpacks in the XenoLuaLib. If your using a custom function then you have to include the declaration of the function too.

metalhector222
05-11-2013, 12:12 AM
puttzor

can u give me a example? please!! :D

Xeno Scripts
05-11-2013, 12:12 AM
I have no idea if the script works but I see that your missing an end. I think it should be


resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)
end

I don't believe there is a there is function call resetBackpacks in the XenoLuaLib. If your using a custom function then you have to include the declaration of the function too.

Yeah, my fault! :)

If you already have other labels in the lua script that starts with:

dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

Then you can just add this code:

elseif (labelName == "backpackReset") then
setWalkerEnabled(false)
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)
end
setWalkerEnabled(true)

metalhector222
05-11-2013, 12:16 AM
omg, i am so confused...

I must download this Forgee.lua?

I am testing the scripts first in Scripters XENOBOT. I'm not working in Walker yet!

metalhector222
05-11-2013, 12:20 AM
Waht about this?


dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)


Are you sure that there is not necessary a end?

metalhector222
05-11-2013, 12:22 AM
:'(

19:51 XenoScript Error:
Script: OpenBackpacks.lua
Line #: 7
Chunk: C:?Users?Kazuya?Documents?XenoBot?Scripts?OpenBack packs.lua
Error: 'end' expected (to close 'for' at line 5) near '<eof>'
This is an error with user-input and should not be reported as a bug with XenoBot.

puttzor
05-11-2013, 12:25 AM
metalhector222 if you need further explanation then don't be afraid to ask

Edit: sorry, didn't see your post, explanation inc

metalhector222
05-11-2013, 12:29 AM
I tried this:


dofile("Forgee.lua")
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)
end


but

19:56 XenoScript Error:
Script: OpenBackpacks.lua
Error: cannot open C:?Users?Kazuya?Documents?XenoBot?Scripts?Forgee.l ua: No such file or directory
This is an error with user-input and should not be reported as a bug with XenoBot.

I am still testing, I must download this Forgee.lua?

Xeno Scripts
05-11-2013, 12:33 AM
If you just want a simple reopner. Search and download Forgee's library, then:


dofile("Forgee.lua")
resetBackpacks()

metalhector222
05-11-2013, 12:44 AM
IT'S WORKING!!! :D
Thanks very much guys!!!

To those who need to download Forgee's library go here (http://forums.xenobot.net/showthread.php?2392-Lua-functions-by-Forgee)!

puttzor
05-11-2013, 12:45 AM
yes, you don need an end to close that for loop. As the error massage tells you

Error: 'end' expected (to close 'for' at line 5) near '<eof>

there is a couple of things you need to do. first you must download forgees lua lib if you want to use that function.

you can do that here: http://forums.xenobot.net/showthread.php?2392-Lua-functions-by-Forgee

secondly you want to put that file in your xenobots scripts folder like any other script. now, what you don't want to do though is executing it like any other script. if you want to use a function from forgees lua lib then simply put this code at the start of your scripts

dofile("Forgee.lua")
after that you can use his functions anywhere you want in your script.

I'd solve it by doing it like this. Add this elseif in your onWalkerSelectLabel function

elseif (labelName == "resetbp") then
resetBackpacks()
local indexes = Container.GetAll()
for i = 1, #indexes do
Container.New(indexes[i]):Minimize()
wait(400, 800)
end

if the walker comes to a label called resetbp then it will do all the things in that elseif. Haven't tested Xeno Scripts so I can't tell if this will work but I'm sure it will

Edit: I'm always one minute behind, aren't I? ;)