Rock5's Teleporter Helper Functions (aka GoToPortal)

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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Rock5's Teleporter Helper Functions (aka GoToPortal)

#1 Post by rock5 » Sun May 27, 2012 7:26 am

Here is the GoToPortal userfunction I created on another post. It's been updated and a couple of extra useful functions added.

GoToPortal(range, portalid)

Simply does what it says. It goes to a portal and enters it. It identifies the portal by the fact that it has no name. It does no other checks. Simply use "GoToPortal()" near the portal to make it enter.

range
  • You can specify the range to search for the portal. Normally not neccessary. Defaults to 150.
portalid
  • Once you know the portals id (it's printed on the MM window when entering the portal) it's a good idea to add it here just to reduce that chance that it might accidentally target another no-name object.
    NEW! If the bot is going to the wrong no name object, because it's closer, you can use a sequence number to target the next closest no name objects. Eg. if you use '2' then it will target the second closest no name object. This way you can just increment the number until you get the portal. When it prints the id, you can change it to the id.
GoThroughPortal(range, portalid)

Does the same as GoToPortal except it checks your location before entering the portal and then checks to see if you succeeded teleporting. So it reliably returns true or false. So you can try entering the portal again if it fails. Here is some code that should work at most portals.

Code: Select all

if not GoThroughPortal() then
    __WPL:setWaypointIndex(__WPL.LastWaypoint - 1)
end
This will try to go through the portal. If it fails it will go to the previous waypoint and approach the portal again to try again.

NPCTeleport(npc, dest, preoption)

This function is an easy way to teleport using any teleporter NPC and like GoThroughPortal, it checks your location to tell if it succeeded. So you could use the returned "true" or "false" value if you like. It targets the NPC (so you do not need to target the NPC beforehand), selects the options and pays any required fees.

npc
  • The name or id of the NPC.
dest
  • The full or partial name of the option that will teleport you to your destination. You can also use the option number but no guarantee is made that it will be the right option.
preoption
  • If you have to select an option before selecting the destination, then put it here. Here is an example I use to go from the teleporter NPC on the bridge at Varanas to the Central Plaza.

    Code: Select all

    NPCTeleport("Lieve", "Central Plaza", "somewhere else")
    If you have no second class it will choose the option "I want to go somewhere else" before selecting "Central plaza". If you have a second class you can choose "Central Plaza" right away. In that case, the preoption will simply fail and it with then select "Central Plaza".
Attachments
userfunction_gotoportal.lua
Version 2.11
- Now it finds closest object when using an Id.
(4.5 KiB) Downloaded 716 times
  • 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

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#2 Post by lisa » Thu Aug 16, 2012 8:16 pm

I finally added this and had a play with it, was looking at usage for party.lua

Something I noticed is that it purely checks for name == "" but there are other objects with no name that arn't portals.

I am sitting at entrance to dod and there are 4.

Id's

Code: Select all

110362
102678
113534 -- portal
110578
inside instance there are 2

Code: Select all

112224 -- portal
110578
It's weird that 110578 is both inside and outside
funnily enough I did
GoThroughPortal(550,110578)
both inside and outside and it went through the portal each time.
Maybe 110578 is the Id for all portals in some way? or atleast for DoD, I'd have to test others.


portal sewers -> dalanis

Code: Select all

110578
112224
110578
111065
111065
portal dalanis -> sewer

Code: Select all

112224
111378
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#3 Post by rock5 » Fri Aug 17, 2012 12:39 am

Yes, there are other objects that don't have names but the idea is you stand next to the portal and hopefully it is the closest because the function goes to the closest. If you went to an id that isn't the portal and it still went through then I can think of 2 reasons why it would. 1. There might be 2 portal ids, one you see and one you go through or 2. there might be an object on the other side of the portal with no name and you went to that. Are you having problems with the function not working?
  • 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

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#4 Post by lisa » Fri Aug 17, 2012 1:06 am

rock5 wrote:Are you having problems with the function not working?
not exactly, I was looking at trying to add in a check for portals nearby and was hoping the id's were within a set range. So if you go through a portal I could implement the party chars to go to a portal. I don't want to just go to nearest object with "" as name, there is an object next to the mouse in sewers and so if you did the gotoportal code after zoning out of DoD it would go to that object and not the portal entrance to DoD.

If I get time I'll do more prints of different portals and maybe get a database/range going, maybe lol
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#5 Post by rock5 » Fri Aug 17, 2012 1:31 am

I've been having a look. It looks like every portal has 2 objects that are very close to each other. Maybe we could use that to identify the portals.

Edit: Spoke too soon. DoD -> Sewer there is only one.
  • 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

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#6 Post by lisa » Fri Aug 17, 2012 1:44 am

I had 2 DoD -> sewer

112224
110578
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#7 Post by rock5 » Fri Aug 17, 2012 2:03 am

lisa wrote:I had 2 DoD -> sewer

112224
110578
Yeah but they are not in the same place. 110578 is down the corridor I think.
  • 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

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#8 Post by lisa » Fri Aug 17, 2012 3:07 am

DoD -> sewer

Code: Select all

112224 1714.4350585938 2886.7900390625
110578 1644.5109863281 2884.4580078125
sewer -> DoD

Code: Select all

110578 1688.9150390625 -5137.7670898438
102678 1686.9100341797 -5154.2221679688
Not exact same coords but I think there is something to it.

I teleported to the coords inside DoD and yeah deffinately past the portal and not the actual portal.
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#9 Post by rock5 » Fri Aug 17, 2012 3:24 am

lisa wrote:DoD -> sewer

Code: Select all

112224 1714.4350585938 2886.7900390625
110578 1644.5109863281 2884.4580078125
For some reason when I plotted these ones, it did it wrong. So they are actually closers than I thought. Still, that's over 50. We would have to check for no name objects closer than 100 to each other.
  • 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

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#10 Post by Ego95 » Fri Aug 17, 2012 3:43 am

Are you having problems with the function not working?
Small thing I can add. I don't get the function working for the Arcane Chamber of Sathkur in sascilia. It's not very important for me, only want to tell you ;)
He enters the instance but gets stuck there. It's like he doesn't notice a zone switch. Maybe it has to do with those id's

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#11 Post by lisa » Fri Aug 17, 2012 3:50 am

