Inventory dumping into display case Rewritten!

Majority of post removed during edit :p


*Edit* Nightmist has written a script which does exactly what was needed to allow for using just the item name! http://kolmafia.us/index.php/topic,55.0.html
I am removing the original DisplayIt.ash, and replacing it with one that specifically uses Nightmist's ItemToIntOrString.ash ItemToString.ash

to use this scriptlet, you need to download both this scriptlet and Nightmist's ItemToIntOrString.ash  ItemToString.ash and place them in the same folder, then you only need import DisplayIt.ash.  You also need to follow the instructions given in NightMist's post to repair some typos in KolMafia, hopefully this will be fixed in the next release. fixed use the command "update" via the CLI or GCLI to implement the repair.

If you want a script to display your collection of precious saucepans and disco masks you would write a script like this:

Code:
import <Displayit.ash>;
void main()
{
displayput(item_amount($item[saucepan]), $item[saucepan]);
displayput(item_amount($item[disco mask]), $item[disco mask]);
//avoid repeated calls to refresh inventory by doing it after everything else.
cli_execute("inv refresh");
}

I have also added displaytake(int Quant, item totake) which will take the item from your display case. KolMafia has built in features to tell you how many are already there.

Things to note:

Both displayput, and displaytake now require a quantity I do not know how they will react to using the * wildcard for all. I don't think they will function as expected.

This scriptlet invokes Nightmist's scriptlet which is 2901  1450 lines long! That means this scriptlet will probably be a little slower to execute than others.

When calling these functions repeatedly, you shouldn't refresh your inventory untill all calls to the display case functions are completed. Multiple calls to refresh inventory would just make it run slower, and generate excess un-needed load on KOL's servers.

If arrays are ever implemented into kolmafia, I will rewrite to handle 11 items at a time. That will generate 10 less hits on kol's servers for every 1 hit.

Edit: Nightmist has uploaded a shorter scriptlet which will allow this scriptlet to run faster. This scriplet has been updated.

And Hopefully a final edit: Nightmists ItemTo___ scripts have been replace by built in functionality in KOLMafia. The revisions to this script I believe is only to remove the import command. Not certain though.
[quote author=Nightmist link=topic=55.msg184#msg184 date=1144315015]
It would seem the data override files have been updated, to ease your updating of the data files use the inbuilt "Update" command in the CLI to automatically download the fixed datafiles. (Remember you need to restart mafia for the changes to come into effect)
[/quote]

Just figured I drop that one in this series of messages too.
 

Attachments

  • DisplayIt.ash
    744 bytes · Views: 81
Top