Difference between revisions of "Path name to id"

From Kolmafia
Jump to navigation Jump to search
imported>Fredg1
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
{{deprecated|mafiaref=r26713|more_info=Use <code>[[to_path]](name).id</code> instead.}}
 
{{
 
{{
 
#vardefine:name|path_name_to_id}}{{
 
#vardefine:name|path_name_to_id}}{{
Line 12: Line 13:
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
 
parameter1={{Param|string|name}}|
 
parameter1={{Param|string|name}}|
p1desc={{Pspan|name}} is the ''exact'' name of the path to convert.|
+
p1desc={{Pspan|name}} is the full, exact, case-sensitive name of the path to convert.|
 
}}|
 
}}|
  
Line 40: Line 41:
  
 
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=The input is case-sensitive, and doesn't accept partial matches. Also, "Unrestricted" and "Aftercore" are not valid inputs. "None" is instead expected.|
+
special=Returns -1 if given an incorrect/unknown name. Also, "Unrestricted" and "Aftercore" are not valid inputs for 0. "None" is instead expected.|
 
}}
 
}}
  
 
[[Category:Datatype Conversions]]
 
[[Category:Datatype Conversions]]

Latest revision as of 19:23, 2 October 2022

This function is deprecated in KoLmafia r26713.

Use to_path(name).id instead.


Function Syntax

int path_name_to_id(string name )

  • name is the full, exact, case-sensitive 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

Returns -1 if given an incorrect/unknown name. Also, "Unrestricted" and "Aftercore" are not valid inputs for 0. "None" is instead expected.