AlterEgo95 wrote:He enters the instance but gets stuck there. It's like he doesn't notice a zone switch. Maybe it has to do with those id's
I had this happen to me once while testing it, not sure if it was because I used the Id past the portal though and so it was still trying to move forward and didn't recognize the loadingscreen.
When it happened to me though it did the wait for loading screen time and then recognized the address change and continued on.
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#12 Post by rock5 » Fri Aug 17, 2012 4:41 am

AlterEgo95 wrote:Small thing I can add. I don't get the function working for the Arcane Chamber of Sathkur in sascilia. It's not very important for me, only want to tell you ;)
He enters the instance but gets stuck there. It's like he doesn't notice a zone switch. Maybe it has to do with those id's
Depends how you did it. If you just used GoToPortal with your own waitforloadingscreen and checks then it depends how you did it. If you used GoThroughPortal, it's pretty full proof. I don't see how it could get stuck as there is no closed loop in 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.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#13 Post by Alkaiser » Sun Aug 26, 2012 2:25 pm

Here's a suggestion for adding a small bit of functionality to the GoThroughPortal function.
I needed this for DoD after defeating the last boss. A dialog box pops up and you must confirm your desire to exit before the portal will work.

Code: Select all

function GoThroughPortalDialog(_range,_portalid)
	player:update()
	local playerOldX, playerOldZ = player.X, player.Z

	GoToPortal(_range,_portalid)

	-- Check if you need to accept
	local acceptPortal = RoMScript("StaticPopup_Visible('SET_REQUESTDIALOG')")
	if acceptPortal then
		RoMScript("OnClick_RequestDialogAccept()")
	end
	
	waitForLoadingScreen(20)
	yrest(3000)
	player:update()

	local wp = __WPL.Waypoints[__WPL.LastWayPoint]
	if (wp and distance(wp.X, wp.Z, player.X, player.Z) > 500) or
	   (distance(player.X,player.Z,playerOldX, playerOldZ) > 500) then
		-- Teleport a success
		return true
	else
		return false
	end
end

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#14 Post by rock5 » Sun Aug 26, 2012 2:45 pm

I don't see any reason for a separate function. I could add that check to the GoThroughPortal function. Although I prefer to use

Code: Select all

RoMScript("StaticPopup_EnterPressed("..acceptPortal..");")
To accept the dialog so I know it accepts the right dialog.

Code: Select all

RoMScript("OnClick_RequestDialogAccept()")
Doesn't say which dialog it will answer so I'd worry that if there is more than one dialog open it might accept the wrong one. Maybe you could try it for me before I add the changes.
  • 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

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#15 Post by Alkaiser » Sun Aug 26, 2012 3:14 pm

rock5 wrote:I don't see any reason for a separate function. I could add that check to the GoThroughPortal function. Although I prefer to use

Code: Select all

RoMScript("StaticPopup_EnterPressed("..acceptPortal..");")
To accept the dialog so I know it accepts the right dialog.

Code: Select all

