Page 1 of 8

Rock5's travelTo userfunction

Posted: Tue Jun 11, 2013 11:45 am
by rock5
Description:
  • This is my 'travelTo' userfunction, inspired by noobbotters worldtraveler userfunction. Thanks Noobbotter and everyone else who contributed to it.

    This function takes you from any of the defined nodes (typically teleporter npcs) to any other node automatically, taking the shortest route.
Syntax:
    • travelTo("nodename[, returnBool]")
    Where "nodename" is one of the defined node names that you wish to travel to. Eg. And where returnBool is an optional argument that, when true, returns false instead of an error when the function fails. So the user can take action to recover. Eg.
    • Code: Select all

      if travelTo("VaranasCentral", true) == false then
          -- Take recovery steps.
      end
    Here is a list of the currently defined node names. They vary slightly from 'worldtraveler'.
    • [tr][td]Node Name[/td][td]Location[/td][/tr] [tr][td]-------------[/td][td]----------[/td][/tr] [tr][td]-- TELEPORTERS[/td][/tr] [tr][td]AbandonedFortress[/td][td]Abandoned Fortress[/td][/tr] [tr][td]AyrenCaravan[/td][td]Ayren Caravan[/td][/tr] [tr][td]BattleSquare[/td][td]Obsidian Stronghold Battle Square.[/td][/tr] [tr][td]Boulderwind[/td][td]Boulderwind Village[/td][/tr] [tr][td]Chrysalia[/td][td]Chrysalia[/td][/tr] [tr][td]CraftingSquare[/td][td]Obsidian Stronghold Crafting Square.[/td][/tr] [tr][td]Dalanis[/td][td]Dalanis Snoop[/td][/tr] [tr][td]DalanisObsidianEnvoy[/td][td]Dalanis Envoy[/td][/tr] [tr][td]DesertInvestigation[/td][td]Desert Investigation Post[/td][/tr] [tr][td]Dimarka[/td][td]Dimarka[/td][/tr] [tr][td]FangersMakeshift[/td][td]Fangers Makeshift Camp[/td][/tr] [tr][td]Fireboot[/td][td]Fireboot Fortress[/td][/tr] [tr][td]Frontline[/td][td]Frontline Camp[/td][/tr] [tr][td]GlorySquare[/td][td]Obsidian Stronghold Glory Square.[/td][/tr] [tr][td]GreenTower[/td][td]Green Tower[/td][/tr] [tr][td]HarfTradingPost[/td][td]Harf Trading Post[/td][/tr] [tr][td]Haven[/td][td]Haven of Departure[/td][/tr] [tr][td]Heffner[/td][td]Heffner Camp[/td][/tr] [tr][td]Hortek[/td][td]Jungle of Hortek[/td][/tr] [tr][td]Jinners[/td][td]Jinners Camp[/td][/tr] [tr][td]Kampel[/td][td]Kampel Town[/td][/tr] [tr][td]Kashaylan[/td][td]Kashaylan[/td][/tr] [tr][td]Limon[/td][td]Kingdom of Limon[/td][/tr] [tr][td]Logar[/td][td]Logar[/td][/tr] [tr][td]Lyk[/td][td]Lyk[/td][/tr] [tr][td]Lyonsyde[/td][td]Lyonsyde Tribe[/td][/tr] [tr][td]MercenarySquare[/td][td]Obsidian Stronghold Mercenary Square.[/td][/tr] [tr][td]NorthernJanost[/td][td]Northern Janost Forest[/td][/tr] [tr][td]Obsidian[/td][td]Obsidian Stronghold Snoop[/td][/tr] [tr][td]ObsidianCastle[/td][td]Obsidian Stronghold Guild Castle[/td][/tr] [tr][td]ObsidianDalanisEnvoy[/td][td]Obsidian Stronghold Envoy[/td][/tr] [tr][td]Reifort[/td][td]Reifort Camp[/td][/tr] [tr][td]Rorazan[/td][td]Ancient Kingdom of Rorazan[/td][/tr] [tr][td]RuinsResearch[/td][td]Ruins Research Camp[/td][/tr] [tr][td]Salioca[/td][td]Salioca Basin[/td][/tr] [tr][td]Silverfall[/td][td]Silverfall[/td][/tr] [tr][td]SouthernJanost[/td][td]Southern Janost Forest[/td][/tr] [tr][td]Sarlo[/td][td]Sarlo[/td][/tr] [tr][td]Syrbal[/td][td]Syrbal Pass[/td][/tr] [tr][td]TergothenBay[/td][td]Torag Caravan[/td][/tr] [tr][td]TradeSquare[/td][td]Obsidian Stronghold Trade Square.[/td][/tr] [tr][td]Tundra[/td][td]Merdhin Tundra[/td][/tr] [tr][td]Varanas[/td][td]Varanas Snoop[/td][/tr] [tr][td]VaranasBridge[/td][td]Varanas Gates[/td][/tr] [tr][td]VaranasCastleEast[/td][td]Varanas East Guild Castle[/td][/tr] [tr][td]VaranasCastleWest[/td][td]Varanas West Guild Castle[/td][/tr] [tr][td]VaranasCentral[/td][td]Varanas Central Plaza[/td][/tr] [tr][td]VaranasClassHall[/td][td]Varanas Class Hall[/td][/tr] [tr][td]VaranasEast[/td][td]Varanas Lower City East[/td][/tr] [tr][td]VaranasGuildHall[/td][td]Varanas Guild Hall[/td][/tr] [tr][td]VaranasWest[/td][td]Varanas Lower City West[/td][/tr] [tr][td]VaranasWisdom[/td][td]Varanas Hall of the Eye of Wisdom[/td][/tr] [tr][td]WailingFjord[/td][td]Wailing Fjord[/td][/tr] [tr][td]Yrvandis[/td][td]Yrvandis Hollows[/td][/tr] [tr][td]-[/td][/tr] [tr][td]-- HOUSEMAIDS[/td][/tr] [tr][td]HarfTradingPostHousemaid[/td][td]Harf Trading Post Housemaid[/td][/tr] [tr][td]HeffnerHousemaid[/td][td]Heffner Housemaid[/td][/tr] [tr][td]LogarHousemaid[/td][td]Logar Housemaid[/td][/tr] [tr][td]ObsidianNorthHousemaid[/td][td]Obsidian Stronghold Housemaid[/td][/tr] [tr][td]TundraHousemaid[/td][td]Merdhin Tundra Housemaid[/td][/tr] [tr][td]WailingFjordHousemaid[/td][td]Wailing Fjord Housemaid[/td][/tr] [tr][td]-[/td][/tr] [tr][td]-- OTHERS[/td][/tr] [tr][td]Butterflies[/td][td]Butterflies Daily Npc[/td][/tr] [tr][td]DemostrationBattle[/td][td]Demonstration Battle[/td][/tr] [tr][td]DoD[/td][td]Dungeon of Dalanis[/td][/tr] [tr][td]GoblinMines[/td][td]Goblin Mines[/td][/tr]
