Log in

View Full Version : [HELP] Walk throu mechanism



Ryangiggs
03-27-2012, 08:46 AM
hello im trying to get a .LUA a work. I wanna walk throu nightmare mechanism.
If anyone could help me i would be very glad :d



registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if (labelName == "gate") then
setWalkerEnabled(false)
wait(500)
Self.UseItem(x, y, z, 8615)
wait(500)
setWalkerEnabled(true)
end
end

Spectrus
03-27-2012, 09:08 AM
It would be beneficial if you set x, y, and z to their respective coordinates. Also, Self.UseItem() is the wrong function for the job. Try this:



local pos = {
x = 1234,
y = 1234,
z = 7
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName) do
if labelName == "gate" then
Self.UseItemFromGround(pos.x, pos.y, pos.z)
end
end

DarkstaR
03-27-2012, 11:39 AM
Elaborating on his code, functions which send packet may fail sometimes causing the bot to get stuck. For this reason, you may want o actually do something like this.


local pos = {
x = 1234,
y = 1234,
z = 7
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName) do
if labelName == "gate" then
setBotEnabled(false)
while (Self.UseItemFromGround(pos.x, pos.y, pos.z) == 0) do
wait(50)
end
gotoLabel("AfterGate")
setBotEnabled(true)
end
end

Ryangiggs
03-27-2012, 12:03 PM
It would be beneficial if you set x, y, and z to their respective coordinates. Also, Self.UseItem() is the wrong function for the job. Try this:



local pos = {
x = 1234,
y = 1234,
z = 7
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName) do
if labelName == "gate" then
Self.UseItemFromGround(pos.x, pos.y, pos.z)
end
end

Thank you kind sir. I will try both and see which is best for me. but still. thanks so much for trying! much love / Giggs.
also "14:19 [XenoScript] gate.lua: 'end' expected (to close 'function' at line 9) near '<eof>' "

Ryangiggs
03-27-2012, 12:04 PM
Elaborating on his code, functions which send packet may fail sometimes causing the bot to get stuck. For this reason, you may want o actually do something like this.


local pos = {
x = 1234,
y = 1234,
z = 7
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName) do
if labelName == "gate" then
setBotEnabled(false)
while (Self.UseItemFromGround(pos.x, pos.y, pos.z) == 0) do
wait(50)
end
gotoLabel("AfterGate")
setBotEnabled(true)
end
end
I will try later. So i first need to make label "gate" and then after it used "after gate"?

And thank you kind sir!


14:19 [XenoScript] gate.lua: 'end' expected (to close 'function' at line 9) near '<eof>'

DarkstaR
03-27-2012, 12:46 PM
Remove the do after the function line. I didn't even notice Spectrus was stupid enough to do that.

Ryangiggs
03-27-2012, 01:04 PM
Remove the do after the function line. I didn't even notice Spectrus was stupid enough to do that.

@EDIT.
Ive tryed remove the "do" and in both of your script. nothing seems to work:/..

danonix
03-27-2012, 02:49 PM
Remove the do after the function line. I didn't even notice Spectrus was stupid enough to do that.

That sounds fearfully

Ryangiggs
03-27-2012, 03:46 PM
That sounds fearfully

you know the solution? :/

Spectrus
03-27-2012, 06:49 PM
it was late! :o

Ryangiggs
03-28-2012, 05:13 AM
it was late! :o
Can you make it work? :d.

Spectrus
03-28-2012, 05:54 AM
local pos = {
x = 1234,
y = 1234,
z = 7
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if labelName == "gate" then
while Self.UseItemFromGround(pos.x, pos.y, pos.z) == 0 do
wait(50)
end
end
end


Should be fine... lol

Ryangiggs
03-28-2012, 06:21 AM
local pos = {
x = 1234,
y = 1234,
z = 7
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if labelName == "gate" then
while Self.UseItemFromGround(pos.x, pos.y, pos.z) == 0 do
wait(50)
end
end
end


Should be fine... lol
nop, log into a character and try :s. doesnt work. or is it my fault?. shall i change anything?. enter mechanism id? or anything?. or just copy all and go?

Forgee
03-28-2012, 08:07 AM
You should change the coordinates (at the top) to where the mechanism is located.

Ryangiggs
03-28-2012, 08:59 AM
You should change the coordinates (at the top) to where the mechanism is located.
Okey, how do I do that? :D

Spectrus
03-28-2012, 09:01 AM
Can you get the coordinates of the mechanism for me...? Lol.

You just need to put them in to the x, y, and z fields of pos at the top of the script.

Ryangiggs
03-28-2012, 09:06 AM
Can you get the coordinates of the mechanism for me...? Lol.

You just need to put them in to the x, y, and z fields of pos at the top of the script.

I dont know how to see/get the coordinates, Is it hard or IM a total retard? :o

Forgee
03-28-2012, 09:12 AM
Which side of the mechanism are you standing?

Ryangiggs
03-28-2012, 09:16 AM
Which side of the mechanism are you standing?

From yalahar. >(MECHANISM)< < (ME).

So from the right. mechanism is to left from me.

Forgee
03-28-2012, 09:22 AM
Stand beside the mechanism and run this script. It will show you the coordinates (green text in server log).


while true do
print("x: " .. Self.Position().x - 1 .. ", y: " .. Self.Position().y .. ", z: " .. Self.Position().z)
wait(10000)
end

Ryangiggs
03-28-2012, 09:23 AM
Stand beside the mechanism and run this script. It will show you the coordinates (green text in server log).


while true do
print("x: " .. Self.Position().x - 1 .. ", y: " .. Self.Position().y .. ", z: " .. Self.Position().z)
wait(10000)
end

from the right or does it matter?

Forgee
03-28-2012, 09:26 AM
From the right, as you mentioned above.

Ryangiggs
03-28-2012, 09:26 AM
From the right, as you mentioned above.

ty!!!!!!!!!

x: 32775, y: 31145, z: 5

Spectrus
03-28-2012, 09:28 AM
local pos = {
x = 32775,
y = 31145,
z = 5
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if labelName == "gate" then
while Self.UseItemFromGround(pos.x, pos.y, pos.z) == 0 do
wait(50)
end
end
end

I STEAL THE THUNDAH.

Forgee
03-28-2012, 09:28 AM
local pos = {
x = 32775,
y = 31145,
z = 5
}

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if labelName == "gate" then
while Self.UseItemFromGround(pos.x, pos.y, pos.z) == 0 do
wait(50)
end
end
end
That should be it.

Ryangiggs
03-28-2012, 09:48 AM
Thanks you both!!, it works now :DDDDD.