Menu

Input

Brynner

Syntax

Description

This command will make an input box pop up on the client connected to the
RID#Usage, to allow entering of a string or digits
only, depending on variable's type.

Normally you cannot input a negative number with this command, to prevent
exploits in badly written scripts, which would let people, for example, put
negative amounts of [Zeny] into a bank script and receive free Zeny as
result. The default values for min value and max value are specified as
input_min_value and input_max_value respectively in
{{git|conf/script.conf}}.

The command has two additional optional arguments and a return value to safely
override this behavior, when required. Depending on the variable type used,
the min, max, and return value have different meanings:

  • For strings min and max specify the minimum and maximum string length. The return value is -1, if the string was too short, 1, if it was too long, otherwise 0.
  • For numbers min and max specify the minimum and maximum value, the variable is allowed to be set to. If the entered value is outside the specified range [min,max], it is capped to the nearest valid value. The return value is -1 for too small values, 1 for too large values, otherwise 0.

Examples

[Mes] "[Woman]";
mes "Try and guess the number I am thinking of.";
mes "The number will be between 1 and 10.";
[Next];

[Set] .@number, [Rand](1, 10);
[While](input(.@guess, 1, 10))
{
    mes "[Woman]";
    mes "Didn't you listen before? The number is between 1 and 10.";
    next;
}

mes "[Woman]";
[If](.@guess==.@number)
{
    mes "Well done, that was the number I was thinking of.";
}
else
{
    mes "Sorry, that wasn't the number I was thinking of.";
}
[Close];



mes "[Man]";
mes "You need a password to pass.";
next;

input .@pwd$;
if(.@pwd$!="s3cr3t")
{
    mes "[Man]";
    mes "Get out.";
    close;
}

[Category:Script Command]


Related

Wiki: Variables
Wiki: Zeny

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.