Teleporter Functions

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Teleporter Functions

#1 Post by MiesterMan » Tue Jun 21, 2011 3:05 am

Updated: 7/2/2011 12:01 AM PST
Version 1.4


Description: A set of functions to help with zoning, teleporting, and entering and leaving houses and guildcastles.

Function Descriptions:

Code: Select all

	-----------------------------------------------------------
	------------ MiesterMan's Teleporter Functions ------------
	------------------- Version 1.4 ---------------------------
	-----------------------------------------------------------

-- Returns the ZoneID
function getZoneID()

-- Returns the Server Name
function getServer()

-- This function will swap gear sets before leaving party to 
-- exit an instance. Then it wait until you're close to the
-- coords listed in _X, _Z before continuing the script.
function partyQuitExit(_X,_Z)

-- Accepts: Coords, Zone ID, "next", "file: <path filename>" and if
-- needed a teleporter's name and the ChoiceOption on their menu.
-- Then waits till you are close to the coords to continue.
-- Note:  Zone ID can be Zone ID number, "house", "guild" or "any" (anywhere but house or guild)
function isTeleport(_X,_Z,_teleporter,_option)

-- This function will return true if in the indicated zone, false otherwise.
-- Accepts: Zone ID (number), "guild", "house", or "any" (anywhere but guild or house)
function checkZone(_zoneID)

-- This function will enter a different house than the one
-- owned by the character.
function visitHouseEnter(housemaid,housename,housepass)

-- Will leave the visit house.
function visitHouseLeave(_zoneID)

-- Will leave the character's house.
function houseLeave(_zoneID)

-- Will enter the character's house.
function houseEnter(housemaid)

-- Will enter the character's guild castle.
function guildCastleEnter()

-- Will leave a guild castle.
function guildCastleLeave(_zoneID)
Examples:

Code: Select all

-- Teleport from Varnas gate to Central Varnas and load GotoAuction.XML
isTeleport("file: GotoAuction.XML","Lieve",2);

-- Teleport from Southern Janost to Channel 1 Thunderhoof
isTeleport(15,"Snoop the Stubborn",3);

-- Enter a dungeon using zone checking
repeat
	keyboardPress(key.VK_W); 
until checkZone(DungeonZoneID);
player:rest(2);
loadPaths("file: DungeonScript.XML");

-- Enter house in Howling Mountains
houseEnter("Meydo");

-- Enter another player's house in Howling Mountains
visitHouseEnter("Meydo","OtherDudesHouseName","HousePassword");

-- Leave house to Thunderhoof Channel 1
houseLeave(15);

-- Leave another player's house to Thunderhoof Channel 1
visitHouseLeave(15);

