Get revision: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Icon315
m Created page with '{{ #vardefine:name|get_revision}}{{ #vardefine:return_type|int}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:name}}| aggregate={{#var:aggregate}}| ret…'
 
imported>Heeheehee
m You'd actually need to check this.
Line 20: Line 20:
string page = visit_url("http://builds.kolmafia.us/");
string page = visit_url("http://builds.kolmafia.us/");
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 ))
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 ("There is not a newer build.", "blue");

Revision as of 14:41, 29 July 2010

Function Syntax

int get_revision()

Returns the build of mafia you are currently using.

Code Sample

Will tell you when there is a new mafia build

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 ("There is not a newer build.", "blue");

See Also

get_version()