From KoLMafia
Jump to: navigation, search

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.

print(to_effect(100), "green");
print(to_effect("Smooth"), "green");
print(to_effect("Smooth Move"), "green");
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

Following example tells which buffs you are missing but could have.

void buffs_check() {
int amount;
boolean have_buff;
boolean[skill] active_buffs, bot_buffs, castable_buffs;
   foreach it in $skills[] {
      amount = have_effect(to_effect(it));
      if (amount == 0)
         have_buff = false;
      else have_buff = true;
      if (have_buff) //Currently have the effect active
      if (it.buff == true && !have_buff && it.class != $class[none] && it.level != -1 && it.dailylimit == -1 && it != $skill[Spiky Shell] && it != $skill[Antibiotic Saucesphere]) //buff bot buffs
      if (have_skill(it) && it.combat != true && !have_buff && to_effect(it) != $effect[none]) //buffs you can cast on yourself
   print("You currently have the following buffs active:", "red");
   foreach it in active_buffs
      print(""+it+"", "green");   
   print("You could get the following buffs from a buff bot:", "red");
   foreach it in bot_buffs
      print(""+it+"", "blue");   
   print("You could cast the following buffs on yourself:", "red");
   foreach it in castable_buffs
      print(""+it+"", "purple");


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 ].