B. Creating Compact Code
Let's first address the idea of creating compact code by looking at the example of using switches in your dream. Switches, in case you didn't know, are objects 161 through 164. There are two types of switches, and each type has an "on" and "off" state. Well, speaking for myself, if I ever put a switch in one of my dreams, it generally means that I intend to have furres "bump" into that switch in order to make it change to the opposite state (from "on" to "off", or from "off" to "on").
This can be done in 6 lines of code: "Whenever anyone moves into object type 161, where the triggering furre moved into, place object type 162." and "Whenever anyone moves into object type 162, where the triggering furre moved into, place object type 161." All you have to do is place that code somewhere at the bottom of my DragonSpeak file, and I'm good to go for toggling on/off all 161 and 162 switches. Now I can put down as many of these switches as I like in my dream and only have to worry about coding the actual "locking" part of the switch. Let me show you an example of a good and bad way to do these switches.
* Lock 1.
|
(0:7) When somebody moves into position (30,30),
|
(1:1013) and position (30,30) is object type 162,
|
|
(3:2) at position (32,32) on the map,
|
|
(5:4) place object type 394.
|
(0:7) When somebody moves into position (30,30),
|
(1:1013) and position (30,30) is object type 161,
|
|
(3:2) at position (32,32) on the map,
|
|
(5:4) place object type 393.
|
* Lock 2.
|
(0:7) When somebody moves into position (40,40),
|
(1:1013) and position (40,40) is object type 162,
|
|
(3:2) at position (42,42) on the map,
|
|
(5:4) place object type 394.
|
(0:7) When somebody moves into position (40,40),
|
(1:1013) and position (40,40) is object type 161,
|
|
(3:2) at position (42,42) on the map,
|
|
(5:4) place object type 393.
|
* Toggles on/off switches 161 and 162.
|
(0:3) When somebody moves into object type 161,
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 162.
|
(0:3) When somebody moves into object type 162,
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 161.
|
This is a good example of how you can do locks with switches in your dream. Notice how both of the locks check to see what state the switch is in, but neither of them actually change the state. The state is changed later on by a script that works for all objects 161 and 162, so it saves you the hassle of having to change the switch in each of the individual lock codes. Below is a less efficient example of how to do the same two locks.
* Lock 1.
|
(0:7) When somebody moves into position (30,30),
|
(1:1013) and position (30,30) is object type 162,
|
|
(3:2) at position (32,32) on the map,
|
|
(5:4) place object type 394.
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 161.
|
(0:7) When somebody moves into position (30,30),
|
(1:1013) and position (30,30) is object type 161,
|
|
(3:2) at position (32,32) on the map,
|
|
(5:4) place object type 393.
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 162.
|
* Lock 1.
|
(0:7) When somebody moves into position (40,40),
|
(1:1013) and position (40,40) is object type 162,
|
|
(3:2) at position (42,42) on the map,
|
|
(5:4) place object type 394.
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 161.
|
(0:7) When somebody moves into position (40,40),
|
(1:1013) and position (40,40) is object type 161,
|
|
(3:2) at position (42,42) on the map,
|
|
(5:4) place object type 393.
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 162.
|
As you can see with two locks, you're saving 2 lines of DragonSpeak by doing it the good way. Think how that would add up if you had more. Here is a break down of how the two ways use up your DragonSpeak lines:
The Good Way:
- 8 Lines for every lock + 6 lines of Dragonspeak for the switch toggling
- Or: 8 * NumLocks + 6
The Bad Way:
- 12 Lines for every lock
- Or: 12 * NumLocks
Here's a table of how much DragonSpeak you'd use for up to 10 locks in your dream:
|
# Locks |
Good Way |
Bad Way |
1 |
14 |
12 |
2 |
22 |
24 |
3 |
30 |
36 |
4 |
38 |
48 |
5 |
46 |
60 |
6 |
54 |
72 |
7 |
62 |
84 |
8 |
70 |
96 |
9 |
78 |
108 |
10 |
86 |
120 |
As you can see from the table, if you use a lot of locks in your dream the good way of doing locks will save you some of those precious lines of DragonSpeak we Dream Weavers like to preserve.
Remember: If you have a lot of the same type of Effect happening in your dream, then the best thing you can do (in terms of saving DragonSpeak lines) is to try to combine all of those similar Effects into a single block of code. As you can see, with the exception of only having one lock in your dream, doing it the good way will save you many DragonSpeak lines.
[ BACK TO THE TOP ]
|