Results 1 to 7 of 7

Thread: UpTextGone

  1. #1
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default UpTextGone

    Once again I was looking for something in SRL, and it wasn't there. D:
    I needed to wait for the Uptext to be gone, before moving on. It's useful in say, cleaning herbs, or eating food. It used WaitUpTextMulti, and just changed it around a bit.

    Simba Code:
    function UpTextGone(S: TStringArray; Time: Integer): Boolean;
    var
      T,i: Integer;
      There:Boolean;
    begin
      Result := false;
      T := GetSystemTime + Time;
      while (GetSystemTime < T) do
      begin
        if(i = 0) then
        begin
          if (IsUpTextMultiCustom(S)) then
          begin
            There := True;
            Inc(i);
          end;
        end;
        if(There = True) then
        begin
          i := 0
          if not(IsUpTextMultiCustom(S)) then
          begin
            Writeln('Uptext gone');
            There := False
            Result := True;
            Exit;
          end;
        end;
      end;
      Wait(20 + Random(20));
    end;

    Thoughts?

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    No. We don't need all these small functions.

    Use WaitFunction.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  3. #3
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Or you could just do

    Simba Code:
    begin
      Marktime(t);
      result := False;
      while (Marktime(t)<Time) do
      begin
        if not IsUpTextMultiCustom(S) then
          begin
            result := true;
            break;
         end;
      end;
    end;

    Excuse me if that isn't properly formatted, I haven't done any scripting in a while.

  4. #4
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    How would WaitFunction work here? o.O

  5. #5
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    How would WaitFunction work here? o.O
    Simba Code:
    var
      v : TVariantArray;
    [...]
    v := ['a', 'b', 'c'];
    if not WaitFuncEx('IsUpTextMultiCustom', v, 20, 1000) then
      exit; // blah
    Some shit like that.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  6. #6
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    Simba Code:
    v := ['a', 'b', 'c'];
    if not WaitFuncEx('IsUpTextMultiCustom', v, 20, 1000) then
      exit; // blah
    That would wait a full second no matter what. He wants it to wait until IsUpTextCustom = false.

  7. #7
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Right, then you can write a wrapper and use WaitFunc.
    Simba Code:
    var
      s : TStringArray;
    [...]
    function IsUpTextMultiCustomWrap : boolean;
    begin
      result := not IsUpTextMultiCustomWrap(s);
    end;

    WaitFunc(@IsUpTextMultiCustomWrap, 200, 100);
    My point is just that there is no reason for this to be in the include..
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

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
  •