To location: Difference between revisions
Jump to navigation
Jump to search
imported>Eliteofdelete No edit summary |
imported>Eliteofdelete No edit summary |
||
Line 25: | Line 25: | ||
function_description=Returns the location that matches {{pspan|name}} or {{pspan|id}} as specified.| | function_description=Returns the location that matches {{pspan|name}} or {{pspan|id}} as specified.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=Following example shows basic to_location operations.|| | |||
code= | |||
<syntaxhighlight> | |||
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"); | |||
</syntaxhighlight>| | |||
moreinfo= | |||
It gives the following output. | |||
<pre> | |||
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. | |||
</pre> | |||
}}| | |||
special=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.| | special=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.| |
Latest revision as of 15:44, 26 January 2015
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.
Special
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.