Page 1 of 2 12 LastLast
Results 1 to 25 of 32

Thread: WaitUptext() and WaitOption()

  1. #1
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default WaitUptext() and WaitOption()

    i hate useless 100ms waiting, like
    mouse(x, y, 0, 0, false);
    wait(100+random(50));
    if ChooseOption('lol') then ...

    this is much better. alot can happen in 100ms and these functions also tolerate lagspikes
    SCAR Code:
    function WaitUptext(s: string; maxtime: integer): boolean;
    var
      t: integer;
    begin
      t := getsystemtime;
      repeat
        result := IsUptext(s);
        wait(1+random(10));
      until(result or ((getsystemtime - t) > maxtime));
    end;

    function WaitOption(s: string; maxtime:integer): boolean;
    var
      t: integer;
    begin
      t := getsystemtime;
      repeat
        result := OptionsExist([s]);
        wait(1+random(10));
      until(result or ((getsystemtime - t) > maxtime));
      ChooseOption(s);
    end;

    EDIT: added randomness to waits
    Last edited by marpis; 06-23-2009 at 03:15 AM.

  2. #2
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Add the random in the loops and they are the same as mine.
    ~Hermen

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Zeph and I were just talking about this...

    What does everyone else think?
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ehm, it is maybe to fast... there must be added randomness.
    + some wait after it, if wanted.
    ~Hermen

  5. #5
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I agree, most of scripts have this included and adding them to SRL would shorten lines.


  6. #6
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    function UpTextM(s: TStringArray): Boolean;
    var
      c: Integer;
    begin
      c := GetTimeRunning + 3000;
      while (c > GetTimeRunning) and not Result do
      begin
        Result := IsUpTextMultiCustom(s);
        Wait(20 + Random(40));
      end;
    end;

    function UpText(s: String): Boolean;
    begin
      Result := UpTextM([s]);
    end;

    Thats what I have.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    I agree that every script uses it, but it is so simple. It almost seems useless to add it because everyone would just use their own.
    Would be a useful addition though for some.

  8. #8
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    this was already brought up LOOOOONG ago. There was a function called UTWait.
    SCAR Code:
    function UTWait(Maxtime: LongInt; Text: TStringArray): Boolean;
    var
      Timer: LongInt;
    begin
      MarkTime(Timer);
      while (TimeFromMark(Timer) < (MaxTime + Random(55))) do
      begin
        if (IsUpTextMultiCustom(Text)) then
        begin
          Result := True;
          Exit;
        end;
        Wait(75 + Random(25));
      end;
      Exit;
    end;

  9. #9
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    They can add the wait in their own script if they want to.
    ~Hermen

  10. #10
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Zeph and I were just talking about this...

    What does everyone else think?
    I am guessing you and Zeph were thinking of including it, and I'd agree with that.

    Gj Marpis. Nice use of OptionsExit

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  11. #11
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    I agree with Hermen, people suited to the old method might not use this.
    Plus it has been suggested before and people have got round without it.

  12. #12
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    I agree with Hermen, people suited to the old method might not use this.
    Plus it has been suggested before and people have got round without it.
    This way is the best way. Much of srl is this way. just recently i changed functios in srl to use this way. this is the most efficient way. If my hunch is correct, this will be in very, very soon.

    ~RM
    Last edited by Sir R. M8gic1an; 06-21-2009 at 03:40 AM.

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  13. #13
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    This way is the best way. Much of ssrl is this way. just recently i changed functios in srl to use this way. this is the most efficient way. If my hunch is correct, this will be in very, very soon.

    ~RM
    Much of ssrl is this way?

    Of course I am entitled to an opinion. Tbh, I do not mind as I won't use it much. Your hunchs are always correct (mainly because you'r a dev )

  14. #14
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by NaumanAkhlaQ View Post
    Much of ssrl is this way?

    Of course I am entitled to an opinion. Tbh, I do not mind as I won't use it much. Your hunchs are always correct (mainly because you'r a dev )
    i actually meant srl, as you can see by the context.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  15. #15
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    i actually meant srl, as you can see by the context.

    ~RM
    I actually thought you didn't, honestly if you want to commit this then at least add a few waits after other procedures such as click text - as this helps whilst in NPC chat.

  16. #16
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    we should just let people put this function into their scripts. This isn't even crucial at all... its just to save us some few extra lines.

  17. #17
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Deathscytex View Post
    we should just let people put this function into their scripts. This isn't even crucial at all... its just to save us some few extra lines.
    How isnt it crucial....

    Aldo, if so many people have it in their scripts, isn't that more of a reason to include it in srl?
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  18. #18
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I believe this should be added to SRL .

  19. #19
    Join Date
    May 2007
    Location
    Sydney, Australia (Faggot Region)
    Posts
    1,465
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    this is very good.


  20. #20
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    I don't think this'll work properly. You'd only need to cal IsUpText once instead of the repeat.

    So, if you DO include this, then you move the mouse to a specified coordinate, then call this and it can't find the uptext it'll just keep repeating until the the time has reached MaxWait. So, basically there's no point.. Unless you're trying to click a monster and that then moves to your mouse cursor, which i doubt
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  21. #21
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The joke is like everyone has made this once or not, but it is very efficient; the only problem is who gets the credit??? .

    ~Hermen

  22. #22
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    I don't think this'll work properly. You'd only need to cal IsUpText once instead of the repeat.

    So, if you DO include this, then you move the mouse to a specified coordinate, then call this and it can't find the uptext it'll just keep repeating until the the time has reached MaxWait. So, basically there's no point.. Unless you're trying to click a monster and that then moves to your mouse cursor, which i doubt
    wtf?

    yes, it will repeat it for 70ms when you set maxtime to 70?
    when you put it like this:
    SCAR Code:
    MMouse(x, y, 0, 0);
    wait(70);
    If IsUptext() then...
    it always waits the 70ms, my function waits a maximum of 70ms.
    so if the uptext appears in 10ms, it will not wait longer than 10ms.

    Quote Originally Posted by Hermen View Post
    The joke is like everyone has made this once or not, but it is very efficient; the only problem is who gets the credit??? .

    ME ME ME!!!
    heh not rly, just put credits to SRL team? ^^

  23. #23
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by marpis View Post
    wtf?

    yes, it will repeat it for 70ms when you set maxtime to 70?
    when you put it like this:
    SCAR Code:
    MMouse(x, y, 0, 0);
    wait(70);
    If IsUptext() then...
    it always waits the 70ms, my function waits a maximum of 70ms.
    so if the uptext appears in 10ms, it will not wait longer than 10ms.
    Wouldn't it appear straight away when you move the mouse to the location though?
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  24. #24
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    Wouldn't it appear straight away when you move the mouse to the location though?
    this is what you usually do:

    SCAR Code:
    MMouse(x, y, 3, 3);
    wait(300+random(50));
    GetMousePos(x, y);
    if IsUpText('lol') then
     Mouse(x, y, 0, 0, true);

    this is what you'd do now:
    SCAR Code:
    MMouse(x, y, 3, 3);
    if WaitUpText('lol', 300) then
    begin
      wait(Random(50));
      GetMousePos(x,y);
      Mouse(x, y, 0, 0);
    end;

    the Difference is that instead of waiting 300 ms to check for uptext, you wait in cycles, meaning that as soon as it is up you mvoe on.

    ~RM
    Last edited by Sir R. M8gic1an; 06-21-2009 at 10:50 PM.

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  25. #25
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You are missing the maxtime parameter .

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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