Log in

View Full Version : Is Walker.IsStuck() a working function?



KKam II
03-02-2016, 07:29 PM
As an example, would this script work?



while (true) do

if Walker.IsStuck() then
count = count + 1

if (count == 1) then
Walker.Goto(label1)
elseif (count == 2) then
Walker.Goto(label2)
elseif (count == 3) then
Walker.Goto(label3)
end
end

if not Walker.IsStuck() then
count = 0
end

end

Jontor
03-02-2016, 07:45 PM
What are you trying to do?

Fatality
03-02-2016, 10:11 PM
Walker.IsStuck() is a working function.


--- Is walker stuck.
-- Returns whether the walker is stuck or not
-- class Walker
-- return boolean true or false
Walker.IsStuck = getWalkerStuck


And I agree with Jontor, What are you doing?

KKam II
03-03-2016, 05:55 PM
My North American characters have been getting kicked recently without reconnect always working, the clients seem to hang. If I run my scripts while they're in a spawn, walker stuck gets activated. So I've been bringing characters back near the starting point (reason below) but that takes too long. I'm trying to find a work around.

Thanks Fatality, I looked at that but wasn't sure since it didn't have the '()' beside it. Wanted confirmation before I did any implementations.

Is there anything wrong with the logic of the above script? I'll run it as a module instead of while (true).

Edit:
The reason I bring my characters back to starting point and not change the position manually is because I created a system that auto launches clients, logs in credentials and loads settings while I'm at work or sleep.

shadowart
03-03-2016, 11:37 PM
Your initial plan may run into some problems when you get stuck due to monsters or players or teleports and stuff like that.

If you just want your script to start from the right label it will run smoother if you create a table with all possible starting labels and their location, and go to the closest one on the right floor when you start the script (or when you reach a starting abel).

If you don't care about some inefficiencies you could just use your first script with some minor edits though:

Add a wait after the if-statement, maybe 2-5s or so.
Make sure the count variable is initialized to 0 in the beginning of the script.
Change "count = count + 1" to "count = (count + 1) % X" where X is 1 + the total number of labels you have. Also move it till after the if-statement (you don't want to change label on the first stuck).
If you want to ceal up the code you can also stuff your labels into a table and index into it using the count variable.