Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Nedi on May 15, 2013, 11:25:06 am

Title: How does the AppOnIdleTimer work?
Post by: Nedi on May 15, 2013, 11:25:06 am
Hi
Why doesn,t AppOnIdleTimer variable changing work? I have tested it with this:
Code: [Select]
var
start: boolean;

procedure ActivateServer();
begin
start := false;
end;

function OnPlayerCommand(ID: Byte; Text: string): boolean;
begin
if Text = '/1s' then begin
if start = false then begin
start := true;
WriteConsole(0, '1 changed to true', RGB(255,255,255));
end else begin
start := false;
WriteConsole(0, '1 changed to false', RGB(255,255,255));
end;
end;
if Text = '/1c' then begin
if AppOnIdleTimer = 120 then begin
AppOnIdleTimer := 60;
WriteConsole(0, '1 changed to 60', RGB(255,255,255));
end else begin
AppOnIdleTimer := 120;
WriteConsole(0, '1 changed to 120', RGB(255,255,255));
end;
end;
end;

procedure AppOnIdle(Ticks: integer);
begin
if start = true then WriteConsole(0, '1 apponidletimer: ' + IntToStr(AppOnIdleTimer) + ' ticks: ' + IntToStr(Ticks), RGB(255,255,255));
end;

When i typed '/1s' it started. Difference between ticks = 60 (default) and apponidletimer = 60
But when i typed '/1c' it should be changed. It didn't change :<. Difference between ticks = 60 (default) and apponidletimer = 120.
Why?

Thanks.


Delete please, I discovered it must be -safe 0
Title: Re: How does the AppOnIdleTimer work?
Post by: Falcon` on May 15, 2013, 02:07:01 pm
it doesn't have to be -safe 0 since 2.7.4 (current rc release)