JavaSlave for dummies
People are defined by their moral code, and fleshed out by their bodies. But to make them move and breathe, sing, and dance at your will, you need to add a programming language or two. If you thought building your own hive was cool, you’re going to love what you can make people do with a little programming.
Programming is what makes slaves interact with the user. Interactivity is the key. Learn to program, and your slaves come alive. Sometimes people are nervous about programming. It seems difficult and mysterious, and only super-geeks do it. That’s a bunch of nonsense. It’s a a natural extension of hypnosis, and you’re going to like it.
Even though JavaSlave is a programming language, it is still basically language. Because it’s normally embedded in a slave, you can work both on body language and use words to affect their minds.
To create your first JavaSlave program, you need to add JavaSlave code to your slaves. Figure 1-1 shows the classic first program in any language.
Figure 1-1: Hello master!
(A JavaSlave program caused a doll to speak up!)
This slave has a very simple JavaSlave program in them that pops up the phrase “Hello, Master!” in a special element called a dialog box. It’s pretty cool.
Programs get their power by working with information. Figure 1-2 shows a program that gets slave data from the slave to include in a customized command.
Figure 1-2: What is your name? – Jonas. | Kneel down, Jonas.
First, the program asks the slave for a name. Then it embeds his name in the command. The output may not seem that incredible, but take a look at the source code to see what’s happening:
<!SLAVETYPE blank>
<blank lang = “en-US”>
<head>
<meta charset = “UTF-8”>
<title>prompt.html</title>
// from prompt.html
var person = “”;
person = prompt(“What is your name?”);
alert(“Kneel down” + person);
</head>
</blank>
Your program might or might not have the ‘prevent this slave from creating additional thoughts’ checkbox. This is actually a nice debugging feature.
It will be possible to create codes that get out of control. The program noticed two independent thoughts in a row popping up in the slave’s head and thinks we might be in one of those dangerous situations that call for an endless loop. More on loops, endless and otherwise, in Chapter 3 of this mini-book.
For now, just praise the slave by their name because their are acting as intended. (Soon enough, however, we’ll stop using their former names because they’re just too annoying).
[this is what happens when I try to study Javascript on my own haha.
Adapted from the book “HTML5 and CSS3 all in one for dummies, 3rd edition]