Get revision: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
m You'd actually need to check this.
imported>StDoodle
No edit summary
Line 12: Line 12:
return_also={{#var:return_also}}
return_also={{#var:return_also}}
}}|
}}|
function_description=Returns the revision number of KoLmafia being used. For daily builds, the revision number is used as the build number, and the two will be identical.|
code1={{CodeSample|
code1={{CodeSample|
title=Code Sample|
title=Code Sample|
description=Will tell you when there is a new mafia build|
description=Will tell you when there is a new daily build available|
code=
code=
<syntaxhighlight>
<syntaxhighlight>
Line 21: Line 23:
string current = substring ( page, index_of ( page , "(Built Once An Hour)" ) , index_of ( page , ".jar</a>" ) );
string current = substring ( page, index_of ( page , "(Built Once An Hour)" ) , index_of ( page , ".jar</a>" ) );
if (contains_text( current , (Build+1) ))
if (contains_text( current , (Build+1) ))
print ("There is a new build. Go get it here http://builds.kolmafia.us/", "red");
  print ("There is a new build. Go get it here http://builds.kolmafia.us/", "red");
else print ("There is not a newer build.", "blue");
else
  print ("You are already using the most current version of KoLmafia.", "blue");
</syntaxhighlight>
</syntaxhighlight>
}}|
}}|


function_description=Returns the build of mafia you are currently using.|
|
|


see_also={{SeeAlso|get_version}}|
see_also={{SeeAlso|get_version}}|
}}
}}
[[Category:Miscellaneous]]

Revision as of 16:46, 29 July 2010

Function Syntax

int get_revision()

Returns the revision number of KoLmafia being used. For daily builds, the revision number is used as the build number, and the two will be identical.

Code Sample

Will tell you when there is a new daily build available

int Build = get_revision();
string page = visit_url("http://builds.kolmafia.us/");
string current = substring ( page, index_of ( page , "(Built Once An Hour)" ) , index_of ( page , ".jar</a>" ) );
if (contains_text( current , (Build+1) ))
   print ("There is a new build. Go get it here http://builds.kolmafia.us/", "red");
else
   print ("You are already using the most current version of KoLmafia.", "blue");

See Also

get_version()