Advanced Features (Mission Script Dynamic) - reyandme/kam_remake GitHub Wiki

Advanced mission scripts features

Its possible to include other scripts into main script with

{$INCLUDE other.script} or {$I other.script} directive.

Included script also can have nested inclusion.

Also supported directives are:

{$DEFINE some_var} //Define some directive variable, that could be checked in IFDEF / IFNDEF directives

{$UNDEF some_var} //Undefine previously defined directive
{$IFDEF some_var} //Check if some_var was previously defined with DEFINE directive
...
//code to include if some_var is defined
...
{$ENDIF} //End of IFDEF directive block
{$IFNDEF some_var} //Check if some_var was not previously defined with DEFINE directive
...
//code to include if some_var is not defined
...
{$ELSE}  //otherwise
...
//code to include if some_var is defined
...
{$ENDIF} //End of IFNDEF block

Using procedural types

working example:

type TProcEvt = procedure;

procedure tst;
begin
  Actions.ShowMsg(-1, 'Tst');
end;

procedure TryCallbck(p: TProcEvt);
begin
  p();
end;

procedure OnMissionStart();
begin
  TryCallbck(@tst); // Use @ to call with a pointer to procedure tst
end;

script shows 'Tst' message