KoL High school item summary

Nappa

Member
I got tired of having to manually count my items in a KoLHS run, so I created this relay script.

First it was only a boring summary of items in inventory, but as I was working on it I also made it include the items that can be created.

It's pretty straightforward, it adds a table on the KoLHS page in the seaside town with a summary.

Suggestions for improvements are welcome. I hope you'll find it useful!

Screenshot: (v1.3)
kolhs1.3.png

Update:
I think it's pretty much final, but moved to SVN now and fixed an error that was caused by overriding a lib function.

Find the script here:
Code:
svn checkout https://svn.code.sf.net/p/mafiarelaykolhs/code-0/
 
Last edited:

Bale

Minion
OH THANK YOU!!

You could make this even better if you added the item "cost" for each item so that I would know what item I might want to try to get more of by casting transcendent olfaction.
 

Nappa

Member
I've been thinking about that too but didn't know where to put it in. I could put it in the description but I have the feeling that'd be a bit clunky.
It might be better to go with a somewhat different grid layout then. I'll give it a thought. Since it kinda grew as it came along and i was exploring the technical possibilities, the layout came as an afterthought. But now the specs are more clear so I might be able to come up with something better :).
 
Last edited:

Nappa

Member
I have rewritten the script completely. Behold version 1.1:
kolhs2.png
I have left 2 switches in that I used while I was testing the design. (bold numbers in grid and include item spoilers)

On a side note, out of curiosity, how would one manage multiple relay override scripts that trigger on the same 'page'?
Suppose for example that the artist page was placed on place.php?whichplace=artist (i know it's in town-wrong, but just for this example) and someone wrote a relay script for tattoo management. Obviously you can't place 2 different place.ash'es in the same dir?
 

Attachments

  • place.ash
    12.3 KB · Views: 61

Bale

Minion
That looks MUCH nicer! Thanks!

On a side note, out of curiosity, how would one manage multiple relay override scripts that trigger on the same 'page'?
Suppose for example that the artist page was placed on place.php?whichplace=artist (i know it's in town-wrong, but just for this example) and someone wrote a relay script for tattoo management. Obviously you can't place 2 different place.ash'es in the same dir?

That's a good question with an interesting answer. You would have to take care of all the "place" overrides in the same script. Fortunately you can do this:


Code:
switch(form_field("whichplace")) {
case "artist": 
   artist();
   break;
case "kolhs": 
   kolhs();
   break;
case "mclargehuge":
   mountain();
   break;
}

I might have gotten the whichplace wrong for kolhs, but you fudged the page for the artist so we're even. At least I know mclargehuge is correct. Hopefully you get the idea.
 

Theraze

Active member
The other 'place' script I had was for marking the Bugbear ship doors. However, as I'm unlikely to run bugbear for fun anymore, and it had some of those delightful string || string checks, I'm happy to replace it with a KOLHS script for now. :)
 

fronobulax

Developer
Staff member
Would you consider changing the title of things that can be made to include the number of that item already available? That would help me figure out what I wanted/needed to make.

Thank you.
 

Nappa

Member
I considered adding this feature but the items were not known yet in mafia when i wrote this, so I left it out.
It's actually not too difficult to code in, provided that the items have been added to mafia in the meantime. I'll see what I can do.

//Edit:
$item[ yellowcake bomb ] and $item[ quasireligious sculpture ] are still 'Bad item value's according to mafia (r12554). Once those are added I can roll out a version containing proper counts of how many you already have.
 
Last edited:

Theraze

Active member
Have their infos been reported yet somewhere as new content? After stuff gets reported with enough information to actually add it, it's much more likely to be in...
 

Darzil

Developer
Bale has now added it in the thread for High School, and I've done a patch for it, I'm sure someone will be awake and willing to add it in soonish.
 

fronobulax

Developer
Staff member
Thanks. r12564 got the missing items, so a new version is here. (attached to the OP)

Worked. Very helpful. Thanks for the update.

(Now to see whether there is a new content request out there for KoLmafia to update the inventory when items are created in KOLHS and make it if not).
 

Winterbay

Active member
This script currently fails due to using an overloaded version of the built-in function min(int, int). I just deleted the defined function because from what I can see it does the same as the built-in version so... why did you have your own?
 

Nappa

Member
Yeah, i noticed that yesterday as well. Havent had time to modify it (i will attach an updated version to the op when i get around to it).

As for the reason: cluelessness. I dont know exactly what functions i have at my command when writing ash scripts. So when I needed a min function, I probably just thought 'let's make one' instead of just trying it and sseing if it was there or not.
 

Winterbay

Active member
For future reference you can use ashref in the CLI to test if a function exits or not (it fuzzy matches to all parts so you can do ashref monster to find all functions that uses monster anywhere).
 

Nappa

Member
Thanks for the info. I hAven't done much scripting in Mafia so ignorance is right around the corner.

I'm thinking of migrating it to svn as well but i still have to install svn for that. I assume everything I need to know is in the support SVN thread? (anyhow i suppose its more or less comparable to git, which I have some experience with)
 

Nappa

Member
Yeah, I was working with that. I just finished adding it to sf minutes ago :).
If it worked, you can use:
Code:
svn checkout https://svn.code.sf.net/p/mafiarelaykolhs/code-0/
 
Top