Using combat filters with use() function

RESPRiT

Member
Checking combat skill usability

Some items, such as the Spooky Putty Sheet, will initiate combat when used. Is there a way to use a combat filter with a use() call like you can with adventure()? Solved!

Another thing I just thought of: is there a way to check if a combat skill is usable? For example, one that has limited daily uses.
 
Last edited:

RESPRiT

Member
Sweet! Works great!

PHP:
boolean use_combat(item it, string filter) {
  string page = visit_url("inv_use.php?&pwd&which=3&checked=1&whichitem=" + it.to_int());

  if(page.contains_text("You don't have the item you're trying to use")) {
    return false;
  }

  if(page.contains_text("You're fighting")) {
    run_combat(filter);
  }

  return true;
}
 

AlbinoRhino

Active member
Another thing I just thought of: is there a way to check if a combat skill is usable? For example, one that has limited daily uses.

I guess I missed this earlier. Almost all (all ?) of those skills have an associated property that tracks their usage. For instance,
_shatteringPunchUsed


You can use 'prefref' in the cli to find the ones you need. "prefref shatter" found this one.

Then:

if (get_property("_shatteringPunchUsed").to_int() < 3) ...yada yada yada
 

RESPRiT

Member
Ah, I totally forgot about prefref, thanks for the reminder! I realize now that the wiki page for daily properties is over a year out of date, which explains why I wasn't finding the property there.
 
Top