DragonSpeak 102
Triggering Events
Event triggering is simple. It means
"when this happens, do this."
Triggers Using Objects Every map requires some DragonSpeak in order to work properly. Each time you save a new map, the Dream Editor checks for the default bit of DS which tells Furcadia where to place a furre on the map when they enter a dream. If it does not find it, it saves these two lines with that map: (0:9) When a furre arrives in the dream,
This places the arriving furre somewhere close to the upper left corner of your map. You could, of course, change the (x,y) coordinates and have them land anywhere you like. Now suppose you would like furres to be able to return to the entry point from anywhere in the dream. Let's set up a simple trigger to transport furres back to the entry point. (0:19) When somebody uses object type
0,
Now there's a bit of chicanery going on here, it seems. Look at that first line. When a furre uses object type 0... This means when a furre is holding nothing and yet hits F3 (or control-U), the script will teleport them back to the starting point of the dream. You see this feature in quite a few dreams and main maps and it is handy in case a furre gets stuck in a spot and needs a way out. Let's try a different sort of trigger, one that will work a switch. (0:3) When somebody moves into object
type 162,
Now anytime a furre runs into switch 162 or 161, the switch will change. The switch doesn't actually control anything yet, but it does change when someone moves into it. We will reuse this code in later examples such as building locks, but for now it is an example of how to trigger one object to change into another object. Want an egg that changes into a bird? Change the numbers (161 and 162) to 59 (egg) and 256 (scarhawk.) This code has one problem - bumping into a switch anywhere on the map will change every switch on the map. Let's fix that now. Triggers Using Location Suppose you want a furre to be able to walk into a switch and operate it, but you do not want every switch on the map to change. Here we need to specify the location of the switch in order to change only that particular one. We can use a location trigger for this purpose. (0:7) When somebody moves into position
(#,#),
On your map place a switch at location x,y. Next fill in the x,y location of your switch where the # signs are. Presto! You have a switch which will change only when someone bumps into it. Triggers Using Floor Tiles So far we have been triggering events by moving into objects or using them. But there are other ways to trigger things to happen, such as using floor tiles. Let's try one. (0:2) When somebody moves into floor
type 147,
This script will cause the purring sound to be played anytime a furre steps on an orange floor tile. You could use any sound, of course. Some dream makers use this code to play water splashing sounds whever a furre moves onto a water tile. Just change the numbers and you're set! There. We've covered many of the simple
trigger concepts you can use to cause events in a dream. There are others
to explore, such as doing something when a furre moves, picking up and
dropping objects, or using timers. Go play with what you have learned and
when you are ready, move on to the next section by clicking NEXT below.
|