Path name to id: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Fredg1
temporary draft until function is fixed
 
imported>Fredg1
No edit summary
Line 12: Line 12:
return_also={{#var:return_also}}|
return_also={{#var:return_also}}|
parameter1={{Param|string|name}}|
parameter1={{Param|string|name}}|
p1desc={{Pspan|name}} is the partial(?) name of the path to convert.|
p1desc={{Pspan|name}} is the ''exact'' name of the path to convert.|
}}|
}}|


function_description=Returns the specified path {{pspan|name}} as its {{kolwiki|Paths_by_number|path number}}. (This function is not yet working; this is a placeholder until it does and can be tested)|
function_description=Returns the specified path {{pspan|name}} as its {{kolwiki|Paths_by_number|path number}}.|


code1={{CodeSample|
code1={{CodeSample|
title=Code Samples|
title=Code Samples|
description=<Placeholder>.||
description=Following example shows basic path_name_to_id operations.||
code=
code=
<syntaxhighlight>
<syntaxhighlight>
<Placeholder>
string first = "Bees Hate You";
string second = "G-Lover";
string third = "Live. Ascend. Repeat.";
 
print(first+" gives "+path_name_to_id(first)+".");
print(second+" gives "+path_name_to_id(second)+".");
print(third+" gives "+path_name_to_id(third)+".");
</syntaxhighlight>|
</syntaxhighlight>|
moreinfo=
moreinfo=
Gives the following output.
Gives the following output.
<pre>
<pre>
<Placeholder>
Bees Hate You gives 4.
G-Lover gives 33.
Live. Ascend. Repeat. gives 31.
</pre>
</pre>
}}|
}}|


see_also={{SeeAlso|my_path|my_path_id|path_id_to_name}}|
see_also={{SeeAlso|my_path|my_path_id|path_id_to_name}}|
special=<Placeholder>.|
special=The input is case-sensitive, and doesn't accept partial matches. Also, "Unrestricted" and "Aftercore" are not valid inputs. "None" is instead expected.|
}}
}}


[[Category:Datatype Conversions]]
[[Category:Datatype Conversions]]

Revision as of 00:42, 8 June 2020

Function Syntax

int path_name_to_id(string name )

  • name is the exact name of the path to convert.

Returns the specified path name as its path number.

Code Samples

Following example shows basic path_name_to_id operations.

string first = "Bees Hate You";
string second = "G-Lover";
string third = "Live. Ascend. Repeat.";

print(first+" gives "+path_name_to_id(first)+".");
print(second+" gives "+path_name_to_id(second)+".");
print(third+" gives "+path_name_to_id(third)+".");

Gives the following output.

Bees Hate You gives 4.
G-Lover gives 33.
Live. Ascend. Repeat. gives 31.

See Also

my_path() | my_path_id() | path_id_to_name()

Special

The input is case-sensitive, and doesn't accept partial matches. Also, "Unrestricted" and "Aftercore" are not valid inputs. "None" is instead expected.