Difference between revisions of "WML for Complete Beginners: Chapter 5"

From The Battle for Wesnoth Wiki
(Created page with '==Chapter 5: Events== Let's walk through an average morning. When your alarm clock goes off, you wake up. You go downstairs and put some bread in the toaster for breakfast. When…')
 
m
Line 22: Line 22:
  
 
====Objectives====
 
====Objectives====
 +
 +
[[Category:WML_for_Complete_Beginners]]

Revision as of 21:19, 6 April 2014

Chapter 5: Events

Let's walk through an average morning. When your alarm clock goes off, you wake up. You go downstairs and put some bread in the toaster for breakfast. When the toaster pops, you butter the toast and eat it. When you have eaten breakfast, you go outside and wait for the schoolbus to arrive. When the bus arrives, you get on it. When it stops at your destination, you get off of the bus.

Notice that you do everything “when” something else happens. These are all “events”. The alarm going off caused you to wake up. The toaster popping causes you to butter the toast and eat it. Finishing breakfast go outside. The bus stopping causes you to get on or off. These are all like events in WML.

The syntax for writing an event goes like this:

[event]
    name=name_of_the_event
    #do something
[event]

There are quite a few events available to you in WML. Of these, the most commonly used are the prestart event, the start event, and the moveto event.


Common Events

Now, I'm not going to supply you with an exhaustive list of every kind of predefined event and what each does, that's what the EventWML page is for. I will, however, provide you with a list of the most frequently used predefined events and what they do, since we will be using these events in our campaign scenarios later on.

(list these events: prestart, start, moveto, time over, die, last breath)


Objectives