*
IV. Dynamic content
This is the first tutorial where we dabble in scripting. EOS uses a subset of Javascript 5 with a spicy topping. In my tutorials I would like to focus on EOS-specific scripting and only give a minimal introduction to Javascript. There are enough great tutorials to be found on the internet if you want to learn more about Javascript itself. I am going to try to keep it simple and not bother with technicalities, if possible.
1. Introduction to variables
A variable is, basically, a piece of the computer's memory that has been given a nice, human-readable nickname. We can tell EOS to store all kinds of data in there, for example a number and do some math with it, simply by referring to it by its name.
It is called variable because it can change (and also because that is what they call it in math).
Variables allow your tease to "remember" anything that happens during the tease, while if-Actions allow your tease to react based on the values stored in variables. They go hand in hand and, together, they allow parts of your tease to appear or change conditionally.
This allows for features such as:
- Settings like fetish-selection, difficulty, length, gender-selection, language-selection, etc.
- Choices that affect the story at a later point
- Rewards based on player performance
- Complex game logic
In this tutorial we are going to get to know the most important types of data that can be stored in variables and take a look at some examples how they could be used. It is essential to understand that there are different types of data, because weird things can happen when we mix them mindlessly.
Let us start with a very fundamental data type, called Boolean.
2. Fetish selection (Booleans and If-actions)
A boolean can only hold either of two values: True or false. It is named after George Boole, a mathematician who also worked in the field of logic.
In JavaScript code you can use the words
ππππ and
πππππ literally. These "Boolean Literals" will be recognized to represent their respective boolean values.
Booleans may seem underwhelming at first glance, but they are incredibly important. For example, they are the only type that if-Actions can understand.
Booleans are generally used to keep track of whether something is enabled, active or completed. This can be:
- Binary player choices
- An option in your tease that can be turned on or off
- Task completion
- States in a more complicated game logic
- Any kind of yes-or-no situation
Let us take a closer look at an easy example: Asking the player, whether they wish the tease to include certain fetishes, at the beginning of the tease.
Here is what that could look like in the case of ballbusting:
Somewhere at the beginning you'd give the player a choice of Yes or No. Within each option's action queue you assign either
ππππ or
πππππ to a variable called "ballbusting".

- boolean_assignment_small.jpg (24.28 KiB) Viewed 63929 times
Then you can check if ballbusting is enabled in several situations throughout your tease using an if-action. If-actions offer two action queues:
The one right below "Then" gets executed if and only if the given expression is
ππππ. The action queue below "Else" gets executed only if said expression evaluates to
πππππ.
As you can tell, boolean variables slot right into an if-action.
Both of these queues are optional and you can leave either of them empty if you do not want anything to happen. Once the respective queue has been executed EOS continues with the next action after the if-action.

- boolean_if-action_small.jpg (39.27 KiB) Viewed 63929 times
You can of course put Goto-actions inside if-actions to follow a completely different path if a fetish is enabled.
It's also a good idea to set a default value for ballbusting in the init-script, located on the options tab. This ensures that the variable is always defined, even if you use the preview function to launch your tease somewhere in the middle.
ππππ is a sensible default for ballbusting, because it allows you to preview the optional parts as well.

- boolean_init-script_small.jpg (41.08 KiB) Viewed 63929 times
3. Points and Rewards (Numbers and Comparisons)
Variables can also hold numbers for you and allow you to do math with it.
Numbers can be useful in all kinds of situations, obviously, but a very common usage in teases is to quantify how well players are performing by awarding them points and not seldomly reward them based on their score.
It is necessary to define the variable which holds points, before we do any math (like "plus 5") with it. This is easily done by assigning an initial value to it. Zero is always a good choice. Like before, put this in the init-script:
Now, people can earn points by completing certain tasks. Adding to a number variable can be done with a command like this:
It is important to understand that this is not supposed to be an equation. The computer will not try to solve this for x, thankfully.
Unlike in math, the equal sign is to be understood as an assignment-command here, like "make x equal to x plus 5".
Why not ask a quiz question?
If the button corresponding to the right answer is clicked, award 5 points.

- number_add-points_small.jpg (34.62 KiB) Viewed 63929 times
The usual operators are available as you know them from calculators or spreadsheets:
Code: Select all
x = 2 * x; // Doubles x
x = 2 + 3 * 4; // Results in x being 14
x = (2 + 3) * 4; // Results in x being 24
x = 1 / 2; // Results in x being 0.5
Just like with a calculator, there is only limited precision and rounding errors can occur.
If you want to inform players of their current score, you can insert a variable's value in a say action with the button on the far right:

- number_say-with-eval_small.jpg (17.26 KiB) Viewed 63929 times
Now that people had a chance to earn points it is time to see if they have earned a reward. If they have accumulated enough points we will grant them an orgasm, for example.
That means, we have to process the number of points in a way that we obtain a boolean value, which we can then feed to an if-action.
This is where comparisons come in.
Comparisons have results. The same way the sum 3 + 4 results in 7, the comparison 3 < 4 results in true. You may guess that, due to their boolean result, comparisons fit nicely into if-actions.
The following chart is meant to cement the concept of comparisons having a boolean result. (I do not doubt your understanding of basic math.)

- relational-operators.png (6.81 KiB) Viewed 63929 times
Note that the operator for "equal to" is two equal-signs in order to distinguish it from the assignment-operator which is a single equal-sign.
Applying this to the player's score could look something like this:

- number_if-comparison_small.jpg (39.14 KiB) Viewed 63929 times
Pro-Tip: Checking for a range of numbers
- Spoiler: show
-
If you want to check for a number in the interval between 4 and 6 included use x>=4 && x<=6. If you are looking for a number that is either smaller than 4 or bigger than 6 then use x<4 || x>6 as condition. Here && is a logical AND, which means that both sides have to be true for the entire thing to be true, whereas "||" is a logical OR, which means that at least one side has to be true for the entire thing to be true.
Please note that chaining operators like this: 5>4>3 does not work how you might expect. While it is correct math-wise, it results in πππππ in Javascript. Explanation:
- Spoiler: show
-
These are the steps how javascript calculates 5>4>3
4. Password prompts (Strings and Prompt-actions)
You might have guessed by now that, besides numbers and booleans, there is another data type for text. However, this one is traditionally called a "string". (Think: String of characters)
Strings are marked by quotation marks in JavaScript code and, of course, strings can also be compared.
String comparisons can come into play when you use prompt-actions to let the user enter a string. This string gets stored in the variable, the name of which is supplied to the prompt-action.
Handling user input is, however, not a trivial task and one of the next parts of the tutorial will be dedicated to this entirely.
As a sneak peek, let us have a look at asking for a password. It is one of the cases where not much can go wrong:

- string_password_combined.png (100.95 KiB) Viewed 63929 times
As you can see, you can have multiple passwords that lead to different pages. If an if-action's condition is not true, then it gets skipped. There is no need to put any actions in the Else-queue. Just let it fall to the next one. If none of the ifs bite, then the user gets to try entering a password again.
Please note that string comparisons are case sensitive, i.e. the expression "Swordfish"=="swordfish" evaluates to false.
To get around that use pwinput.toLowerCase()=="swordfish", which will result in true if it was entered with an uppercase letter.
-----
Sorry for the delay, but not only have the last weeks been crazy, this was also the hardest part to write yet.
I have been constantly restructuring chapters (effectively working on several parts at once) and had to constantly remind myself to keep it simple.
I am however satisfied with how it turned out. I guess it still does not contain what some of you are waiting for, but I want to build this from the ground up and I will eventually get to that.
As always, any kind of feedback is welcome!