It is currently Thu Nov 26, 2020 7:03 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: SAIL Syntax - Everys
PostPosted: Mon Aug 14, 2006 9:27 pm 
Offline
OW Support Owner
OW Support Owner
User avatar

Joined: Wed Dec 28, 2005 11:13 pm
Posts: 5014
Location: UK, Scotland
Basic Everys
Everys are basicaly timers, every <INSERT TIME> seconds a every will execute its code as long as its enabled. Using them you can for example check areas of the map to see if any units are there.

Code:
Every 0$01 do
begin
// Insert Code
enabled; // We want to keep it going forever!
end;


Trigger Everys
Trigger everys are slightly different to the basic ones. The trigger ones only run the code between its begin and end when the trigger is true. The trigger is similer to an if then statement.

Code:
Every 0$01 trigger SomeVarible = 1 do
begin
// Insert Code
// Note we don't need an enabled; since this will keep its self alive
// until Somevarible = 1. Then this code will be ran and it will be disabled.
end;


Time
0$01 means 1 second. Anything after the $ is considered to be in seconds and anything b4 the $ is considered to be in minutes. i.e 11$34 is 11 minutes 34 seconds.

Marked Every's (By Tarivol)
If you want to remotely disable or enable multiple every's one at time or multiple times, you can MARK them. Here's what you have to write:
Code:
every 0$01 MARKED 01 do //the number after MARKED is the every's mark. It's like id for units.
begin
here goes the code
end;

Now, somewhere in the code:
Disable(01);
or
Enable(01);


Now, a few words about marks: you can give only integer marks, like 01, 22 or other. You cannot write any words. Use the marked every's when you have multiple every's which cannot run at one time, for example:
Code:
every 0$01 MARKED 01 do
begin
fav_fruit:=apple;
end;

every 0$01 MARKED 02 do
begin
fav_fruit:=banana;
end;

Starting
Begin
Disable(01);
Disable(02);
//Now, I don't like fruits
Enable(01);
//Now I like apples
fav_fruit:=strawberry;
//Now I STILL like apples
Disable(01);
Enable(02);
//Now I like bananas
Disable(02);
fav_fruit:=strawwberry;
//Now I like strawberry ;]
End;

_________________
Image
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Last edited by stucuk on Mon Oct 30, 2006 10:24 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 14, 2006 9:48 pm 
Offline
Original-War.Net Owner
Original-War.Net Owner
User avatar

Joined: Sun Jan 01, 2006 4:56 pm
Posts: 419
Location: Eastern Europe
Podstawy używania Every
Every jest stosowane w przypadkach kiedy chcesz aby skrypt powtarzal wyznaczona akcje co jakis czas. Mozna to zastosowac np. do wykrywania czy jakies jednostki dotarly do pewnego punktu na mapie.

Code:
Every 0$01 do
begin
// Tutaj twoj kod
enabled; // Chcemy zeby funkcja sie powtarzala zawsze
end;


Kondycjonalne Every
Te sa troche inne od ich podstawowych odpowiednikow w tym ze beda dzialac dopoki pewien warunek jest spelniony.
Code:
Every 0$01 trigger JakasZmienna = 1 do
begin
// Tutaj twoj kod
// Ta struktura zadziala dopiero kiedy JakasZmienna = 1
end;


Jednostka czasowa
0$01 oznacza 1 sekunde. Liczby po $ sa rozumiane jako sekundy. Liczby przed $ sa minutami, np. 11$34 to 11 minut 34 sekundy.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 6:44 pm 
Offline
OW Support Owner
OW Support Owner
User avatar

Joined: Wed Dec 28, 2005 11:13 pm
Posts: 5014
Location: UK, Scotland
Examples

Code:
Function Test;
begin

Result := 0;

if MyVarible then
if MySecondVarible then
Result := True;

end;

Every 0$01 trigger Test do
begin
// Insert Code
end;


Code:
Starting
begin
// blah, blah, blah
end;

every 0$01 do
begin
 If IsInArea (blah1, blah2) then
  begin;
//   SOmethin-
  end
 else
  Enable;
end;


Code:
Starting
begin
// blah, blah, blah
end;

every 0$01 trigger IsInArea (blah1, blah2) do
begin
//   SOmethin-
end;

_________________
Image
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 30, 2006 10:25 am 
Offline
OW Support Owner
OW Support Owner
User avatar

Joined: Wed Dec 28, 2005 11:13 pm
Posts: 5014
Location: UK, Scotland
Updated with Tarivol's Marked Everys.

_________________
Image
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 8:07 pm 
Offline
Soldier level 4
Soldier level 4
User avatar

Joined: Wed Nov 01, 2006 2:04 pm
Posts: 392
Location: Poland, Wrocław
Is that right that it's the same:

Code:
every 0$1 trigger isok(someone)=0 do
 begin
 end;

Code:
every 0$1 trigger not isok(someone) do
 begin
 end;


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 12:30 am 
Offline
Moderator
Moderator
User avatar

Joined: Fri Jan 13, 2006 6:20 pm
Posts: 2325
Location: Argentina
Yes, its correct.

_________________
-Aleph.

THE Very active person

"You can only do well at something if you put the time in. Doesn't matter what subject it is. You can't make a master piece over night."
Wise man Stu-


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 11:13 am 
Offline
Original-War.Net Owner
Original-War.Net Owner
User avatar

Joined: Wed Jan 25, 2006 10:21 am
Posts: 2786
Location: Poland, Białystok
There are many different ways which provide the same effect.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Original War is an RTS / RPG game by Altar Games
Original War Support is not part of Altar Games but is maintaining Original War for Altar Games

Privacy Policy