String modifier: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
Created page with '{{ #vardefine:name|string_modifier}}{{ #vardefine:return_type|string}}{{ 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 23: Line 22:
parameter2={{Param|string|modifier_name}}|
parameter2={{Param|string|modifier_name}}|
}}|
}}|
function_description=Returns a string modifier.|
function_description=Returns a string modifier. <br /><br />
For a list of fields that this function takes, see [[Modifiers#String_Modifiers|Modifiers]].|


code1={{CodeSample|
code1={{CodeSample|
title=Code Sample|
title=Code Samples|
description=Checks current equipped outfit.|
description=Checks current equipped outfit.|
code=
code=
Line 33: Line 33:
   print("You are equipped to purchase seltzer.");
   print("You are equipped to purchase seltzer.");
else print("The Knob scientists won't let you into their store dressed like that.");
else print("The Knob scientists won't let you into their store dressed like that.");
</syntaxhighlight>}}|
</syntaxhighlight>}}
{{CodeSample|
description=Display all modifiers related to your current moon sign.|
code=
<syntaxhighlight>
print("I was born under the sign of the "+ my_sign() +" which gives me these modifiers:");
print( string_modifier("Sign:"+ my_sign(), "Modifiers" ) );
</syntaxhighlight>
}}|


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|effect_modifier|numeric_modifier}}
[[Category:Modifier Functions]]

Latest revision as of 21:19, 1 July 2020

Function Syntax

string string_modifier(string check_me )

string string_modifier(string check_me ,string modifier_name )

Returns a string modifier.

For a list of fields that this function takes, see Modifiers.

Code Samples

Checks current equipped outfit.

if(string_modifier("outfit") == "knob goblin elite guard uniform")
   print("You are equipped to purchase seltzer.");
else print("The Knob scientists won't let you into their store dressed like that.");

Display all modifiers related to your current moon sign.

print("I was born under the sign of the "+ my_sign() +" which gives me these modifiers:");
print( string_modifier("Sign:"+ my_sign(), "Modifiers" ) );

More Information

See this thread for details.


See Also

boolean_modifier() | effect_modifier() | numeric_modifier()