Results 1 to 7 of 7

Thread: hi help with my ftwait procedure

  1. #1
    Join Date
    Jan 2007
    Posts
    268
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default hi help with my ftwait procedure

    Hi i did my own ftwait procedure which i did because i needed in my script.
    but it doesnt seem to work. what did i do wrong? can anyone help?
    SCAR Code:
    function myftwait: integer;
    var
      t, i: Integer;
    begin
      for t := 1 to Time do
        begin
          Wait(1000);
            for i := 1 to 2 do
              begin
                case i of
                  1: Result := FindTalk;
                  2: Result := HandleFight;
                end;
              end;
        end;
    end;

    the goal of that is to wait 1 second and do findtalk and handle fight. it does findtalk and handle fight evry sec

  2. #2
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you put the / on the wrong place

    [/scar]
    not [scar/]

    ill edit if i found whats wrong.

    SCAR Code:
    Function MyFTWait: Integer;
    var
    t, i: Integer;
    begin
    for t := 1 to Time do
    begin
    Wait(1000);
    for i := 1 to 2 do
    begin
    case i of
    1: Result := FindTalk;
    2: Result := HandleFight;
    end;
    end;
    end;
    end;

    i don't fully get what you where trying to do. but what i did get , was that you try to result something. you can't make a result when its a procedure. so i made a function form it

  3. #3
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Yeah I'm not sure either.

    Maybe something like this?
    SCAR Code:
    Procedure MyFTWait(Time: Integer);
    var
      StartTime, FinishTime: Integer;
    begin
      StartTime := GetSystemTime;
      FinishTime := StartTime + Time;
      repeat
        case random(2) of
          0 : Wait(100);  //you could make these bigger
          1 : Wait(120);  //or smaller if you needed to
        end;
        FindTalk;
        HandleFight;
      until (GetSystemTime >= FinishTime)
    end;

  4. #4
    Join Date
    Jan 2007
    Posts
    268
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice but why did u put
    finishtime := starttime + time
    and not
    finishtime := time

  5. #5
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    because the finish time has to be TIME number of milliseconds after the starttime

    for example if the current sys time is 85105328 and you want to wait 1 second(so TIME would equal 1000 ms) it would need to finish when the sys time is at 85106328 and not when it's at 1000 =]


  6. #6
    Join Date
    Jan 2007
    Posts
    268
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yea still u could use finishtime := time

    ?

  7. #7
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    no.

    but you could do:
    SCAR Code:
    Procedure MyFTWait(Time: Integer);
    var
      StartTime: Integer;
    begin
      MarkTime(StartTime);
      repeat
        case random(2) of
          0 : Wait(100);  //you could make these bigger
          1 : Wait(120);  //or smaller if you needed to
        end;
        FindTalk;
        HandleFight;
      until (TimeFromMark(StartTime) >= Time)
    end;

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FTWait problem
    By weequ in forum OSR Help
    Replies: 3
    Last Post: 02-20-2008, 02:02 AM
  2. Procedure TypeSendRandom & Procedure AutoResponder!
    By Ultra in forum Research & Development Lounge
    Replies: 12
    Last Post: 01-08-2008, 07:04 PM
  3. Replies: 8
    Last Post: 05-24-2007, 11:57 PM
  4. Procedure that calls random procedure?
    By Secet in forum OSR Help
    Replies: 2
    Last Post: 03-03-2007, 03:56 PM

Posting Permissions

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