-- Leave Party to TP out of Dungeon and load DungeonReset.XML
partyQuitExit("file: DungeonReset.XML");
Changelog:
  • V 1.0
    • Freshly posted
  • V 1.1
    • Added functionality to isTeleport()
      • Now automatically accepts static popups (teleport fees and confirms)
      • Now accepts "next" for teleport check coords.
      • Now accepts "file: <path filename>" to load a waypointfile and use the first waypoint as the teleport check coords.
      • Zone ID can now be the Zone ID number, "house", "guild", or, "any" (for anywhere but house or guild)
  • V 1.2
    • Changed the name of the housename variable for visitHouseEnter() (probably only an issue with my settings but to be safe I'm updating the userfunction).
  • V 1.3
    • Added auto-accept popup to coord version of isTeleport function (I was using SL and didn't realize it wasn't working right).
    • Improved the auto-accept functionality by adding a split second wait before sending the command.
  • V 1.4
    • RENAMED from Zone to Teleporter to reflect primary usage.
    • There were issues with isTeleport chaining teleporters with the same name together. This has been resolved.
    • There was an issue with the waypoint calculation that changed (WP index is updated before code is executed now). isTeleport now chooses the correct waypoint.
    • Locals in the isTeleport function are now redeclared if not properly declared by the argument list.
    • Added new memory scan function that's survived the last two patches getServer which returns the current Server Name.


userfunction_teleporter.lua
Removed previous versions as they outright don't work with the current Rombot.

V 1.4
(10.8 KiB) Downloaded 681 times
Last edited by MiesterMan on Sat Jul 02, 2011 2:06 am, edited 11 times in total.

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Zoning Functions

#2 Post by lisa » Tue Jun 21, 2011 3:38 am

Nice work, I guess it isn't commonly known but the
waitForLoadingScreen()
also has a maximum time to wait built into the function in the arguments
waitForLoadingScreen(5000)
Can't remember off the top of my head if it is in seconds or thousands of a second like most other things.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Zoning Functions

#3 Post by MiesterMan » Tue Jun 21, 2011 4:58 am

It's in seconds. But I almsot always use loops out of fear. :|

I wanted to add the ability to detect the next waypoint and have it automatically be the coords for isTeleport if there were no arguments but I also have a very hard time with the waypointlist functions other than setDirection.

kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Zoning Functions

#4 Post by kanta » Wed Jun 22, 2011 8:58 pm

Could you maybe give some examples and explanations of each command?
Scout/Knight/Rogue 70/66/66

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Zoning Functions

#5 Post by MiesterMan » Thu Jun 23, 2011 12:49 am

Added Descriptions. Will add examples in a bit.

kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Zoning Functions

#6 Post by kanta » Thu Jun 23, 2011 4:50 am

Thank you, these all look very useful and I hope to use them soon. I've been working a lot lately with no time for the game. :x
Scout/Knight/Rogue 70/66/66

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Teleporter Functions

#7 Post by MiesterMan » Sat Jul 02, 2011 2:16 am

Changes, changes, changes... Ok, so first the obvious. The name of the UF has been changed to Teleporter to reflect what I use it most for. Still works for zoning but isTeleport is pretty much the core of everything.

getServer()
I got curious when seeing in some other threads about how they were using romscripts to get the server name. I thought this was a waste so I found the pointer to the value and the offset and made some functions to get the info. It's been added to this UF as I didn't know where else to put it.

isTeleport()
A whole bunch of things have changed in the isTeleport function that ultimately have improved the functionality. First, the rests have been replaced by waitForLoadingScreen's as there was an issue that if the loading screen appeared the function would complete the check that it hadn't gone to the right place then it would find a teleporter right after the loading screen vanished (with the same name as the one it just used) and teleport somewhere else. So the function now covers both sides, too fast and too slow.

There was another issue, I'm not sure how it came about, where the currentwaypoint index leaped forward! It seems somehow, the __WPL.CurrentWaypoint is now advanced before code in the waypoint is executed. This actually just reduces the code I need in the function so I'm happy with it but still it threw me for a loop.

These are compounded changes over days so again I think there's more but I can't remember. If I do I'll add it to the list.

Happy teleporting :D

kanta
Posts: 424
Joined: Thu Nov 11, 2010 4:08 pm

Re: Teleporter Functions

#8 Post by kanta » Sat Jul 02, 2011 11:23 am

Awesome work.
Scout/Knight/Rogue 70/66/66

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Teleporter Functions

#9 Post by lalaxy » Mon Jul 04, 2011 6:49 pm

Seems to be nice!

And mybe i can use it at my problem...My main char can solo wa1 and i can farm memos...But i can bring 1-2 assist chars who looting too for memos....then not only 4, 12 meme in one round...Assist chars are ready...They following me, and looting now...BUT...When they following me , they usually stops before portal, cause of distance with the main, he porting , and assist stop following, so hes staying inside the instance...Only the main get out. In rare case assist follow me close, then he get out too...Any idea how can assist(s) get out in all case ?
Ive thought about "when he stops following, 1-2 more steps, or anything...
Any usable idea ? ;)

Many thx :roll:

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Teleporter Functions

#10 Post by MiesterMan » Mon Jul 04, 2011 8:32 pm

Add this to the waypoint before exiting the dungeon replacing <X> and <Z> with the coords of your waypoint outside of the dungeon:

Code: Select all

		repeat
			keyboardPress(key.VK_W); 
			player:update();
		until 200 > distance(player.X,player.Z,<X>,<Z>);
		waitForLoadingScreen(5);
I did mean to make this a function but it doesn't seem clean enough to me.
If something happens and you turn around, add a direction fixing function before the keyboadPress. I forget what that is, should be in the wiki.

Edit: Something I've thought about but never checked is if the portals are objects that appear in the objects list. If so that can be used as a moveto reference. I'll have to test it some time.

lalaxy
Posts: 46
Joined: Sun Jul 03, 2011 8:21 pm

Re: Teleporter Functions

#11 Post by lalaxy » Mon Jul 04, 2011 9:21 pm

It would be good and will be closer to the solution...But only problem is that this waypont file dont have fix waypoints...It have command to continously follow the leader and loot if can be loot...So i cannot add it into... Or i can ?

