Entering a key-word or a code is verifying if a chain of caracters (a Text variable) matches another one with the associated condition.
Here is the value that can have each type of variable:
Boolean: True or False
Number: 1, 2, 3...
Here, we will see how to create and test Text types variables.
1. To Start in Celestory
Open an example by clicking on its cover or create a New Project.
Let's open the Bot example (for example!).
Let's delete the part of the graph after the first Alert to test the Type variable.
2. Click on Main Menu/Variables
To remove a variable, go to Main Menu/Variables then click on Remove.
Click on Add variable.
3. Create 2 Text variables
by clicking on Add variable and select Text as Type of the variable.
Add a Password variable.
Write ----- as its initial value.
Then create a Code variable.
Write 0000 as its intial value.
4. Give the user clues
with the lines of a Dialogue.
Create a Dialogue bloc add the following riddle:
- Alex: The password is what cross many cities. The code is the first 4 numbers of the Pi symbol.
Inform your user about the number of caracters
by using a perzonalized text.
To learn more about it, go to 💬 Personalize a text/score (advanced).
Create an Alert block, then write this:
Match the unknows with both regarding text type variables by extending both unknow dots.
5. Test-Play your clues
by clicking on Play
As you see, letting the user view the intial value of the variables gives him a clue for the number of caracters (letters or numbers).
You can close the Test-Play window.
6. Let the user imput a text
by creating the block Imput text.
The Imput text block appears.
The button text is the text which will be display on the button to validate the user text entry. It it by default "OK".
You can change the button style with a predefined style or your own (to create in Main Menu/Style).
Then scroll down the window.
The button text style is the design of the validation button.
Imput style let you change the design of the writting zone.
Imput text style let you change the design of the text written by the user.
Let's write on the button text:
- Validate my password.
Then close the window.
7. Let's assign the imput value to the variable Password
by creating an Assign block.
Extend the variable dot of the Assign block.
Choose Password as it is the variable we want to change the value of.
Then link both blocks and link the value dot of the Imput text block to the value of the Assign block (it will replace it).
8. Let's assign another imput value to the variable Code
by copying the process.
You can hold the Maj key and click and trace a selection rectangle on the Imput text and the Assign block, then press Control+C.
Press Control+V to get the copy of the selection with the same links.
Hold your click on the new blocks and drag it to the right of the last Assign block. Then link your block.
Change the button style of the Imput text
by double-clicking on it and write:
- Validate my code
You can close the Imput text window.
Select the Password variable block on the right.
Delete it and extend the variable dot. The value dot will disappear. Select the Code variable.
A Code variable dot appears and the value dot re-appears. Extend the value dot from the Imput text and link it to the value dot of the Assign block.
9. Create a Condition block
by right-clicking and selection it.
Extend the condition dot of the Condition block.
Select the Expression block.
Double-click on the Expression block.
x == 'river'
Clicking on the graph will make the unknow x appears.
You can close the Expression window.
Extend the unknow dot and select the Password variable block.
Create confirmations for the user
by creating 2 Alert blocks linked on the true and false outcomes.
🟩 Password validated.
🟥 Password error.
Repeat the same process
by copying the 4 blocks (Condition, Expression, Alert true & Alert false, without the password variable block) with Maj + selection rectangle.
Link both previous Alert blocks to the Condition block and extend the unknow dot and select the Code variable block.
Double-click on the expression block and write:
- x == '3141'
Create 2 Alert blocks linked on the true and false outcomes.
🟢 Code validated.
🔴 Code error.
10. Test-Play your graph
try to enter the good keyword and code.
Both keyword and code works.
In order to offer keyword options, you will need to enter every keyword possible.
Congrats, no lock have any secret for you. Create your keyword-driven interactive scenario and spread your clues sparingly.
To learn how to master Boolean type variables, go to ☑️ Set up conditions
To go further and learn how to master Number type variables, go to 🧮 Sep up conditions (advanced)
To understand all the elements in the interface, go see the Tool Elements.