From The Battle for Wesnoth Wiki
Revision as of 15:52, 28 June 2007 by Mathijs (talk | contribs) (Filters & Events)

Building scenarios: Advanced


This contained a repetition of what was already inside BuildingScenariosIntermediate This should contain:

  • (more) information about making & using preprocessors (PreprocessorRef)
  • information on guidelines concerning the general layout of a scenario file
  • advanced filtering
  • ...

Ayone who feels like writing something, go ahead

Filters & Events

When you are making campaigns, you will have to be able to control the game flow. This means you will need to interfere with the game if certain events arise. Examples:

  • There's a radioactive stone inside a cave. Units entering this cave (it has circular shape) lose 5HP and are poisoned. The cave is at tile (25,26) and has a radius of 8 tiles. This is the code that would achieve this:
    #A unit has moved, maybe it move inside the cave? Let's find out!
    #Here's our filter! Template:DevFeature see below for earlier version
    #We can use the variable $unit inside an event tag to change the
    #unit that triggered the action. See event internal actions. Inside a set_variable tag we can
    #adjust the values of some of the unit characteristisc, like it's hitpoints and it's status

    #After we have changed the values, we need to apply them.
    #We do this by using the unstore_unit tag like this:
  #We're finished!

GetText & Translations

As Viliam pointed out (reordered his words):

Translating programs has two steps. The first step is making [...] scenarios that are possible to translate; 
preferably easy to translate. [...] The second step is the translating of the texts... leave this to  translators.

So, as a campaign/scenario developer you have to make sure your campaign will be easy to translate. You can achieve this very easily by preceding all text the user might see on the screen with an underscore. This indicates it is a translatable string. GetText will then be able to look up a translation, based on your localisation settings. To make it ever more clear, here's an example:

  message= _ "I am mighty Konrad! I fought many dummies and now I will fight you!"

The message key contains the words that will be displayed when Konrad speaks. So this is a translatable string. So it is preceded with an underscore.

Viliam also said:

The most important rule of all is: Do not split sentences.
In some languages placing a word in a sentence requires more than mere string concatenation.
Some languages use declension.

Quick Tag Index

ScenarioWML the top level tags [scenario], [multiplayer], [test], and [tutorial]

See Also