Difference between revisions of "Wait"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>Eliteofdelete
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Miscellaneous|
 
  
 
function1={{Function|
 
function1={{Function|
Line 14: Line 13:
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
 
parameter1={{Param|int|secs}}|
 
parameter1={{Param|int|secs}}|
p1desc={{pspan|secs}} is the number of seconds you want to count down from.
+
p1desc={{pspan|secs}} is the number of seconds you want to delay further action.
 
}}|
 
}}|
  
function_description=This function will initiate a countdown from {{pspan|secs}} seconds to 0, during which time nothing else will be acted on. It essentially pauses a script. In addition, a countdown prints to the CLI at varying intervals (every 15 secs for large numbers, 5 seconds for smaller numbers and every second from 5 seconds down).|
+
function_description=This function will initiate a countdown from {{pspan|secs}} seconds to 0, during which time nothing else will be acted on. It essentially pauses a script. In addition, a countdown prints to the CLI at varying intervals (every 15 secs for large numbers, 5 seconds for smaller numbers and every second from 5 seconds down).</p><p>Minimum wait is 1 second, even if {{pspan|secs}} is 0.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=The following example will give a 5 second countdown before running dj's EatDrink script, if you have it. |
 +
code=
 +
<syntaxhighlight>
 +
print("Running the EatDrink script in...");
 +
wait(5);
 +
if (svn_exists("therazekolmafia-eatdrink"))
 +
  cli_execute("EatDrink.ash");
 +
else print("You currently do not have EatDrink script, check the forums for it!", "blue");
  
 +
</syntaxhighlight>|
 +
 +
}}|
 +
see_also={{SeeAlso|waitq}}|
 
cli_equiv=The CLI command "wait" functions the same and can be used to pause basic .txt scripts.|
 
cli_equiv=The CLI command "wait" functions the same and can be used to pause basic .txt scripts.|
 
}}
 
}}
 +
 +
[[Category:Miscellaneous Functions]]

Latest revision as of 23:05, 21 January 2015

Function Syntax

void wait(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. In addition, a countdown prints to the CLI at varying intervals (every 15 secs for large numbers, 5 seconds for smaller numbers and every second from 5 seconds down).

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

Code Samples

The following example will give a 5 second countdown before running dj's EatDrink script, if you have it.

print("Running the EatDrink script in...");
wait(5);
if (svn_exists("therazekolmafia-eatdrink"))
   cli_execute("EatDrink.ash");
else print("You currently do not have EatDrink script, check the forums for it!", "blue");

CLI Equivalent

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

See Also

waitq()