Seeing as Jduartedj hasn't been online for awhile, I thought I'd start my own thread for my fixed version of his "teleport" userfunction. This version has even more improvements and features than previous versions I've uploaded in other threads.
teleport
Description:
This function allows you to teleport your character over short distances. The maximum distance you can teleport is 120 but this function will try to make shorter hops if the coordinates you give it are too far. If there are obstacles in the way it may fail to teleport.
Syntax:
teleport(x, z, y, absolute)
or
teleport(x, z, absolute)
for backward compatibility.
Arguments:
If absolute is "false" then the x, z, y values are how much it will move by. eg. if x = 20 then it will move 20 to the east.
If absolute is "true" or nil then the x, z, y values are the absolute coordinates it will move to. eg. if x = 4400 then it will move to 4400 on the x axis.
x, z and y are optional but at least one must be specified. If one is omitted then it will not move on that axis.
teleport(4400) -- move to 4400 on the 'x' axis.
teleport(nil,3300) -- move to 3300 on the 'z' axis.
teleport(4400,3300) -- move to 4400, 3300 on the x, z axis.
teleport(50, -50, false) -- move 50 east and 50 south.
teleport(nil, nil, 100, false) -- move 100 straight up.
User settings:
The maximum distance, I've found, that the character can teleport in one go is 120, but this function will try to make shorter hops if the coordinates given are too far. The function uses a maximum step size of 115, to add a little bit of a buffer. Between multiple hops, it will pause for 500 milliseconds for the new location to register. Both these values can be changed by the user with the following functions.
This function will teleport directly to a waypoint. It accepts either the waypoint index number or the waypoints 'tag' if it has one. If the argument is ommitted it teleports to the next waypoint. Also, you don't need to run "__WPL:setWaypointIndex" as the function does it for you.
Syntax:
teleportToWP(index)
Arguments:
If index is a number, it will teleport to that waypoint index number.
If index is a string it will teleport to the waypoint with that "tag" name.
If index is ommitted then it will teleport to the next waypoint.
teleportToWP() -- Will teleport to next waypoint
teleportToWP(3) -- Will teleport to waypoint 3
teleportToWP("repair") -- Will teleport to the waypoint with tag="repair"
Note: Please make sure you delete 'addon_teleport.lua' if it exits.
It's a hack, yes. It's based on jduartedj's teleport userfunction that my optimized Miller's Ranch egg script has been using all this time. The main improvement are; it now accepts 3 coordinates, coordinates are optional and it seems to quite successfully do smaller hops if the distance is too far without being pulled back.
Why, have you just become aware of it?
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
MiesterMan wrote:I knew about the teleport UF but it never really worked for me. The optimized script was faster but I could never see the teleporting.
Also, I haven't farmed eggs in ages.
On my egg script page there was a link to my fixed version of the teleport function. The original teleport function didn't work anymore I think. That reminds me, I should update that link to point here.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
hey Rock5
can you please explain more about the syntax for this teleporter script
and please give an solid example
like where to put it in what section of the code
thx in advance
Last edited by poioip on Sun Sep 18, 2011 8:12 pm, edited 3 times in total.
Yesterday never lives...
Today never goes...
Tomorrow never comes...
Secondly, you shouldn't use teleporting in the open where anyone can see you. You are asking for trouble then. It should only really be used in private places like instances.
portTo is a local function for the millers egg script. It does a couple of checks before using the "teleport" function. So the correct format is
teleport(x, z, y, absolute)
or teleport(x, z, absolute)
for backward compatibility.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
1. Move to waypoint 1111,1111.
2. Do code at waypoint 1111,1111 (Harvests then teleports to coordinates 2222,2222).
3. Move to waypoint 2222,2222 (But I'm already there!).
4. Do code at waypoint 2222,2222 (Harvests then teleports to coordinates 3333,3333).
etc.
I hope you get the picture.
Actually, I could probably simplify this. Add this to the "onLoad" section at the top of the waypoint file.
teleportToWP(2) -- will teleport to waypoint index 2
teleportToWP("NPC") -- will teleport to the waypoint with the tag set to "NPC"
Not implemented -teleportToWP(wp) -- will teleport to 'wp' table where 'wp' has a X, Z and Y value. Can be used to teleport to pawns or objects too.
teleportToWP() -- if the arg is ommitted it will teleport to the next waypoint.
I'll have to test it tomorrow as the server is down.
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.