# Variable edition

The flags system allows us to add narrative behavior to our games. However, the use becomes too hard in various situations. For example, suppose we want to limit the number of times a player can perform a certain action (like catch upthe fish) to 3. To allow remember numbers with flags we should have a flag for each possible value (0, 1, 2 and 3 in this case).

Therefore <e-Adventure> also includes variables. On an intuitive way we can define variables as elements that always have an associated value, the default is 0, and that we can change during the games. To add a reference to the value of a variable we just have to perform a process similar to the flags. Let's see an example.

We have a book we created earlier. To do that we create a variable NumberOfTimesBookWasChecked which counts the number of times the book has been examined. Afterwards we add to the action examine of the book one condition: NumberOfTimesBookWasChecked must be less than 3.

The process is as follows:

1. First we create the new action "Examine" in the object book. To do this we click on the "Actions" node which is hanging from the object Book (do not be confused with the books themselves) with the right button and then click "Add Action Examine."
2. Click "Edit conditions" and then "Add condition". The difference is that now we press the button in the middle, named "Variables".
3. We fill in the fields below with the data NumberOfTimesBookWasChecked for the variable name, "<" as a comparison function and 3 as a value.