EatDrink main looks like this now:
void main (int foodMax, int drinkMax, int spleenMax, boolean overdrink, boolean sim)
{
SIM_CONSUME = sim;
eatdrink(foodMax, drinkMax, spleenMax, overdrink);
}
Swapping it with
void main(string cmd)
{
startInfo sI = getStartInfo(cmd,false); //Because EatDrink doesn't use commands
SIM_CONSUME = sI.Flags["sim"];
if (sI.Arguments contains 6) //If all 7 args are provided
{
eatdrink(to_int(sI.Arguments[0]), to_int(sI.Arguments[1]), to_int(sI.Arguments[2]), sI.Flags["overdrink"], to_int(sI.Arguments[3]), to_int(sI.Arguments[4]), to_int(sI.Arguments[5]), to_int(sI.Arguments[6]), sI.Flags["sim"]);
} else {
if (sI.Arguments contains 2) //If only 3 of the args are provided
eatdrink(to_int(sI.Arguments[0]), to_int(sI.Arguments[1]), to_int(sI.Arguments[2]), sI.Flags["overdrink"]);
else //When an incorrect number of args are provided
eatdrink (<remaining fullness>, <remaining drunkeness>, <remaining spleen>, sI.Flags["overdrink"]);
}
}
-----------------------------------------------------------------------------------------------------------------------------
Then in the gCLI:
<one time>
alias eatdrink => eatdrink.ash *
eatdrink :: Calls eatdrink to finish filling up.
eatdrink x y z :: Calls eatdrink to eat x fullness y drunkeness, and z spleen
eatdrink x y z a b c d :: calls long ver. of eatdrink
Although this wasn't really meant to update old scripts, it was meant more as a tool for new scripts that didn't want the restrictions of a specific main method signiture so rewiring old scripts to use it may not be pretty.
Also, I *think*, but forgot to check, that a flag that does not appear in the cmd is defaulted to false. I am not 100% sure about this because I didn't put any code to explicitly handle it although i will if it doesn't work that way currently. I also think that I will add another map KeyValuePairs to automatically associate any token with an = in it as a key value pair with the left hand item being the key and the right hand op as the value such that.
eatdrink food=19 drink=4 spleen=8 !overdrink silent
would create an start Info of
.Command=Default
.Arguments[0] = "silent"
.Flags["overdrink"]=false
.KVP["food"]="19"
.KVP["drink"]="4"
.KVP["spleen"]="8"
You could also set it up so that it does use the Command portion so that
eatdrink NightCap :: Could trigger eatdrink with overdrink as true
eatdrink FoodUp :: Could trigger eatdrink to eat as much food as remaining but ignore drink... etc.
I will also change it so that only the first non Kvp and non flag is used as the command so that a script can still get a command of Default even if flags or kvps are sent.