Results 1 to 4 of 4

Thread: Need help using a timer

  1. #1
    Join Date
    Jun 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Need help using a timer

    Ok So basically I have for example 5 procedures and my script looks like

    Code:
    Procedure MainLoop;
    Begin
    procedure1;
    proecedure2;
    procedure3;
    end;
    
    Begin
    Repeat
    MainLoop;
    until (IsKeyDown(114));
    End.
    in the last area where it has begin mainloop, I need a timer so every 2 minutes itll call another procedure, then once completed it continues back to the repeat of mainloop, then in another 2minutes it repeats.

    I also want to change the until iskeydown 114 (F3) so whenever f3 is pressed it stops the script immidiately where its at.

  2. #2
    Join Date
    Jul 2012
    Posts
    437
    Mentioned
    10 Post(s)
    Quoted
    165 Post(s)

    Default

    unless you want to use a ttimer try something like below
    it won't be exactly two minutes but as long as you don't get stuck in your mainloop it should be close enough

    Simba Code:
    var
    time:longint; //global variable

    procedure twominproc;
    begin
     //code
    time:=GetSystemTime;//resets your timer
    end;          

    Procedure MainLoop;
    Begin
    procedure1;
    proecedure2;
    procedure3;
    end;

    Begin
    time:=GetSystemTime;  
    Repeat
    MainLoop;
    if(GetSystemTime-time>120000) then  //120000ms=120 seconds=2 minutes
    twominproc;
    until (IsKeyDown(114));
    End.

  3. #3
    Join Date
    Jun 2012
    Posts
    66
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    so I want to honestly make it a 6hour refresh changing the MS to = 6hour wont change anything will it? just change it accordingly. I want 2 mins to test how it refreshes (browser game with 6 hour close) so itll just refresh browser and reclick my world.

  4. #4
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

    Default

    You could use MarkTime(t:Integer). It basically sets a checkpoint, and you can call TimeFromMark(t:Integer):Boolean, to see when it passes 6 hours.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •