Controlling waypoint file sequence from one location
Posted: Sat Jul 18, 2015 1:01 am
I don't think anyone has come up with this idea before but I thought of a super easy way to control the order you go through your waypoint files from one easy location.
The way it works is like this.
Disclaimer: The code is untested and in fact the idea itself is untested, though it should work in theory.
The way it works is like this.
- 1. Set up all your waypoint files to load a variable of the same name as the file itself. The variable name can be anything but it will be easier to manage if you name it the same as the file. So if the waypoint file has my relog code with the "When_Finished" variable, eg. my survivalr5.xml then you would set it like so
Where you just load another file using loadPaths, for instance in your own mydaily1.xml file, you would use
Code: Select all
When_Finished = survivalr5
Note the absence of any quotes. These are variable not strings.Code: Select all
loadPaths(mydaily1)
Note: Optionally if you want to maintain the original sequence when not using my method then you can follow the variable with "or originalOption". Eg. If you originally follow survival with the AT minigame then, in survivalr5 you would changetoCode: Select all
When_Finished = "at"
That means when you are not using my method then the variable survivalr5 will be nil so it will load AT as it did before.Code: Select all
When_Finished = survivalr5 or "at"
2. Once you have all of them set up, create a starting waypoint file where we will set up the sequence, lets call it starter.xml. At it's most simplest form it would look like thisIn this example, after settings the variables it loads the daily waypoint file "daily1". At the end of the daily it has loadpaths(daily1). daily1 holds the file name survivalr5 so it is actually loading survivalr5. At the end of survival it loads AT, at the end of AT it loads "cleanbags" which might be a waypoint file that just chears the inventory maybe by mailing, selling and deleteing stuff. Cleanbags then loads survivalnext which is a file I created to change character in a separate file, then lastly it loads the first file again after changing character to repeat the chain again. So just to be clear how it works, daily1 = "survivalr5" means that survivalr5 will be loaded after daily1.Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints> <onLoad> daily1 = "survivalr5" survivalr5 = "at" at = "cleanbags" cleanbags = "survivalnext" survivalnext = "daily1" loadPaths("daily1") </onLoad> </waypoints>
This example loads the starter waypoint file only once to set the variables then loops through the files until finished. But this file can be as complex as you like. Lets say you want your main characters to do a different sequence of files than your alts. Here is a more slightly complex starter fileIn this example notice we end the sequence by coming back to the starter file. This is so we can choose which sequence to use for each character.Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints> <onLoad> player:update() if player.Name == "main1" or player.Name == "main2" or player.Name == "main3" then -- Sequence for main character harddaily = "survivalr5" survivalr5 = "at" at = "cleanbags" cleanbags = "survivalnext" survivalnext = "starter" loadPaths("harddaily") else -- Sequence for alternates easydaily = "survivalr5" survivalr5 = "at" at = "goblins" goblins = "cleanbags" cleanbags = "survivalnext" survivalnext = "starter" loadPaths("easydaily") end </onLoad> </waypoints>
Disclaimer: The code is untested and in fact the idea itself is untested, though it should work in theory.