Difference between revisions of "$?"

From Scriptwiki
Jump to: navigation, search
m
 
m (added See also)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== $?*!="message" ==
 
 
Prompts the user for input and returns the result.
 
Prompts the user for input and returns the result.
 +
$?*!="message"
  
'''//echo $?="What is your name?"'''<br>
+
== 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 $?*="What is your password?"'''<br>
+
//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.
 
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?"'''<br>
+
//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."
+
//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. <br />
 +
Example:
 +
on *:text:Foo:#:{ /timer 0 0 echo -a $?="Bar?" }
 +
 
 +
==See Also==
 +
 
 +
* [[$input]]
  
'''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: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?" }

See Also