within quest, you can do it this way too (as this 'regex' and etc code symbol fancy stuff is still too confusing for me ~ I'm a noob trying to learn to code, hehe), for example:
Quest's 'Coding Bible' links:
http://docs.textadventures.co.uk/quest/http://docs.textadventures.co.uk/quest/ ... notes.htmlhttp://docs.textadventures.co.uk/quest/ ... quest.htmlhttp://docs.textadventures.co.uk/quest/ ... ments.htmlhttp://docs.textadventures.co.uk/quest/elements/http://docs.textadventures.co.uk/quest/types/http://docs.textadventures.co.uk/quest/functions/ (category order)
http://docs.textadventures.co.uk/quest/ ... tions.html (alphabetical order)
http://docs.textadventures.co.uk/quest/scripts/yes, as you already found out, there's: LengthOf (
http://docs.textadventures.co.uk/quest/ ... gthof.html )
<function name="first_name_function">
msg ("What is your (first) name?")
msg ("(10 characters max)")
get input {
// quest's engine automatically (hiddenly) sets a built-in variable for you when using the 'get input' and 'show menu' Functions: result = your_typed_in_input
if (LengthOf (result > 10) ) {
ClearScreen
first_name_function
} else {
player.first_name_string = result
ClearScreen
}
}
</function>
--------------------------
'IsInt' is just a check upon whether the text is able to be an Integer Attribute:
text~variable's value: 1 -> yes, this CAN be converted into an Integer Attribute
text~variable's value: 1.5 -> no, this can NOT be converted into an Integer Attribute
text~variable's value: m -> no, this can NOT be converted into an Integer Attribute
<function name="age_integer_function">
msg ("What is your age?")
get input {
if (IsInt (result)) {
player.age_integer = ToInt (result)
} else {
age_integer_function
}
}
</function>
so, it as seen above, has nothing to do with an input's character~symbol length.
------------------------------
@Silver:
you're getting a bit confused with the text processor format and regular quest format
Silver: incorrect syntax
msg("what is the password?")
Get input {
If { result = ("1234")
// run password correct script
} else {
// run password incorrect script
}
}
correct syntax:
Script_or_Function_command (if needed: Object_name.Attribute_name OPERATOR Value_or_Expression) { scripting }
msg("what is the password?")
Get input {
If (result = "1234") {
// run password correct script
} else {
// run password incorrect script
}
}