Is there a script command to check an item's enchantments?

Is there a script command to check an item's enchantments? For instance, given $item[The Necbromancer's Shorts], can I somehow ask "does this item increase booze drops?" (Yes.)

I'm not looking for an infinitely-flexible set of questions to ask - even a string output of enchantments would work fine; I can parse them manually.

Bonus points if there's also a way to ask this question about effects.
 

Bale

Minion
Yes. numeric_modifier() and string_modifier(). They work like this:

Code:
> ash string_modifier( $item[The Necbromancer's Shorts], "Evaluated Modifiers" )

Returned: Cold Resistance: +3, Sleaze Resistance: +3, Booze Drop: +30, Familiar Effect: "atk, 2xGhuol"

> ash numeric_modifier( $item[The Necbromancer's Shorts], "Booze Drop" )

Returned: 30.0

> ash string_modifier( $effect[Helping Comes Second], "Evaluated Modifiers" )

Returned: Meat Drop: +20, Food Drop: +25, Booze Drop: +25, Candy Drop: +25

> ash numeric_modifier( $effect[Helping Comes Second], "Meat Drop" )

Returned: 20.0

There are other ways to use those commands, but this fits your needs. string_modifier() is good for seeing all enchantments on an item or effect. number_modifier() can give you the value of a specific enchantment. If that enchantment doesn't exist on the item or effect, then the value will be 0.
 
Last edited:

Bale

Minion
Perhaps you're trying to do something like this?

Code:
> ashq foreach it in $items[] if(numeric_modifier( it, "Booze Drop" ) > 0) print(it)

rum barrel charrrm bracelet
'WILL WORK FOR BOOZE' sign
straw hat
KoL Con Six Pack
Seven Loco
Loathing Legion corkscrew
The Necbromancer's Shorts
jam band
Drapes-You-Regally
ghost accordion
flask flops
tiny die-cast middle-management elf
tiny die-cast Uncle Hobo
warbear dress helmet
sommelier's towel
tarnished tastevin
kiwi beak
Size XI Wizard's Robe
garbage sticker
biker's hat
norwhal helmet

> ashq foreach ef in $effects[] if(numeric_modifier( ef, "Booze Drop" ) > 0) print(ef)

Brother Smothers's Blessing
Video... Games?
Helping Comes Second
Human-Pirate Hybrid
Infernal Thirst
Empty Inside
Insatiable Hunger
Nearly All-Natural
Gaze of the Gazelle
Beer Barrel Polka
 

Bale

Minion
Bonus lesson! Here's the difference between checking "Modifiers" and "Evaluated Modifiers" for the string_modifier() command.

Code:
> ash string_modifier( $effect[Merry Smithsness], "Modifiers" )

Returned: Smithsness: +25, Muscle Percent: [K], Mysticality Percent: [K], Moxie Percent: [K]

> ash string_modifier( $effect[Merry Smithsness], "Evaluated Modifiers" )

Returned: Smithsness: +25, Muscle Percent: +25, Mysticality Percent: +25, Moxie Percent: +25

If the modifier is a formula, you can choose "Modifiers" to check the raw formula. I almost always want to use "Evaluated Modifiers" but sometimes it is good to know that there is a variable element involved.
 
Top