Page 1 of 1

Waypoint Renumbering

Posted: Sat Oct 08, 2011 6:08 pm
by Tooney
I know there's an AutoIt script already to do this but I don't use AutoIt so I made a userfunction for renumbering waypoint files.
Usage is Renumber("YourWayPointFile") and it saves a renumbered copy.
I'm sure it could be done better with RegEx but it works on the handful of files I tried.

Feedback welcomed.

Re: Waypoint Renumbering

Posted: Sat Oct 08, 2011 8:40 pm
by rock5
Well done. Nice and neat code.

Re: Waypoint Renumbering

Posted: Sun Oct 09, 2011 1:38 am
by Tooney
Thanks rock. That's high praise indeed coming from you.

Re: Waypoint Renumbering

Posted: Wed Oct 12, 2011 8:20 am
by kanta
Thank you very much for sharing this. Works like a charm.

Re: Waypoint Renumbering

Posted: Wed Oct 12, 2011 3:22 pm
by Tooney
Great. glad I could help.

Re: Waypoint Renumbering

Posted: Wed Nov 09, 2011 7:21 pm
by imaginethat
Hi Tooney
wow, this is awesome, and works perfectly. Really nicely done.

I was not actually sure how you intended for it to be implemented, started, but I added a couple of lines of code to make it standalone, so you could just run "rom\renumber" from the MicroMacro window and it would do the renumbering. This means the game does not need to be running etc.

So I created "Renumber.lua" file, containing your awesome function, and wrapped it in a function main()

You add the name of the file to the main function and then run "rom\renumber" from the MM window and you are good to go.

Thanks Tooney

Re: Waypoint Renumbering

Posted: Wed Nov 09, 2011 10:54 pm
by rock5
Excellent. But you should be able to specify the file name as an argument.

If you look at bot.lua as an example, around line 72, you will see how it uses arguments. If you include it in your file then you could use something like this

Code: Select all

rom\renumber waypointfile.xml

Re: Waypoint Renumbering

Posted: Fri Nov 11, 2011 3:40 am
by Tooney
Thanks for your comments.
I like what you've done. It hadn't occurred to me that people would want it offline. It was intended to be run via RomBot's commandline option.
I also like Rock's idea of adding the file name as an argument.

Cheers,
Tooney.

Re: Waypoint Renumbering

Posted: Fri Dec 09, 2011 8:06 pm
by Rickster
Nice script :)

I added a filename input option in main() so you can start the script without an argument. the script asks for a filename itself, so its easy to make a windows shortcut just starting the script.

Else I extended Renumber() not only to check if filname == nil but also to check if filename == "".
Then I put the whole part for renumbering in an else part, so that there will not be an empty file ("_renumbered") created when filename is nil or empty. So nil should never occure, because at least an empty string is given as an argument when Renumber(filename) is called in main().

Long story short, just place renumber.lua in MM/scripts/rom and make a win shortcut to start:

Code: Select all

.\micromacro\micromacro.exe scripts/rom/renumber.lua
ric

Re: Waypoint Renumbering

Posted: Sat Dec 10, 2011 2:08 am
by Tooney
Nice work Rickster.