To location

From Kolmafia
Jump to navigation Jump to search

Function Syntax

location to_location(int convert )

location to_location(string convert )

  • convert is the int or string to convert

Returns the location that matches name or id as specified.

Code Samples

Following example shows basic to_location operations.

int first;
string second, third;

first = 32;
second = "top floor";
third = "poop deck";

print(first+" gives "+to_location(first)+".", "blue");
print(second+" gives "+to_location(second)+".", "blue");
print(third+" gives "+to_location(third)+".", "blue");

It gives the following output.

32 gives The Batrat and Ratbat Burrow.
top floor gives The Castle in the Clouds in the Sky (Top Floor).
poop deck gives The Poop Deck.


While direct casting via $location[ ] is case-insensitive and able to catch partial matches, this function has the added benefit of passing variables as a string parameter.