Closed Daniel-Wittgenstein closed 2 years ago
This is cool! But I'm afraid I'd really like to keep the web template more lightweight and minimal to make it as easy as possible for others to make their own modifications.
It would be great if we redesigned the template to be even smaller but with a core feature that allows you to add little extensions so that people could mix and match features. This would be a perfect candidate.
Adds support for displaying a simple input field where the player can type text, for example a name for the player character (web template).
An input field where the player can input arbitrary text is a frequently requested feature. Such an input field can be used (for example) to input the player's name or a password. We provide a way to do this that is simple and should be fine for most standard use cases.
The tag #INPUT creates an HTML text input element. All visible input elements are permanently removed as soon as an Inky choice is selected.
Syntax:
INPUT: target_variable [KEYWORD1] [KEYWORD2] [...]
target_variable: (mandatory) Links the global variable "target_variable" to the input field:
OPTIONAL KEYWORDS:
LOWERCASE: Lowercase the string before assigning it to the target variable.
UPPERCASE: Uppercase the string before assigning it to the target variable.
CAPITALIZE or CAPITALISE: Capitalize the string before assigning it to the target variable. (First letter becomes uppercase, following letters become lowercase; this is especially useful for custom name fields.)
TRIM: remove leading and trailing whitespace (before changing case)
LIVE: The changes to the text string are reflected live in the input field. (If you type inside an input field with UPPERCASE, for example, the letters will immediately show as uppercase.)
FOCUS: Auto-focus this text input field, so the player can start typing right away without clicking it.
UNLIMITED: The input length is usually capped at 24 characters to keep the string length sane. If UNLIMITED is set, there is no length limit to the text the player can type.
DISABLED: The input text field is shown, but the player cannot type anything inside it.
Note: < and > are automatically converted to "<" and ">" to prevent HTML injections. If you really want to check whether the player typed, say: "<37>", you would have to check the resulting string against: "<37>"
Usage Example:
VAR first_name = "Dianna" / This will appear in the input field as default value! / VAR last_name = "Fox" VAR password = ""
First Name:
INPUT: first_name CAPITALIZE TRIM FOCUS
Last Name:
INPUT: last_name CAPITALIZE TRIM
+ OK Your name is {first_name} {last_name}.
-> enter_pw
=== enter_pw
~ password = "" / reset password to blank /
Enter Password:
INPUT: password UPPERCASE FOCUS LIVE UNLIMITED
+ Done!
{password != "LEET": Wrong! -> enter_pw}
Correct!
-> END