Getting Effects from Potions

Donavin69

Member
How do I pull the information from the DB as to the effect that a potion gives? ("Connery's Elixir of Audacity" gives "Cock of the Walk"), the true goal is to know that "Connery's Elixir of Audacity" gives +200% moxie, but I can get that from the effect modifier.
 

Theraze

Active member
> ashq string [string] modbits; file_to_map("modifiers.txt", modbits);foreach i,x in modbits if (to_item(i) == $item[elix auda]) print_html(numeric_modifier(to_effect(split_string(x,"\"")[1]),"Moxie Percent"));

200.0

Or if you just want the effect for a specific item...
> ashq string [string] modbits; file_to_map("modifiers.txt", modbits);foreach i,x in modbits if (to_item(i) == $item[elix auda]) print_html(to_effect(split_string(x,"\"")[1]));

Cock of the Walk
 

slyz

Developer
THanks Hee^3. I was trying to figure out what effect_modifier() (and string modifiers in general) did exactly. I missed the "Effect" modifier.
 

nworbetan

Member
Or just
Code:
ash effect_modifier($item[Connery], "effect")

Oh nice. A couple months ago I was pretty happy that I had figured out how to regex the sources out of $effect[name].all but using modifiers is way easier.

Code:
ash numeric_modifier(string_modifier($item[Connery], "effect"), "moxie percent")
 

Donavin69

Member
Thanks!, I was fumbling around with the modifiers, but couldn't figure out how to parse it properly, that is exactly what I needed!

It appears that the list of items that I am able to get includes only potions (which is what I wanted) but my question is 'why?' Shouldn't other consumables show up in the same list? (Like queen cookies)
 

Theraze

Active member
Check modifiers.txt and you'll see that the Queen Cookie isn't actually included as providing any modifiers...

Edit: As slyz noted above. But if it's been added to the notes, you can see it that way... though parsing it might be fun.
> ash $item[queen cookie].notes

Returned: 30 Towering Strength, Mitre Cut, Knightlife, The Royal We
 
Last edited:
Top