Difference between revisions of "$?"
m |
m (added See also) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
== Examples == | == Examples == | ||
− | + | //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. | 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 $?1="Please enter a value." | |
In this case the input dialog will only show if $1 is $null. If $1 exists, it will be used in place. | In this case the input dialog will only show if $1 is $null. If $1 exists, it will be used in place. | ||
− | + | //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. | 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. | 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. | 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 == | == Note == | ||
− | This identifier cannot be used in a script event. One way around this is to use /[[scon]] or a /[[timer]] to initiate an input request after the script ends. | + | This identifier cannot be used in a script event. One way around this is to use /[[scon]] or a /[[timer]] to initiate an input request after the script ends. <br /> |
+ | Example: | ||
+ | on *:text:Foo:#:{ /timer 0 0 echo -a $?="Bar?" } | ||
+ | |||
+ | ==See Also== | ||
+ | |||
+ | * [[$input]] | ||
[[Category:Remote Identifiers]] | [[Category:Remote Identifiers]] |
Latest revision as of 05:20, 13 May 2008
Prompts the user for input and returns the result.
$?*!="message"
Examples
//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 $?1="Please enter a value."
In this case the input dialog will only show if $1 is $null. If $1 exists, it will be used in place.
//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 /scon or a /timer to initiate an input request after the script ends.
Example:
on *:text:Foo:#:{ /timer 0 0 echo -a $?="Bar?" }