From Original War Support Wiki
Tutorials -> Counters
Tutorial By: Radzio
How can I add counters to the mission?
Where I should put the text for them?
I'll try to answer these questions in my tutorial.
Extract file Texts/Counters.wri (or Texts/#LNG/Counters.wri [where LNG is a short form of your language name]) to your mod's directory.
Look into extracted file. This is a part of it (english version):
Am06-1 Crates to collect: %d Am06-2 Remaining time: %t
Add your own text. Example:
identifier You will win a car in %t minutes.
Identifier is an identifier which you will use in SAIL.
Remember: First and last line have to be empty. Lines between every counter also have to be empty.
Use correct value type in text of counter.
%d is used for numerical values
%t is used for time values
Add counters to the mission. It's the simplest step. Just add this to the code:
You can also display more than one string.
Remember about ' ' and # before identifier.
Values can change.
//beginning of the code EXPORT timer_value; //somewhere in code every 0$1 do begin timer_value=timer_value+0$1; display_strings=['#identifier',timer_value]; enable; end;
Code above will add 1 to the value every second. You can also reduce values.
Note: I've added 0$1 because it's time value. For numerical values use 1.
A counter can consist of multiple values (both numerical and timer values). E.g. if we add this to Counters.wri
Am07-Count1 You have %t left to gather %d crates
In SAIL display_strings now need two inputs - the first a timer value, the second a numerical value.
display_strings = ['#Am07-Count1',3$19,50];
You can furthermore color the displayed text by adding %c to the text in Counters.wri. All text after %c will be colored in the defined color. This coloring also needs an input in display_strings - an integer from 0 to 8 corresponding to the colors of side 0 to 8. If the integer is anything else, the displayed text will not be colored.
Ru02-Count2 %cBeware! You have only %t left!
We want to color this warning red (like side 3). SAIL:
display_strings = ['#Ru02-Count2',3,0$31];