Waitq

From Kolmafia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Function Syntax

void waitq(int secs )

  • secs is the number of seconds you want to delay further action.

This function will initiate a countdown from secs seconds to 0, during which time nothing else will be acted on. It essentially pauses a script. This is the "quiet" version, which will not print a countdown on the gCLI during the delay.

Minimum wait is 1 second, even if secs is 0.

Code Samples

The example adventures 5 times in the castle top floor. Waits a few seconds between adventures to give time time to read messages. Wait silent is used for easier readability.

int[item] items;
int meat;
buffer fight;
for x from 1 to 5 {
   fight = visit_url(to_url($location[The Castle in the Clouds in the Sky (Top Floor)]));
   repeat {
      if (contains_text(fight, "choice.php")) { //Check to see if in a choice adventure
        cli_execute("choice-goal"); //Clear the choice adventure
        fight = visit_url(to_url($location[The Castle in the Clouds in the Sky (Top Floor)])); 
      }
   } until (!contains_text(fight, "choice.php"));
   fight = run_combat();
   if (have_effect($effect[beaten up]) == 0) {
      items = extract_items(fight);
      meat = extract_meat(fight);
      print("You acquired "+meat+" meat, and the following items:", "green");
      foreach it, number in items 
        print(""+number+", "+it, "blue");
      waitq(4);
   }
   else abort("You lost the fight :(");
}

CLI Equivalent

The CLI command "waitq" functions the same and can be used to pause basic .txt scripts.

See Also

wait()