User confirm: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m Reverted edits by Icon315 (Talk) to last revision by StDoodle
imported>Icon315
Fixed Coding
Line 23: Line 23:
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if (!user_confirm("Are you sure you want to proceed with executing this script?") {
if (!user_confirm("Are you sure you want to proceed with executing this script?") )
{
   abort("Script execution canceled by user.");
   abort("Script execution canceled by user.");
}
</syntaxhighlight>}}|
</syntaxhighlight>}}|


}}
}}

Revision as of 22:07, 12 April 2010



Function Syntax

boolean user_confirm(string message )

  • message is the text to display in the confirmation pop-up

Presents the user with a pop-up dialog box with the text in message (can use escaped characters, such as "\n" for a newline); returns true if the user selects "Yes" and false if the user selects "No."

Please use these sparingly, as it can defeat the purpose of scripting if the user must constantly provide information during execution.

Code Sample

A check to see if the user truly wants to execute a script.

if (!user_confirm("Are you sure you want to proceed with executing this script?") )
{
  abort("Script execution canceled by user.");
}