Effect modifier: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Bale
add another example
Line 35: Line 35:
   if(eff != $effect[none])
   if(eff != $effect[none])
       print(doodad +" grants "+ eff);
       print(doodad +" grants "+ eff);
}
</syntaxhighlight>}}
{{CodeSample|
description=Return the effect granted by drinking a particular potion.|
code=<syntaxhighlight>
effect potion_to_effect(item potion) }
  return effect_modifier(potion, "effect");
}
}
</syntaxhighlight>}}|
</syntaxhighlight>}}|

Revision as of 06:42, 20 September 2012

Function Syntax

effect effect_modifier(string check_me ,string modifier_name )

effect effect_modifier(item check_me ,string modifier_name )

Returns an effect if check_me is effect specific. modifier_name is the modifier to check for.

Code Sample

Prints a list of all items that have intrinsic effects

effect eff;
foreach doodad in $items[] {
   eff = effect_modifier( doodad , "Intrinsic Effect" );
   if(eff != $effect[none])
      print(doodad +" grants "+ eff);
}

Return the effect granted by drinking a particular potion.

effect potion_to_effect(item potion) }
   return effect_modifier(potion, "effect");
}

More Information

See this thread for details.