Tavern: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Bale
wrote BEAUTIFUL code sample. Answered RFI.
Line 14: Line 14:
}}|
}}|


function_description=Attempts to complete the level 3 tavern quest. Returns the number of squares visited.|
function_description=Attempts to complete the level 3 tavern quest, stopping when it finds the rat faucet. Returns the number of squares visited.
*It will stop before actually turning off the faucet.
*If the quest was already completed, it will return the number of explored squares.
*If you run out of turns, it will return the number of explored squares.|


needscode=yes|
code1={{CodeSample|
title=Code Sample|
description=Solve the Typical Tavern.|
code=
<syntaxhighlight>
if(get_property("lastTavernAscension").to_int() == my_ascensions()) {
  print("You've already turned off the Rat Faucet!");
} else {
  int turns = tavern();
  if(get_property("tavernLayout").contains_text("3")) {
      print("Found the Rat Faucet in "+ turns+ " adventures.");
      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?")) {
        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>
}}|


see_also={{SeeAlso|chamber|entryway|guardians|hedgemaze}}|
see_also={{SeeAlso|chamber|entryway|guardians|hedgemaze}}|
Line 23: Line 48:
special=The function will turn off the faucet, and will not attempt to find and / or fight the baron.|
special=The function will turn off the faucet, and will not attempt to find and / or fight the baron.|
}}
}}
{{RFI|Is the info regarding the return value & ignoring the baron correct?}}

Revision as of 20:46, 10 March 2010

Function Syntax

int tavern()

Attempts to complete the level 3 tavern quest, stopping when it finds the rat faucet. Returns the number of squares visited.

  • It will stop before actually turning off the faucet.
  • If the quest was already completed, it will return the number of explored squares.
  • If you run out of turns, it will return the number of explored squares.

    Code Sample

    Solve the Typical Tavern.

if(get_property("lastTavernAscension").to_int() == my_ascensions()) {
   print("You've already turned off the Rat Faucet!");
} else {
   int turns = tavern();
   if(get_property("tavernLayout").contains_text("3")) {
      print("Found the Rat Faucet in "+ turns+ " adventures.");
      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?")) {
        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");
}

CLI Equivalent

The CLI command "tavern" functions similarly.

See Also

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

Special

The function will turn off the faucet, and will not attempt to find and / or fight the baron.