Alright, this is my first article...But I believe it is one of the most important ones. This isn't for advanced clickers, as I'm sure they already fully know the event editor. However, for newbie clickers, especially ones that have never even touched a programming language, this could help solve a LOT of problems they've been having.

Have you ever created a game, put in all the conditions in the event editor, but then, for some reason, things didn't do what they should have? If you aren't experienced in the event editor, chances are it has to do with how you set up the event editor.

Let's put this in perspective. If you were to do ten different tasks assigned on a list, you would go through them one by one until you were finished, wouldn't you? That's just what the event editor does. Every event is completed after all the events above it have been.

Let's start simple. We'll take a counter. Let's say you want the counter to count up to 5, then restart back to 0. If you put in the event editor:

Always: Add 1 to counter 1
If counter 1 = 5: set counter 1 to 0

you would get a counter that goes from 0 to 4, then back to zero. Why? Well, the event editor updates all(with a few exceptions) variables within it's event. Let's say the counter displays 4 right now:

//counter 1 = 4
Always: Add 1 to counter 1
//counter 1 = 5
If counter 1 = 5: set counter 1 to 0
//counter 1 = 0
//--This is the end of all commands, so the screen updates right now.

As a result, you will end up with zero. To fix this, you could either just make the counter go up to 6, or you could change around the events.

//counter 1 = 4
If counter 1 = 5: set counter 1 to 0
//counter 1 still equals 4
Always: Add 1 to counter 1
//counter 1 = 5
//--Screen update

Now the screen will show 5. On the next loop, it will switch back to 0, as the program now registers counter 1 as 5.
Note: This will be a VERY fast loop, so you probably coudn't even tell the counter wasn't reaching your number.



The best example I can think of where this comes in VERY handy is when you want an object to change to a new animation every time another one finishes. I didn't start with this, because it brings in a new concept: conditional updates vs. loop updates.

Let's say you put a guy in a game, and you want him to cycle through three(non-looped) animations: walking, jogging, and running.

Now, if you don't know the event editor, you would be rational and put it like this.

If animation walking is over: change animation to jogging
If animation jogging is over: change animation to running

Upon running your game, you will find that after the walking event finishes, the guy will start running. Why? This brings up the loop variables. These variables aren't updated until the screen refreshes. Thus, they do NOT change when encountered by an event. Oddly enough, CNC(and perhaps MMF, too) doesn't reset the frame count when an animation change is made in a condition. Why? Because the frame number is a screen condition...The game only checks the very when the screen updates. So animtion over is set at the start of the loop, and won't change until the end. Thus, the program will run BOTH events in the same run!

//animation is at last frame
If animation walking is over: change animation to jogging
//animation changed to jogging
//animation is STILL considered on last frame
If animation jogging is over: change animation to running
//the program says that jogging is playing, and that the object is on its last frame, so it RUNS this event!

When the screen updates, it will move back to the first frame, and you will end up with a running person. Just move the events around to solve this:

//last frame; walking
If animation jogging is over: change animation to running
//last frame; walking
If animation walking is over: change animation to jogging
//last frame; jogging

Now the person will run through the jogging animation before starting to run. On the next screen update, the program will set the frame number to 0(this is really frame 1 when looked at in the animation editor), so you don't have to worry about him running when he isn't supposed to!


Finally, I will talk about actions within a condition. CNC runs through all actions in a condition in the same way it runs through the conditions itself: in order. The order is determined by the order you select the actions in(it does NOT run from left to right). There are two examples I can think of where the order of actions are vital: assigning a variable to a new object, and copying.

To see the order in which actions are performed, right click on the event number, and selct edit the actions. This will show you the order, and you can simply move them around from here.

For assigning a value to a new object, MAKE SURE the object is created BEFORE the variable is assigned.

For text copying... What I mean is making one object take the value of another, while at the same time changing the value of the first. I used this for simulated text scroll. Let's you have two text objects. One says Ether and the other says Potion. Let's say these names come from an external ini, so you don't know what they say. To scroll, we want to copy the value of one into the other. Let's say we want Ether to now be Potion and Potion to now be Herb.

Put it in this order.
Set string text object 1: string text object 2
//This sets Ether to Potion
Set string text object 2: Herb
//This sets Potion to Herb

I left out that I'm retrieving from an ini, because it would probably confuse most newbie clickers. If you put these in the wrong order, it would set both texts to Herb, which you don't want to do.

Sorry this was so long, but you really MUST learn about the event editor if you want to get advanced games working. Thank you for your time. -_^

~Realm