Difference between revisions of "To effect"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
m
imported>Eliteofdelete
Line 32: Line 32:
 
function_description=When supplied an int or string, returns the effect that corresponds to the specified parameter {{pspan|convert}}. When supplied a skill, this returns the effect that is given when the skill {{pspan|convert}} is cast on a player.|
 
function_description=When supplied an int or string, returns the effect that corresponds to the specified parameter {{pspan|convert}}. When supplied a skill, this returns the effect that is given when the skill {{pspan|convert}} is cast on a player.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=Following example shows basic to_effect operations.||
 +
code=
 +
<syntaxhighlight>
 +
//int
 +
print(to_effect(100), "green");
 +
//strings
 +
print(to_effect("Smooth"), "green");
 +
print(to_effect("Smooth Move"), "green");
 +
//skills
 +
print(to_effect($skill[Disco Aerobics]), "green");
 +
 
 +
</syntaxhighlight>|
 +
moreinfo=For more info about effects from numbers and skills, see [http://kol.coldfront.net/thekolwiki/index.php/Effects Effects].
 +
<br>It gives the following output.
 +
<pre>
 +
Stabilizing Oiliness
 +
Hella Smooth
 +
Smooth Movements
 +
Disco State of Mind
 +
</pre>
 +
}}|
  
 
special=If {{pspan|convert}} is an effect that cannot be given by use of a skill, and is supplied as such, or no match is found for a supplied string or int type, this function returns $effect[ none ].|
 
special=If {{pspan|convert}} is an effect that cannot be given by use of a skill, and is supplied as such, or no match is found for a supplied string or int type, this function returns $effect[ none ].|

Revision as of 14:40, 26 January 2015

Function Syntax

effect to_effect(int convert )

effect to_effect(string convert )

effect to_effect(skill convert )

  • convert is the int, string or skill to convert

When supplied an int or string, returns the effect that corresponds to the specified parameter convert. When supplied a skill, this returns the effect that is given when the skill convert is cast on a player.

Code Samples

Following example shows basic to_effect operations.

//int
print(to_effect(100), "green");
//strings
print(to_effect("Smooth"), "green");
print(to_effect("Smooth Move"), "green");
//skills
print(to_effect($skill[Disco Aerobics]), "green");

For more info about effects from numbers and skills, see Effects.


It gives the following output.

Stabilizing Oiliness
Hella Smooth
Smooth Movements
Disco State of Mind

Special

If convert is an effect that cannot be given by use of a skill, and is supplied as such, or no match is found for a supplied string or int type, this function returns $effect[ none ].