I'll touch on 2 questions:
Randomness:
write a batch file to generate a simple standard script which will create a number of meat paste, and set it into a loop of re-writing the script using a random number.
using the file_exists command in the batch file, and the "mirror filename" followed by just "mirror" in your script to create the file would be the trigger. delete the file in the batch file. Using the call command in your script, it would call the script which would create the meat paste, then a call to item_amount($item[meat Paste]) would give you the random number in kolmafia. Follow that with a call to autosell the meat paste. Uggh, batch files again!
Arrays:
To create an array of constants, you could use a set of functions something like this:
Presto Ragu's Restorer selector crunched down to fit in a smaller file.
Code:
item MPitem(int a)
{
//Adjust the MP items as you see fit. MPitem1 is the "worst" item, while MPitem9 is the "best"
if(a == 1) return $item[soda water];
if(a == 2) return $item[Knob Goblin seltzer];
if(a == 3) return $item[Mountain Stream soda];
if(a == 4) return $item[Dyspepsi-Cola];
if(a == 5) return $item[green pixel potion];
if(a == 6) return $item[tiny house];
if(a == 7) return $item[Knob Goblin Superseltzer];
if(a == 8) return $item[blue pixel potion];
return $item[phonics down];
}
item HPitem(int a)
{
//Adjust the HP items as you see fit. HPitem1 is the "worst" item, while HPitem9 is the "best"
if(a == 1) return $item[Doc Galaktik's Pungent Unguent];
if(a == 2) return $item[Doc Galaktik's Ailment Ointment];
if(a == 3) return $item[Doc Galaktik's Restorative Balm];
if(a == 4) return $item[Doc Galaktik's Homeopathic Elixir];
if(a == 5) return $item[cast];
if(a == 6) return $item[tiny house];
if(a == 7) return $item[red pixel potion];
if(a == 8) return $item[phonics down];
return $item[scroll of drastic healing];
}
item restorer_selecter( string restquant, string resttype)
{
item useitem;
boolean usebest;
boolean useHP;
int count;
count = 2;
//start count at 2,
if(resttype == "hp" || resttype == "Hp" || resttype == "HP")
{
useitem = HPitem(count);
while(count < 10)
{
if(item_amount(HPitem(count)) > 0)
{
if(restquant == "best" || restquant == "Best" || restquant == "BEST")
{
useitem = HPitem(count);
}
else
{
if( item_amount(HPitem(count)) > item_amount(useitem))
{
useitem = HPitem(count);
}
}
}
count = count + 1;
}
}
else
{
useitem = MPitem(1);
while(count < 10)
{
if( item_amount(MPitem(count)) > 0)
{
if(restquant == "best" || restquant == "Best" || restquant == "BEST")
{
useitem = MPitem(count);
}
else
{
if( item_amount( MPitem(count)) > item_amount( useitem))
{
useitem = MPitem(count);
}
}
}
count = count + 1;
}
return useitem;
}
void main()
{
cli_execute( "abort You are silly if you think this can run on its own.");
}
This method could be used with global variables also. That would allow changing the values in the array, but would be more complex to write.