Minor update: New action

Read and comment on the latest community news and site updates.
Locked
User avatar
Unas
Admin / Site programmer
Posts: 8850
Joined: Tue Jul 10, 2007 4:43 pm
Gender: Male
Spoken languages: Français, English, Español
Contact:

Minor update: New action

Post by Unas »

A new action is available : "Ask player for a variable's value".
Basically, it enables you to prompt the user for a value, that is stored in a variable when he confirms.

This action takes 3 parameters:
  • The name of the variable that will be set
  • The type of the variable, that will add a restriction to what the player can type in. "Character string" will accept anything, "Word" will not accept spaces (only one word), and "Integer number" will only accept... integer numbers.
  • The Password mode. When set to No (default), the player can see what he types in; if the mode is Yes, he won't.
This action is meant to be used with strings functions in the expression engine, in particular the function "f:str_distance" for an approximate recognition of what the user types in. For example, "f:str_distance('Phoenix', 'Pheonix')< 30" will return true, even with the spelling error.

A possible use for that would be to ask the player for his name. Then, if he enters "John Doe", you can extract his first name with the f:str_first_word function : "f:str_first_word('John Doe')" returns John, etc.
And you can use it afterwards in the game :)
ImageImageImage
If knowledge can create problems, it is not through ignorance that we can solve them.
Si le savoir peut créer des problèmes, ce n'est pas l'ignorance qui les résoudra. ( Isaac Asimov )
Locked