Features:
  • Uses an algorithm to find the shortest path to the destination.
  • Knows if major hubs have been visited so can avoid unvisited nodes. So it wont try to go to Dalanis via Rorazan if you haven't visited Rorazan, for example.
  • If Recall isn't on cooldown it can use a transport skill, if it needs to, to get to the destination. This includes if you are not near a node point.
  • Knows about automatically available links such as Reifort to Ayren, so can find paths to destinations you haven't visited. For example, if you have a new character that has the Reifort Transport skill, it could still find a path to Dalanis, even if you haven't unlocked Obsidian yet.
  • Designed to be easily maintained. In most cases all you have to do is add an entry in the 'nodeList' and 'optionString'.
Hope you enjoy it.

Re: Rock5's travelTo userfunction

Posted: Tue Jun 11, 2013 3:18 pm
by BillDoorNZ
nice work (as always) rock ;)

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 1:57 am
by dx876234
For us still stuck with "old" micromacro this doesnt work, among other things u use the bit32 which is a Lua 5.2 feature.

-dx

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 2:19 am
by dx876234
For 5.1 users I found a backport http://smbolton.com/lua/lbitlib-5.2.0-alpha-backport1.c, I've made an .dll of it and tested and it works flawlessly.

-dx

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 2:31 am
by rock5
Well if you are using an old MM and old bot on an old client then you should use an old worldtraveler userfunction. Getting this version to work with an old client is probably not a good idea as a lot of the links have changed.

My logic was- "The links are updated for 6.0.0. If you are using 6.0.0 then you are using the latest bot. If you are using the latest bot then you should be using the latest MM.".

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 2:57 am
by dx876234
Lol I normally agree but having issues w. compiling addons for Lua 5.2 like SQL interface, so until thats done Im stuck backlevel.

-dx

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 4:03 am
by rock5
Well it at least you have the skill to easily modify it to work with your setup.

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 7:19 am
by artosaari
Thx a lot for this usefunction, everything works fine for me except for teleporting in Varanas. I get this error
2:14pm - ...ro/scripts/rom/userfunctions/userfunction_gotoportal.lua:130: attemp
t to concatenate local '_dest' (a nil value)

I am running MM1.3 with bot rev 758 and of course I got your gotoportal userfunction.

thx so far

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 7:23 am
by rock5
artosaari wrote:everything works fine for me except for teleporting in Varanas
Teleporting from where, to where?

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 7:26 am
by artosaari
Varanas Bridge to Varanas Central

