Author Topic: Explain AppOnIdle timers please  (Read 818 times)

0 Members and 1 Guest are viewing this topic.

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Explain AppOnIdle timers please
« on: January 04, 2008, 12:51:11 am »
Could somebody please explain how to make timers using AppOnIdle, As seen at www.enesce.com/help, I do not understand exactly how to do them.

Thanks in advance  ???
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline KwS Pall

  • Major(1)
  • Posts: 49
  • I'm going to write Tibia for Soldat
Re: Explain AppOnIdle timers please
« Reply #1 on: January 04, 2008, 03:59:44 am »
AppOnIdle is called every second, if you want to regenerate health like in Avkon's Warmth you put there a loop for healing.

at enesce.com is shown how to do commands every x seconds/minutes/hours...
I'm going to write Tibia for Soldat

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Explain AppOnIdle timers please
« Reply #2 on: January 04, 2008, 04:09:00 am »
Another kind of "timer" would be to count down a certain amount of seconds. For example:

Code: [Select]
var
timer: integer;

procedure AppOnIdle(Ticks: integer);
begin
if timer > 0 then begin
timer := timer - 1;
if timer = 0 then
WriteLn('Woo yay 2 minutes has passed');
end;
end;

function OnCommand(ID: Byte; Text: string): boolean;
begin
if LowerCase(GetPiece(Text,' ',0)) = '/countdown' then
timer := 120;
end;

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: Explain AppOnIdle timers please
« Reply #3 on: January 12, 2008, 09:39:18 pm »
Thanks toumaz, i understand now.

Sry for the slow response, my computer was being fixed
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs