boolean obtain(int n, string cond, location locale, string filter) {
if (cond == "choiceadv") cli_execute("conditions clear; conditions add "+n+" choiceadv");
else {
if (retrieve_item(n, to_item(cond))) return vprint("You have "+n+" "+cond+", no adventuring necessary.",5);
if (!in_hardcore() && storage_amount(to_item(cond)) > 0) take_storage(n-have_item(cond),to_item(cond));
if (have_item(cond) >= n) return vprint("You have taken your needed items from storage.",5);
cli_execute("conditions clear");
add_item_condition(n - have_item(cond), to_item(cond));
}
set_location(locale);
if(length(filter) > 0){ if(adventure(my_adventures(), locale, filter)) return vprint("Out of adventures.",-1); }
else if (adventure(my_adventures(), locale)) return vprint("Out of adventures.",-1);
if (cond == "choiceadv") return (my_adventures() > 0);
return (have_item(cond) >= n);
}
boolean obtain(int n, string cond, location locale) { return boolean obtain(n, cond, locale, ""); }
boolean obtain(int n, string cond, location locale) { return obtain(n, cond, locale, ""); }
Thanks for adding this. I just learned about combat filters last week and have already found several uses for them. They can be pretty handy.
> call scripts\zlib.ash
Expected ;, found + (zlib.ash, line 222)
void check_version(string soft, string prop, string thisver, int thread) { int w;
switch (get_property("_version_"+prop)) {
case thisver: return;
case "": vprint("Checking for updates (running "+soft+" ver. "+thisver+")...",1);
string forum = visit_url("http://kolmafia.us/showthread.php?t="+thread);
if ( forum == "" ) { vprint("Connection problem: version will not be checked again today",-1); set_property("_version_"+prop,thisver); return; }
matcher find_ver = create_matcher("<b>"+soft+" (.+?)</b>",forum); w=19;
if (!find_ver.find()) { vprint("Unable to load current version info.",-1); return; }
set_property("_version_"+prop,find_ver.group(1));
if (find_ver.group(1) == thisver) { vprint("You have a current version of "+soft+".",1); return; }
default:
vprint_html("<big><font color=red><b>New Version of "+soft+" Available: "+get_property("_version_"+prop)+"</b></font></big>",1);
vprint("Upgrade "+soft+" from "+thisver+" to "+get_property("_version_"+prop)+" here: http://kolmafia.us/showthread.php?t="+thread,"blue",1);wait(1+w);
}
}
Nope. No subfolders (of the scripts directory). No older versions.