Effect modifier: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
Created page with '{{ #vardefine:name|effect_modifier}}{{ #vardefine:return_type|effect}}{{ FunctionPage| name={{#var:name}}| function_category=Modifier Functions| function1={{Function| name={{#v…'
 
imported>Fredg1
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Modifier Functions|


function1={{Function|
function1={{Function|
Line 24: Line 23:
parameter2={{Param|string|modifier_name}}|
parameter2={{Param|string|modifier_name}}|
}}|
}}|
function_description=Returns an effect if {{pspan|check_me}} is effect specific. {{pspan|modifier_name}} is the modifier to check for.|
function_description=Returns an effect if {{pspan|check_me}} is effect specific. {{pspan|modifier_name}} is the <b>[[modifiers|modifier]]</b> to check for.|


code1={{CodeSample|
code1={{CodeSample|
Line 36: 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>}}|
Line 41: Line 47:
more_info= See [http://kolmafia.us/showthread.php?802 this thread] for details.|
more_info= See [http://kolmafia.us/showthread.php?802 this thread] for details.|
}}
}}
{{SeeAlso|boolean_modifier|numeric_modifier|string_modifier}}
[[Category:Modifier Functions]]

Latest revision as of 21:19, 1 July 2020

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.


See Also

boolean_modifier() | numeric_modifier() | string_modifier()