Author Topic: How does the AppOnIdleTimer work?  (Read 548 times)

0 Members and 1 Guest are viewing this topic.

Offline Nedi

  • Major(1)
  • Posts: 47
How does the AppOnIdleTimer work?
« 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
« Last Edit: May 15, 2013, 02:03:29 pm by Nedi »

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: How does the AppOnIdleTimer work?
« Reply #1 on: May 15, 2013, 02:07:01 pm »
it doesn't have to be -safe 0 since 2.7.4 (current rc release)
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.