I've just tried the other Varanas portmaids, works fine, it's just the Bridge porter who causes problems.

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 8:17 am
by rock5
artosaari wrote:I've just tried the other Varanas portmaids, works fine, it's just the Bridge porter who causes problems.
That's because I added custom functions for VaranasBridge, to add the pre option "I want to go to somewhere else", for newby characters and I didn't use the right strings for my travel function properly.

All fixed. I also added a better error message if the wrong strings are used again. That error message wasn't very helpful.

Now at beta 2.

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 10:25 am
by Buster99
Using MM 1.03 and latest Revision 758 and beta 2 version of userfunction but getting errors...here is error from Frontline trying to go Silverfall:

"...userfunction_travelTo.lua:287: Invalid string option name: Heffner nil"

I have tried going from Silverfall to VaranasCentral and get similar error:

"...userfunction_travelTo.lua:287: Invalid string option name: Varanas nil"

Ideas?

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 10:42 am
by rock5
Sorry, misspelt a variable with that new error message I just added.

Now beta 3.

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 10:52 am
by rock5
I just thought I should say why I release things with errors.

The way I see it, I could spend a lot of time testing and making sure code is perfect before releasing it but then I'd probably eventually get fed up with the bot and leave. Or I could do what I love best, programming, and let you guys do the testing. It's also easier to test and find bugs if a lot of people use the code during normal usage than it is for me to try and do everything that all the users do.

Just thought I'd put that out there so in the future so you'll why I put thing out with such blatant errors. :)

Cheers.

Re: Rock5's travelTo userfunction

Posted: Wed Jun 12, 2013 11:06 am
by Buster99
Understood and agree. Don't mind being a tester at all. Your work is MUCH appreciated!

Re: Rock5's travelTo userfunction

Posted: Thu Jun 13, 2013 12:31 am
by lisa
rock5 wrote:I just thought I should say why I release things with errors.

The way I see it, I could spend a lot of time testing and making sure code is perfect before releasing it but then I'd probably eventually get fed up with the bot and leave. Or I could do what I love best, programming, and let you guys do the testing. It's also easier to test and find bugs if a lot of people use the code during normal usage than it is for me to try and do everything that all the users do.

Just thought I'd put that out there so in the future so you'll why I put thing out with such blatant errors. :)

Cheers.
Couldn't agree more, generally takes me 10-15 mins to write up some new code and 2-3 hours of testing to make sure it hasn't broken anything else.

I'm thinking of making that quote my new signature ;)

Re: Rock5's travelTo userfunction

Posted: Thu Jun 13, 2013 2:18 am
by rock5
Oooh. Wow. :oops:

Re: Rock5's travelTo userfunction

Posted: Sat Jun 15, 2013 1:58 pm
by kenzu38
Nice, been looking forward to this.

Thanks a lot!

Re: Rock5's travelTo userfunction

Posted: Thu Aug 22, 2013 4:50 pm
by turbobay
Thanks for this nice userfunction.
I tried it today as it seems very handy, but i get stuck once i rech my destination.
Im my case i go to "Haven" and want to continue with next waypoint, but nothing happens.
The bot does not end, nor does it continue with my waypoints.

Code: Select all

<!-- # 63 --><waypoint x="5313" z="-3936" y="60">	</waypoint>
<!-- # 64 --><waypoint x="5284" z="-3907" y="60">	
travelTo("Haven")
<!-- waitForLoadingScreen() -->
</waypoint>
<!-- # 65 --><waypoint x="28502" z="3465" y="295">	</waypoint>
<!-- # 66 --><waypoint x="28462" z="3743" y="251">	</waypoint>

Code: Select all

Wir gehen zum Wegpunkt #63, (5313, -3936)
Wir gehen zum Wegpunkt #64, (5284, -3907)
Teleporting to "Ich m├Âchte zu den Toren von Varanas." via npc Lyeve
Wir versuchen den NPC Lyeve zu finden:
Der NPC 'Lyeve' wurde erfolgreich ausgewählt. Wir öffnen das Dialogfenster.
Moving to Varanas Snoop
Teleporting to "Hafen des Aufbruchs" via npc Sturobold
Wir versuchen den NPC Sturobold zu finden:
Der NPC 'Sturobold' wurde erfolgreich ausgewählt. Wir öffnen das Dialogfenster.
You have reached your destination
Is there anything missing from my part ?

edit: When i manually teleport back to Varanas, the bot just tries to move to the next waypoint....although it is on a different continent, so any idea why it gets stuck ?

Re: Rock5's travelTo userfunction

Posted: Fri Aug 23, 2013 2:00 am
by rock5
You seem to have worked out your first problem. You shouldn't use waitForLoadingScreen().

The output shows that it correctly reached the destination. If you are having a different problem with the Varanas snoop then please provide the output for that problem. I suspect, though, that that character can't teleport to Haven.