Here is the picture of the dream that we will be referring to for this Tutorial. This dream can be downloaded at the bottom of this page.
The picture above shows three main things of interest. Coincidentally, those three things will be the object that we will toggle. The first are the logs in the fireplace, the second are the candles by the fireplace, and the final topic we'll discuss are the pillows.
Before we get to the DragonSpeak for this, however, let's take a look at the objects and decide the best way we can implement to change these objects.
1) The log/fire objects are objects that you cannot walk on. For that reason, the best way to go about toggling the fire on and off would be to bump into the object. We'll find that it's a pretty easy bit of DragonSpeak to code.
2) For the candles and the pillows, however, you can walk on them. Because of this, the best way to go about toggling them would be instead to make the furre press F3 while on the object (and holding nothing in their paws) to change it.
For both cases, the DragonSpeak will work no matter where you place the objects in the dream. This means you can place down another fire object or candle in your dream and not have to worry about adding more DragonSpeak to handle them. Now, on to the DragonSpeak!
Making the fires toggle back and forth will be pretty easy. In fact, it'll only take 6 lines of DragonSpeak. The two objects we'll be dealing with are #79 (pile of logs) and #407 (burning pile of logs). We're going to switch back and forth between these two objects whenever you bump into one of them. The DragonSpeak to do this is below.
(0:3) When somebody moves into object type 79,
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 407.
|
(0:3) When somebody moves into object type 407,
|
|
(3:6) where the triggering furre moved into,
|
|
(5:4) place object type 79.
|
Placing this in your DragonSpeak file makes it so no matter where you are in the map, if you bump into a pile of logs, it'll start the fire, and if you bump into a burning pile of logs, it'll put the fire out. Pretty neat, huh? The theory behind the DragonSpeak is also pretty simple. It checks to see what kind of object you moved into. If you moved into one of the piles of log objects, it places the opposite version in the spot you moved into.
Candles can be a bit more tricky. Whether you want to have candles toggling when you walk on top of them, instead of when you press F3 while standing on top of them, is completely up to you. For the sake of this tutorial, however, I will explain the candles using the F3 version. However, you'll see it done either way in dreams.
(0:19) When somebody uses object type 0,
|
(1:18) and they (moved from/are standing at) object type 383,
|
|
(3:5) where the triggering furre (moved from/is standing at),
|
|
(5:4) place object type 384.
|
(0:19) When somebody uses object type 0,
|
(1:18) and they (moved from/are standing at) object type 384,
|
|
(3:5) where the triggering furre (moved from/is standing at),
|
|
(5:4) place object type 383.
|
These two blocks of code are activated when you use object type 0 (pressing F3 while holding nothing). The DragonSpeak then checks to see if you're standing on one of the candle objects, and if you are, it places the opposite candle object down. This results in you light/exinguishing the candle by pressing F3. As you can see, this takes an additional 2 lines of DragonSpeak to implement, but it does add a bit more realism to the effect. If you did it in the same way that we did the fire DragonSpeak, you could be walking around in a room and accidentally start turning on/off candles.
The final example in this tutorial is based around the idea of toggling between more than one object. Say, for instance, that you want to toggle between four different pillows when you pressed F3 while sitting on one of them. DragonSpeak allows you to do this quite easily. Below is the DragonSpeak used to toggle between red, yellow, green and blue pillows. I'll explain the DragonSpeak afterward.
(0:19) When somebody uses object type 0,
|
(1:18) and they (moved from/are standing at) object type 16,
|
|
(3:5) where the triggering furre (moved from/is standing at),
|
|
(5:4) place object type 5.
|
(0:19) When somebody uses object type 0,
|
(1:18) and they (moved from/are standing at) object type 5,
|
|
(3:5) where the triggering furre (moved from/is standing at),
|
|
(5:4) place object type 1.
|
(0:19) When somebody uses object type 0,
|
(1:18) and they (moved from/are standing at) object type 1,
|
|
(3:5) where the triggering furre (moved from/is standing at),
|
|
(5:4) place object type 15.
|
(0:19) When somebody uses object type 0,
|
(1:18) and they (moved from/are standing at) object type 15,
|
|
(3:5) where the triggering furre (moved from/is standing at),
|
|
(5:4) place object type 16.
|
Like the candles, this DragonSpeak is triggered by using object type 0 (pressing F3 while holding nothing). If you're sitting on a red pillow when you do this (Object #1), it'll change it to a yellow pillow (Object #15). If you're sitting on a yellow pillow when you do this (Object #15), it'll change it to a green pillow (Object #16). Green pillows change to blue pillows (Object #5), and blue pillows change back to red pillows. The cool thing about this bit of DragonSpeak is that you could edit it for all of the pillow objects, and then people will never fight over a certain color pillow in your dream again. (Think of how handy that would have been if they put it on the main maps!)
Toggling is a very handy DragonSpeak tool, and it isn't that hard of an idea to grasp. Once you understand how to toggle objects, you'll probably always be using it in your dreams. Pretty much every dream I've ever been in has some sort of object that the owner has toggling (usually fires, or tables with food). You can download a copy of this dream from the link below. If that doesn't help, you can always e-mail us at the e-mail address at the bottom of this page. Good luck!
TutorialToggling.zip
|