Log in

View Full Version : first step error



n1rosa
08-13-2013, 08:16 PM
hello all

(sorry if posted in wrong forum)

just bought xenobot today and i've tried a few scripts from this webiste. works fine, anyway..

im looking for some help to start scripting my own .lua files and making my own bot-hunts. I've looked up some tutorials on youtube and read some posts on this forum and im stocked to start experiment with this. one thing thought.. i've never done any programming in my whole life. brand new to this.

i got the scipting engine for windows from Lua's website.
got xenobot properly installed
anything else I need?

i was thinking about mixing programming with tibia related stuff(no shit:p). i mean immediately start scripting something for tibia. observe and check and try other ppls scripts for better understanding and learning, therefore become more experienced. hopefully!

so if you have any tips for me, please share


I already started some and can someone explain why this happens when I try to run script:

"attempt to call global 'registerEventListener' (a nil value)"

------------
script look like this:


local MinCap = 100

print("RookTest Script")

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function SelectLabel(Label)
if (Label == ("check")) then
print("Current Capacity: " .. math.ceil(Self.Cap()))
if (Self.Cap() > MinCap) then
gotoLabel("leaveHunt")
end
end
Walker.Start()
end


/n1

Xeromex
08-13-2013, 08:18 PM
Try this;

local MinCap = 100

print("RookTest Script")

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(Label)
if (Label == ("check")) then
print("Current Capacity: " .. math.ceil(Self.Cap()))
if (Self.Cap() > MinCap) then
gotoLabel("leaveHunt")
end
end
Walker.Start()
end

n1rosa
08-13-2013, 08:25 PM
nop. wont run


>lua -e "io.stdout:setvbuf 'no'" "Rooktest.lua"
RookTest Script
lua: Rooktest.lua:3: attempt to call global 'registerEventListener' (a nil value)
stack traceback:
Rooktest.lua:3: in main chunk
[C]: ?
>Exit code: 1

DarkstaR
08-13-2013, 08:37 PM
I'm cracking up. Why the hell are you trying to run an XenoBot script from the LUA terminal?

Syntax
08-13-2013, 08:41 PM
(because those functions only exist in XenoBot)

n1rosa
08-13-2013, 08:45 PM
haha dunno. some guy at youtube did :P what terminal should i use then

jo3bingham
08-13-2013, 08:46 PM
haha dunno. some guy at youtube did :P what terminal should i use then

XenoBot.

Spectrus
08-13-2013, 08:47 PM
Just execute the script from within Xenobot. Right click your character while injected, select Scripter, find the script in the list, and hit execute.