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.
- 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.
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)
endNPCTeleport(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.
- 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.
- 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.
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".
Code: Select all
NPCTeleport("Lieve", "Central Plaza", "somewhere else")