Using Timers

Before the Gryffe update occured, one of the scariest ideas for furres when it came to DragonSpeak was the idea of using timers in your dream. There are two different types of timers that you can use in your DragonSpeak, and each of these timers have characteristics that make one more suitable than the other depending on the situation. This tutorial will introduce you to the two types of timers and show you two examples on how to use them.

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.

For this tutorial, we're bringing back the gray pillars. Our timers will make these pillars "rise" and "fall". The objects we'll be using are objects #393 (the tall pillar) and object #394 (the short pillar). The rainbow tile will be used in the countdown timer example. It is there mainly just to remind you where you need to step to activate the countdown timer. Let's go straight to the DragonSpeak.


We're going to start with the "When # seconds have passed, offset by #" DragonSpeak Cause. This cause is mainly used in animations and to toggle objects. The first # in the line represents how many seconds you want to wait before the timer activates again (ex. if you set it to 10, the timer will go off every 10 seconds). The second # represents how many seconds you want to wait before the timer activates for the very first time (ex. if you set it to 60, the timer will wait a full minute before it goes off for the very first time. So, if you set the first number to 10 and the second number to 60, the timer will wait a full minute before the it goes off for the very first time, and then it will start going off every 10 seconds. Below is the DragonSpeak to animate the two gray pillars that are next to each other.

(0:100) When 2 seconds have passed, offset by 0,
(3:2) at position (10,16) on the map,
(5:6) swap object types 393 and 394.
(0:100) When 2 seconds have passed, offset by 1,
(3:2) at position (12,15) on the map,
(5:6) swap object types 394 and 393.

The code looks identical, right? Well, it almost is. Everything about the two blocks of code is the same with the exception of the offset. One waits 1 second after the dream is loaded before the first timer goes off, whereas the top block of code does not wait at all. What does this mean? It means that neither of these two timers will ever happen at the exact same time. They both wait 2 seconds before repeating, but the first timer went off immediately when the dream was loaded, while the second timer had to wait 1 second first.

Making sure your timers don't go off at the same time is essential in animating the gray pillars. If they both when off at the same time, no change would happen. The object would be simultaneously swapped twice, resulting in no animation at all!

Another source of confusion with doing animations is understanding the concept of the "(5:6) swap object types 393 and 394" line. Whenever this line is triggered by a cause, it will swap one of the objects for the other. After it swaps one of the objects for the other, it will swap them once more back to their original state. This means that the animation will be continous or ongoing forever. It is a good rule of thumb to leave at least 1 second between swapping objects so that the animation does not lag visitors with slower computers in your dream.


The second example deals with countdown timers. Here isthe DragonSpeak, with the following explanation.

(0:7) When somebody moves into position (16,13),
(5:50) set countdown timer 1 to go off in 5 seconds.
(0:50) When countdown timer 1 goes off,
(3:2) at position (16,12) on the map,
(5:6) swap object types 394 and 393.

The countdown timer is activated when you move into position (16,13). This is the position that has the rainbow tile. When you step on this tile, you set the countdown timer to go off in five seconds. If you step on it again before the original five seconds is up, it'll set it back to five seconds again. When the countdown timer finally goes off, it toggles the gray pillar.

You can trigger countdown timers using any of the DragonSpeak Causes. Just remember that in order to set off a countdown timer, you must first use the "(5:50) set countdown timer 1 to go off in 5 seconds." line before the "(0:50) When countdown timer 1 goes off," line. Countdown timers are unlike the offset timers mentioned above. They are set once and go off once, unless you code them to loop, whereas the offset timers are ongoing.


As you can see, timers aren't as scary as you may have originally thought. They take a bit of understanding, mainly the offset timer, but once you understand that idea, you can do a lot with them. Timers are used a lot in various types of animations. We have an animations tutorial that you can read for more information here. 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!

TutorialTimers.zip

Contact Us

Do you have a question that you couldn't find the answer to? Is there a tutorial that you'd like to see added to the MKb? If so, drop us an e-mail. The MKb is created for the Furcadian public, so in order to be effective, we need to know what information you want it to contain. If e-mail links don't work for you, just send us an e-mail at masons@furcadia.com. We look forward to hearing from you.


[ Back to DragonSpeak Tutorials ]

This page, subsequent pages and all content therein, unless otherwise stated is copyright © Dragon's Eye Productions. Site maintained by The Beekin Scribes.