Hello!
I'm using Twine 2 with Sugarcube 2 to build a game centered around text input.
I want to be able to have players submit text with the enter key.
Currently i'm doing text submit with a custom parsing macro + goto wrapped in a <<click>> macro. I need to use a textArea because double checking text is important to the game, and the amount of text people usually write has to use word wrap to display in full. (I've yet to see someone intentionally use a newline, so losing it won't be a big deal.)
Is there a way to run script(s) or forward to another passage on an enter keypress with a textArea in focus? Currently my text area + button for submitting text and progressing to the next passage looks like this:
<<textarea "$variables.answers[0]" $variables.boxText autofocus>>
<<click "SUBMIT ANSWER">><<ruleCheck $variables>><<goto passage02>><</click>>
Ideally, I'd like it to run <<ruleCheck $variables>> and <<goto passage02>> on keypress, but if I could just get a passage forward or a single macro to activate on an enter keypress, I can work around that.
I'm using Twine 2 with Sugarcube 2 to build a game centered around text input.
I want to be able to have players submit text with the enter key.
Currently i'm doing text submit with a custom parsing macro + goto wrapped in a <<click>> macro. I need to use a textArea because double checking text is important to the game, and the amount of text people usually write has to use word wrap to display in full. (I've yet to see someone intentionally use a newline, so losing it won't be a big deal.)
Is there a way to run script(s) or forward to another passage on an enter keypress with a textArea in focus? Currently my text area + button for submitting text and progressing to the next passage looks like this:
<<textarea "$variables.answers[0]" $variables.boxText autofocus>>
<<click "SUBMIT ANSWER">><<ruleCheck $variables>><<goto passage02>><</click>>
Ideally, I'd like it to run <<ruleCheck $variables>> and <<goto passage02>> on keypress, but if I could just get a passage forward or a single macro to activate on an enter keypress, I can work around that.