RoMScript("OnClick_RequestDialogAccept()")
Doesn't say which dialog it will answer so I'd worry that if there is more than one dialog open it might accept the wrong one. Maybe you could try it for me before I add the changes.
I tried that at first but it didn't seem to work... it might have been because it didn't wait long enough (or at all) for the dialog box to appear though...

I have updated my the function like this:

Code: Select all

	repeat yrest(500) until RoMScript("StaticPopup_Visible('SET_REQUESTDIALOG')")
	RoMScript("OnClick_RequestDialogAccept()")
I will try RoMScript("StaticPopup_EnterPressed("..acceptPortal..");") instead to verify that it works with this particular dialog box.

UPDATE:

Yes, the RoMScript you use does work with that dialog box. It just needed a short yrest so as not to miss it.

Code: Select all

function GoThroughPortalDialog(_range,_portalid)
	player:update()
	local playerOldX, playerOldZ = player.X, player.Z

	GoToPortal(_range,_portalid)

	repeat yrest(500) acceptPortal = RoMScript("StaticPopup_Visible('SET_REQUESTDIALOG')") until acceptPortal
	RoMScript("StaticPopup_EnterPressed("..acceptPortal..")")
	
	waitForLoadingScreen(20)
	yrest(3000)
	player:update()

	local wp = __WPL.Waypoints[__WPL.LastWayPoint]
	if (wp and distance(wp.X, wp.Z, player.X, player.Z) > 500) or
	   (distance(player.X,player.Z,playerOldX, playerOldZ) > 500) then
		-- Teleport a success
		return true
	else
		return false
	end
end

justAnub
Posts: 14
Joined: Thu Sep 01, 2011 3:30 pm

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#16 Post by justAnub » Sun Sep 09, 2012 8:36 am

i have a small prob with this function the bot doesn't always recognize that a loading-screen appears and just wants to continue, it start buffing while loading or doesn't recognize any skills so its set too melee while character is a mage or shutting down complete because it thinks the game disconnects.
don't comment on my language im not english, just trying to make myself understood.

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#17 Post by rock5 » Sun Sep 09, 2012 9:00 am

justAnub wrote:i have a small prob with this function the bot doesn't always recognize that a loading-screen appears and just wants to continue, it start buffing while loading or doesn't recognize any skills so its set too melee while character is a mage or shutting down complete because it thinks the game disconnects.
For starters which function are you talking about? Sometimes on some servers you need to wait a bit, after waitForLoadingScreen() has returned control, for the game to fully load. RoM4U is like that. I usually add 3 seconds then do a player:update(). Both GoThroughPortal and NPCTeleport do that already.
  • 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

justAnub
Posts: 14
Joined: Thu Sep 01, 2011 3:30 pm

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#18 Post by justAnub » Sun Sep 09, 2012 9:27 am

ok now i see where i messed up, like all thing in life R.T.F.M.
I used GoToPortal(102678), not realizing this one didn't have check's will change to GoThroughPortal() and retest when i return.
Last edited by justAnub on Sun Sep 09, 2012 9:34 am, edited 1 time in total.
don't comment on my language im not english, just trying to make myself understood.

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

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#19 Post by rock5 » Sun Sep 09, 2012 9:30 am

Yeah, GoToPortal (the original function) just does that, goes to the portal. Users would then do there own code for waiting and confirming teleport, etc. Go ThroughPortal is just my version of all that other code which saves users from having to do 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.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: Rock5's Teleporter Helper Functions (aka GoToPortal)

#20 Post by Cindy » Fri Oct 12, 2012 4:59 pm

I don't seem to be able to get the Ailic's Aide guys to cooperate, anyone spot isues in the code? (This gets--or supposed to get--you from snoop in Heffner to quest guy in Xaviera dailies)

Code: Select all

<!-- #  3 --><waypoint x="-6342" z="-3914" y="162">
    NPCTeleport("Snoop the Stubborn", "Lyonsyde Tribe")
	yrest(2000);
	waitForLoadingScreen();
	</waypoint>
	<!-- #  4 --><waypoint x="50" z="-1139" y="137">	
	NPCTeleport("Ailic's Aide", "Desert Investigation Post")
	yrest(2000);
	waitForLoadingScreen();
	NPCTeleport("Ailic's Aide", "Fanger's Makeshift Camp")
	yrest(2000);
	waitForLoadingScreen();
	NPCTeleport("Ailic's Aide", "Ruins Research Camp")
	yrest(2000);
	waitForLoadingScreen();	
	</waypoint>
	<!-- #  5 --><waypoint x="991" z="13377" y="326">	
    NPCTeleport("Snoop the Stubborn", "Jinners Camp")
	yrest(2000);
	waitForLoadingScreen();	
	NPCTeleport("Ailic's Aide", "Frontline Camp")
	yrest(2000);
	waitForLoadingScreen();		
	</waypoint>

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest