Feature Knob Goblin perfume (item) and Knob Goblin Perfume (effect) are not differentiated

rlbond86

Member
So, this is a bit of a corner case, but executing the code

Code:
> ash string_modifier("Knob Goblin Perfume", "modifiers")

Returned: Effect: "Knob Goblin Perfume", Effect Duration: 1

Will always return the modifier of the item "Knob Goblin perfume", not the effect of the same name. There are a few other items which have the same name for the item and its associated effect. As far as I can tell, the complete list is:

Knob Goblin perfume
The Ballad of Richie Thingfinder
Benetton's Medley of Diversity
Elron's Explosive Etude
Chorale of Companionship
Prelude of Precision
The Spirit of Crimbo
Inigo's Incantation of Inspiration

It would be nice if there was some way to tell the string_modifier command if you are looking for an effect or an item. It's possible to work around this for now, so I am listing it as a feature, but it seems like it would be possible to overload string_modifier to work with item and effect types.
 

Theraze

Active member
Just curious how you're working around it, since:
> ash string_modifier($effect[Knob Goblin Perfume], "modifiers")

Returned: Effect: "Knob Goblin Perfume", Effect Duration: 1

> ash string_modifier($item[Knob Goblin Perfume], "modifiers")

Returned: Effect: "Knob Goblin Perfume", Effect Duration: 1
both telling it that you want an item and an effect return the same results.
 

rlbond86

Member
Just curious how you're working around it, since:both telling it that you want an item and an effect return the same results.

Yes, because both datatypes are being converted to string. I'm working around it with a hack that checks if the effect name is the same as the item name and just not displaying any information about the effect. It's a corner case, certainly, but it stuck me in a nasty infinite loop for my script, because it kept attempting to look up the effect, and then trying to look up that effect, ad nauseum.
 

slyz

Developer
The only ash function is
Code:
string string_modifier( string, string )
so in your examples both $effect[Knob Goblin Perfume] and $item[Knob Goblin Perfume] are implicitly turned into the "Knob Goblin Perfume" string.
 

Theraze

Active member
True... I was wondering if your hack was a code-hack or ASH-hack that might be useful to others. :)

And slyz... I know that, I was just wondering how the differentiating was being done in a workaround way that, well, works. :)
 
Top