Get player id: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
r11208
 
imported>Taltamir
No edit summary
 
(One intermediate revision by one other user not shown)
Line 14: Line 14:
}}|
}}|


function_description=Returns the user id number of a given player.|
function_description=Returns the user id number of a given player.  If KoLmafia does not already know the player's id number, it will return the input string.|


code1={{CodeSample|
code1={{CodeSample|
Line 32: Line 32:
}}|
}}|
}}
}}
{{SeeAlso|my_id|get_clan_id|get_clan_name}}
{{SeeAlso|my_name|my_id|get_clan_id|get_clan_name}}


[[Category:Miscellaneous Functions]]
[[Category:Miscellaneous Functions]]

Latest revision as of 20:01, 1 June 2020

Function Syntax

string get_player_id(string player )

Returns the user id number of a given player. If KoLmafia does not already know the player's id number, it will return the input string.

Code Sample

Get user id so that we can check the user's page for their current class.

class player_to_class( string player ) {
   string id = get_player_id( name );
   matcher classy = create_matcher( "Class:</b></td><td>(.+?)</td>", visit_url( "showplayer.php?who=" + id ) ); 
   if(find(classy))  
      return classy.group(1).to_class();
   return $class[none]; 
}


See Also

my_name() | my_id() | get_clan_id() | get_clan_name()