Is there anyway to ask for the players name?
Closed this issue · 4 comments
Kni does not yet have this feature.
In fact, all variables in Kni today are integers. It is statically typed by virtue of having only one type. I have contemplated supporting other types including strings and enum types (integer aliases with nominal values).
To support strings, the first step would be to extend the type system. This would probably also extend to requiring variable declarations and adding a notion of lexical scope, as a prelude to having modules. This would all in all entail adding a linker phase, which is also needed for stories that span multiple files with independent lexical scopes.
There is also the matter of syntax. I expect that reading a string would look something like:
> variable
# or
variable>
The type of the variable would need to be declared somewhere, to distinguish integer and string storage, or inferred somehow.
! name Text
buttons Count
enum Color red green blue
color Color
Support for reading string input has landed on master.
What's your name?
> Name
Your name is {(Name)}.
Release article for 4.0.0-alpha2 https://www.patreon.com/posts/23796581 with thanks, @mingfang!