Trying some custom keyboard input

Hello,

I'm trying to figure out a way to let the player input an arbitrary text at an arbitrary time (I need this to happen in the middle of a rule, so I can't fool around with the command prompt, which I've also done in my project for a different reason.)

So far I've figured that there's a I6 function called KeyboardPrimitive, and that this somehow parses text into some variables (buffer and table). I don't exactly care about words and stuff, I just need the literal text, and specifically, I need to turn it into a number. Ideally, the number shouldn't be restricted to a 16-bit value, even in z-code (but I'm willing to make it Glulx compatible only).

So: step 1: get the text (using I6 code)

Step 2: put the text into a variable (a text that varies? in Inform 7, or if I have to, process it in I6 first)

Step 3: convert it into a number (number that varies? in Inform 7

Ok, maybe having this support also words would be nice too, since I may need it to type a long message and then iterate through the words looking for keywords. But this can't be done in the parser, since I need to call it from a Menu (to which I already introduced a few hacks, such as hotkeys), which uses rules. Can't even exit the rule and then use the parser, because the rules use recursion and getting back to the same state it was would be impossible.

This doesn't need to be an actual parser. Just a way to copy the contents of the text / words from I6 to an I7 variable. And also to know the right way to turn text into numbers. Maybe a "to say" rule, or "to decide" or to something, I'm a bit dizzy about I7 conventions right now...

​

Posted Dec 28, 2018, 11:02 PM UTC

29
Loading comments…