Tavern: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
thanks heeeheeeheee. I cannot believe that works! WHY does that work?!?
imported>Padth
Previous information was way wrong
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Adventuring|


function1={{Function|
function1={{Function|
Line 14: Line 13:
}}|
}}|


function_description=Attempts to complete the level 3 tavern quest, stopping when it finds the rat faucet. Returns the number of squares visited.
function2={{Function|
*It will stop before actually turning off the faucet.
name={{#var:name}}|
*If the quest was already completed, it will return the number of explored squares.
aggregate={{#var:aggregate}}|
*If you run out of turns, it will return the number of explored squares.
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
parameter1={{Param|string|target}}|
p1desc={{Pspan|target}} is the (optional) target destination (one of "faucet", "baron", "fight", or "explore".)  Defaults to "faucet".|
}}|
 
function_description=Attempts to complete the level 3 tavern quest, stopping when it has reached the target specified. "faucet" and "baron" will find the faucet and the baron respectively, "fight" will find and fight the baron, and "explore" will explore the entire cellar.  Returns the square the faucet or baron is found in, 0 if "explore" is chosen, or -1 if an error is encountered.
 |
 |


Line 25: Line 30:
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if(get_property("lastTavernAscension").to_int() == my_ascensions()) {
int square = tavern();
  print("You've already turned off the Rat Faucet!");
if(get_property("tavernLayout").contains_text("3")) {
} else {
  print("Found the Rat Faucet in square " + square);
  int turns = tavern();
  if(available_amount($item[Baron von Ratsworth's monocle]) == 0
  if(get_property("tavernLayout").contains_text("3")) {
    && available_amount($item[Baron von Ratsworth's money clip]) == 0
      print("Found the Rat Faucet in "+ turns+ " adventures.");
    && available_amount($item[Baron von Ratsworth's tophat]) == 0
      if(available_amount($item[Baron von Ratsworth's monocle]) == 0
    && user_confirm("Do you want to fight Baron Von Ratsworth?")) {
      && available_amount($item[Baron von Ratsworth's money clip]) == 0
    tavern("fight");
      && available_amount($item[Baron von Ratsworth's tophat]) == 0
  }
      && user_confirm("Do you want to fight Baron Von Ratsworth?")) {
} else print("Did not find the rat faucet.", "red");
        print("You'll have to do the next bit yourself. Sorry.", "red");
      } else {
        visit_url("rats.php?action=faucetoff");
      }
  } else print("Spent "+ turns+ " adventures searching, but did not find the rat faucet.", "red");
}
</syntaxhighlight>
</syntaxhighlight>
}}|
}}|


see_also={{SeeAlso|chamber|entryway|guardians|hedgemaze}}|
see_also={{SeeAlso|chamber|entryway|guardians|hedgemaze}}|
cli_equiv=The CLI command "tavern" functions similarly.|
cli_equiv=The CLI commands "tavern" and "baron" function similarly.|
more_info= |
special=The function will not turn off the faucet, and will not attempt to find and / or fight the baron.|
}}
}}
[[Category:Adventuring]]

Latest revision as of 13:55, 28 July 2014

Function Syntax

int tavern()

int tavern(string target )

  • target is the (optional) target destination (one of "faucet", "baron", "fight", or "explore".) Defaults to "faucet".

Attempts to complete the level 3 tavern quest, stopping when it has reached the target specified. "faucet" and "baron" will find the faucet and the baron respectively, "fight" will find and fight the baron, and "explore" will explore the entire cellar. Returns the square the faucet or baron is found in, 0 if "explore" is chosen, or -1 if an error is encountered.  

Code Sample

Solve the Typical Tavern.

int square = tavern();
if(get_property("tavernLayout").contains_text("3")) {
   print("Found the Rat Faucet in square " + square);
   if(available_amount($item[Baron von Ratsworth's monocle]) == 0
    && available_amount($item[Baron von Ratsworth's money clip]) == 0
    && available_amount($item[Baron von Ratsworth's tophat]) == 0
    && user_confirm("Do you want to fight Baron Von Ratsworth?")) {
     tavern("fight");
   }
} else print("Did not find the rat faucet.", "red");

CLI Equivalent

The CLI commands "tavern" and "baron" function similarly.

See Also

chamber() | entryway() | guardians() | hedgemaze()