Many thx :)

User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Teleporter Functions

#12 Post by botje » Wed Jul 13, 2011 4:45 pm

so... how would i use this, to lets say, go intoo KS, and make sure im in before moving on?

Botje

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Teleporter Functions

#13 Post by MiesterMan » Wed Jul 13, 2011 10:12 pm

I never finished putting it into a function because it is an imperfect science atm. But, if it helps, here is what I use to enter Forsaken Abbey:

Code: Select all

		<!-- Make sure you are in party and set to Normal mode  -->
		repeat
			keyboardPress(key.VK_W); 
			player:update();
		until 200 > distance(player.X,player.Z,1221,2909);
		waitForLoadingScreen(5);
		loadPaths("Dungeon/ForsakenAbbey_Instance");
Change the coords in the distance() call to the X and Z coords of your first waypoint inside the dungeon.

WARNING: ATM if you bot overruns the last coord and doesn't enter the dungeon it will make him run away from the dungeon contunously. You want the coord for this function to be as close to the portal as possible.

I'll add something more finite when I'm able. Still can't log into the game this today. My personal internet should be up early next week.

poioip
Posts: 18
Joined: Tue Jul 12, 2011 8:14 pm

Re: Teleporter Functions

#14 Post by poioip » Sat Sep 17, 2011 9:42 pm

can you plz explain the teleporting function with harvesting with x-coordinate,y-coordinate,z-coordinate please :cry: :cry: :cry:
Yesterday never lives...
Today never goes...
Tomorrow never comes...


bot auto attack with manual target(feb 3 2012): http://www.solarstrike.net/phpBB3/viewt ... =21&t=3489

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Teleporter Functions

#15 Post by MiesterMan » Sun Sep 18, 2011 12:47 am

These are functions to streamline using the teleporter. If you're looking for a teleport function (speed hack like thing) then you'll want to look at "Rock5's version of teleport" at:
http://www.solarstrike.net/phpBB3/viewt ... =27&t=2721

Hope that helps...

C3PO
Posts: 109
Joined: Sun Jul 10, 2011 2:45 pm

Re: Teleporter Functions

#16 Post by C3PO » Wed Mar 06, 2013 11:31 am

Hello,

I adapted your code to work with the actual version and maybe you want to provide an update for the community, but first GREAT WORK!!!

Code: Select all

function getZoneID()
	charZoneID = RoMScript("GetZoneID()"); 
	return charZoneID;
end
the Runes of Magic function GetZoneID() provides the correct zone, without need to update memory addresses after patch days

Code: Select all

function visitHouseLeave(_zoneID)
	if DEBUGUFZ then printf("DEBUG:  Zone ID - %s\n",tostring(_zoneID)); end;

	if not _zoneID then _zoneID = "any";end;
	repeat
		player:target_NPC(101758); --"Housekeeper"
		RoMScript("ChoiceListDialogOption(0);");
		waitForLoadingScreen(5);
	until checkZone(_zoneID);
	player:update();
end
the NPC_ID is "better" than the english name.
ChoiceListDialogOption works yours didn't anymore

The same or equivalent I did for

Code: Select all

function houseLeave(_zoneID)
function guildCastleEnter()

C3PO
Posts: 109
Joined: Sun Jul 10, 2011 2:45 pm

Re: Teleporter Functions

#17 Post by C3PO » Wed Mar 06, 2013 11:35 am

and for VisitHouseEnter I found another solution

Code: Select all

...
player:target_NPC(housemaid);
RoMScript('ChoiceOption(4);Houses_VisitHouseRequest("'.. _housename .. '","' .. housepass .. '");')
...

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Teleporter Functions

#18 Post by rock5 » Wed Mar 06, 2013 12:16 pm

C3PO wrote:the Runes of Magic function GetZoneID() provides the correct zone, without need to update memory addresses after patch days
No it doesn't. It includes the channel. You still need to separate them.
  • 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.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

C3PO
Posts: 109
Joined: Sun Jul 10, 2011 2:45 pm

Re: Teleporter Functions

#19 Post by C3PO » Wed Mar 06, 2013 1:54 pm

so what is your suggestion Rock?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Teleporter Functions

#20 Post by rock5 » Wed Mar 06, 2013 2:41 pm

Well getZoneId is updated with the bot so I don't see any reason to not use that. Or if you insists on using the in-game function just copy the code from getZoneId to separate the zone.

Code: Select all

local zone = zonechannel%1000
  • 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.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests