desc_item.php from $item?

Sandiman

Member
I'd like to access the description page (desc_item.php) for a given ASH $item using visit_url. Is there an existing function that will get the KoL item number out of an ASH $item, or should I manually parse through the itemdescs.txt data file?

I've tried doing a simple to_int(item), but that understandably returns KoLMafia's item number rather than KoL's item number.
 
Last edited:

Spiny

Member
I'm pretty sure that $item() works via item name or the item ID# which is shared between mafia and KoL. The description ID is what you're after and that is indeed referenced in the itemdescs.txt file, but I'm not sure how to gain access to that number in a simple function.

KoL has a chat command /examine that brings up the item description, but I am not seeing a similar command within Mafia. I know you can right click the item in question within Mafia's interface, but I'm not sure what CLI command or ASH command you could use for the same purpose.

-Spiny
 

jasonharper

Developer
You would need to read itemdescs.txt into a map, and use that to convert the item ID into a description ID. Fortunately, the fields you need are the first two on each line, so you can use a int[int] map, and ignore the rest of the fields.

Proof-of-concept: here's an alias that will give you a "desc" command that shows the description text of an item in the CLI.
Code:
alias desc => ash int[int] m; file_to_map("itemdescs.txt", m); cli_execute("text desc_item.php?whichitem=" + m[$item[%%].to_int()])
 
Top