Goto http://www.stucuk.netGoto http://www.atlanticaonlinewiki.comGoto http://www.game-requirements.com

Counters

From Original War Support Wiki

Jump to: navigation, search

Tutorials -> Counters

Tutorial By: Radzio
Website: http://tos.owsupport.com


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.

Introduction

Step 1:
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.

Step 2:
Look into extracted file. This is a part of it (english version):

 Am06-1 
   Crates to collect: %d 
 
 Am06-2 
   Remaining time: %t 


Step 3:
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.

Step 4:
Use correct value type in text of counter.
%d is used for numerical values
%t is used for time values

Step 5:
Add counters to the mission. It's the simplest step. Just add this to the code:

 display_strings=['#identifier',value];

You can also display more than one string.

 display_strings=['#identifier',value,'#identifier2',value2];

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.

Multiple values

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];

Colors

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.

Example
in Counters.wri:

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];
Personal tools
Clanbase