Page 1 of 3

Rock5's version of teleport

Posted: Tue Jul 19, 2011 11:44 am
by rock5
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.
    Examples:

    Code: Select all

    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.
    • teleport_SetStepSize(val)
      teleport_SetStepPause(val)

-- NEW FUNCTION ADDED--

teleportToWP
  • Description:
    • 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.
    Examples:

    Code: Select all

    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.

Re: Rock5's version of teleport

Posted: Tue Jul 19, 2011 4:21 pm
by MiesterMan
Oooo, is this kind of like a speed hack?

Re: Rock5's version of teleport

Posted: Tue Jul 19, 2011 9:56 pm
by rock5
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?

Re: Rock5's version of teleport

Posted: Tue Jul 19, 2011 10:31 pm
by MiesterMan
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.

Re: Rock5's version of teleport

Posted: Tue Jul 19, 2011 11:25 pm
by rock5
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.

Re: Rock5's version of teleport

Posted: Wed Sep 07, 2011 4:57 am
by Guest1234
This seems broken with the update...

Re: Rock5's version of teleport

Posted: Wed Sep 07, 2011 6:54 am
by rock5
Guest1234 wrote:This seems broken with the update...
Yes, updates can do that. Please read this.
http://www.solarstrike.net/phpBB3/viewt ... =21&t=2912

Re: Rock5's version of teleport

Posted: Wed Sep 07, 2011 6:57 am
by lisa
Mine works fine though *shrug*

Re: Rock5's version of teleport

Posted: Wed Sep 07, 2011 10:06 am
by Guest1234
I did that before getting the updated swimhack.

I will try again tomorrow.

Thanks.

:)

Re: Rock5's version of teleport

Posted: Sun Sep 18, 2011 9:43 am
by poioip
it gives me an error


1:1pm - ...acro/micromacro/scripts/rom/classes/waypointlist.lua:22: XML Prase Er
ror.
File: ...acro/micromacro/scripts/rom/waypoints/XXXXXXXteleport.xml
Line: 3
Column: 23
Pos: 63
Message:not well-formed <invalid token>


the code is

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

	<!-- #  1 -->teleport(31959,3270,22, true)	
	<!-- #  2 -->teleport(32030,3264,23, true)player:harvest();
	<!-- #  3 -->teleport(32098,3290,27, true)player:harvest();
	<!-- #  4 -->teleport(31986,3233,31, true)player:harvest();
	<!-- #  5 -->teleport(32060,3222,39, true)	



Re: Rock5's version of teleport

Posted: Sun Sep 18, 2011 6:30 pm
by poioip
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

Re: Rock5's version of teleport

Posted: Sun Sep 18, 2011 7:04 pm
by Administrator
poioip wrote:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>

	<!-- #  1 -->teleport(31959,3270,22, true)	
	<!-- #  2 -->teleport(32030,3264,23, true)player:harvest();
	<!-- #  3 -->teleport(32098,3290,27, true)player:harvest();
	<!-- #  4 -->teleport(31986,3233,31, true)player:harvest();
	<!-- #  5 -->teleport(32060,3222,39, true)	


You should probably have put that inside the waypoint tags, as per the instructions.

Re: Rock5's version of teleport

Posted: Sun Sep 18, 2011 8:14 pm
by poioip
but still it does not work.... :cry: :cry: :cry:

Re: Rock5's version of teleport

Posted: Sun Sep 18, 2011 8:19 pm
by poioip
hey Rock5!!!

in yout egg script you had

Code: Select all

<!-- #  6 --><waypoint x="3937" z="2978">
		player:target_Object(112956,nil,true,false,feedEvalFunc)
		portTo(3940,3055)	</waypoint>
is the actual syntax as follows:

Code: Select all

<waypoint x="" z="" y=""> portTo("","") </waypoint>
but at the introduction you explained it like as follows

Rock5 said:
Syntax:


teleport(x, z, y, absolute)
or
teleport(x, z, absolute)
for backward compatibility.
which one works? :roll: :roll: :roll:

Re: Rock5's version of teleport

Posted: Mon Sep 19, 2011 12:37 am
by rock5
poioip, first you need to learn the correct structure of waypoint files. I suggest reading this
http://www.solarstrike.net/wiki/index.p ... oinf_files

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.

Re: Rock5's version of teleport

Posted: Mon Sep 19, 2011 7:17 am
by poioip

Code: Select all

<waypoint x="" z="" y=""> portTo("","") </waypoint>
so this is the actual code huh?
ty
or how do i use it with a waypoint and to harvest?

Re: Rock5's version of teleport

Posted: Mon Sep 19, 2011 9:52 am
by rock5
No, I said you have to use "teleport". "portTo" only works in the MRC_Optimised.xml script.

Maybe something like

Code: Select all

<waypoint x="1111" z="1111" y="11"> player:harvest() teleport("2222","2222") </waypoint>
<waypoint x="2222" z="2222" y="22"> player:harvest() teleport("3333","3333") </waypoint>
<waypoint x="3333" z="3333" y="33"> player:harvest() teleport("4444","4444") </waypoint>
etc.
What this does is;
  • 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.

Code: Select all

<onLoad>
    function portToNextWP()
        local nextWP = __WPL.Waypoints[__WPL.CurrentWaypoint]
        teleport( nextWP.X, nextWP.Z, nextWP.Y)
    end
</onLoad>
Then you could do

Code: Select all

<waypoint x="1111" z="1111" y="11"> player:harvest() portToNextWP() </waypoint>
<waypoint x="2222" z="2222" y="22"> player:harvest() portToNextWP()</waypoint>
<waypoint x="3333" z="3333" y="33"> player:harvest() portToNextWP()</waypoint>
etc.

Re: Rock5's version of teleport

Posted: Mon Sep 19, 2011 10:30 am
by poioip
Thank you it works
YAY AT LAST :D :D :D

Re: Rock5's version of teleport

Posted: Tue Sep 20, 2011 8:44 am
by rock5
i'm going to add this to the file. It will work something like this.

Syntax:

Code: Select all

teleportToWP(wp)
Examples:

Code: Select all

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.

Re: Rock5's version of teleport

Posted: Wed Sep 21, 2011 7:54 am
by rock5
Ok, added the new function to version 2.1. Read about it on the first post.