Difference between revisions of "$?"

From Scriptwiki
Jump to: navigation, search
m
 
m (added category)
Line 16: Line 16:
  
 
'''Note:''' This identifier cannot be used in a script event. One way around this is to use a /timer to initiate an input request after the script ends.
 
'''Note:''' This identifier cannot be used in a script event. One way around this is to use a /timer to initiate an input request after the script ends.
 +
 +
[[Category:Identifiers]]

Revision as of 11:01, 2 July 2007

$?*!="message"

Prompts the user for input and returns the result.

//echo $?="What is your name?"
If the user enters their name in the editbox and presses the OK button, $? will return whatever the user entered. If the user clicks on the Cancel button, $? returns nothing.

//echo $?*="What is your password?"
In this case the $?* makes any text that the user types into the editbox appear as ***** characters to prevent anyone seeing what is being entered.

//echo $?!="Shall I continue?"
In this case, a Yes/No dialog pops up. If the user clicks on Yes, $true is returned, otherwise $false is returned.

The input dialog is extended vertically to display the whole message if it is very long. You can also make text appear on different lines by using the $crlf identifier to separate the lines, eg.

//echo $?="This is on the first line. $crlf $+ And this is on the 2nd line."

Note: This identifier cannot be used in a script event. One way around this is to use a /timer to initiate an input request after the script ends.