Results 1 to 11 of 11

Thread: this is driving me insane!

  1. #1
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default this is driving me insane!

    There has to either be something really simple that I am missing here or some sort of anomaly...

    I made a text DTM to find detect Minotaur uptexts. When I test the function on its own it works absolutely perfect. BUT when i use it in my ClickMinotaur function it DOES NOT WORK. Here is the script that I am using to test this craziness:

    SCAR Code:
    program New;
    //{.include SRL\SRL\misc\smart.scar}
    {.include SRL\SRL.scar}
    var
      x,y,WaitTime: Integer;

    Function UpText: Boolean;
    var
      fx,fy,MinotaurTxt: Integer;
    begin
      if(not(LoggedIn))then Exit;
      MinotaurTxt := DTMFromString('78DA63BCC6C0C010CE80029E3C61633002D28' +
           'C503EE32D4C35CF1EB3C2D5FC070246903931F8CD0100C63B0D93' +
           '');
      Result := FindDTM(MinotaurTxt,x,y,110,12,140,30);
      FreeDTM(MinotaurTxt);
    end;

    Function ClickRandom(Txt: String): Boolean;
    var
      fx,fy,i: Integer;
    begin
      if(not(LoggedIn))then Exit;
      if(Random(4) = 0)then
      begin
        Mouse(x,y,0,0,False);
        if(ChooseOption(Txt))then
        begin
          Status('Clicked!');
          Result := True;
          Exit;
        end else
        Result := False;
        Exit;
      end else
      Mouse(x,y,0,0,True);
      i := 0;
      for i := 0 to 10 do
      begin
        if(FindColor(fx,fy,255,x-8,y-8,x+8,y+8))then
        begin
          Status('Clicked!');
          Result := True;
          Exit;
        end;
        if(FindColor(fx,fy,65535,x-8,y-8,x+8,y+8))then
        begin
          Status('Missed');
          Result := False;
          Exit;
        end;
        Inc(i);
      end;
    end;

    Function ClickMinotaur: Boolean;
    var
      TTPA: T2DPointArray;
      TPA: TPointArray;
      TP: TPoint;
      CTS,i: Integer;
    begin
      if(not(LoggedIn))then Exit;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.00,0.26);
      x := mscx;
      y := mscy;
      FindColorsSpiralTolerance(x,y,TPA,11055537,msx1,msy1,msx2,msy2,13);
      if(Length(TPA) = 0)then
      begin
        Result := False;
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.20,0.20);
        Exit;
      end;
      TTPA := TPAtoATPA(TPA,30);
      SortATPAFromFirstPoint(TTPA,Point(mscx,mscy));
      for i := 0 to High(TTPA) do
      begin
        if(Length(TTPA[i]) < 10)then
          Continue;
        TP := MiddleTPA(TTPA[i]);
        MMouse(TP.x,TP.y,4,4);
        Wait(200 + random(100));
        if(UpText)then
        begin
          GetMousePos(x,y);
          if(ClickRandom('ttack'))then
          begin
            Result := True;
            ColorToleranceSpeed(CTS);
            SetColorSpeed2Modifiers(0.20,0.20);
            Exit;
          end;
        end;
      end;
      Result := False;
    end;

    begin
      //Smart_Server := 19;
      //Smart_Signed := True;
      SetupSRL;
      MouseSpeed := 18;
      repeat
        if IsFKeyDown(1) then //Move the mouse over the minotaur and it will detect it!
        begin
          while not UpText do
            Status('searching');
        end;
        if IsFKeyDown(2) then
        begin
          while not ClickMinotaur do //Fails and wont click the minotaur
            Status('searching');
        end;
        Status('ready to fire');
      until false;
    end.

    If you see anything odd with it please point it out. If you dont see anything wrong, then please test it out for me and let me know if it does it for you as well.
    METAL HEAD FOR LIFE!!!

  2. #2
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Have you tried splitting your ClickedMinotaur function into two different ones? Try making one for Finding the Minotaur and then be like if(FindMinotaur)then ClickMinotaur' I don't know if that will help, but the only thing I'm guessing is that the TPA finding is messing with the UpText function.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  3. #3
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    Just tried that and it did not work :/
    Heres that attempted code.

    SCAR Code:
    program New;
    //{.include SRL\SRL\misc\smart.scar}
    {.include SRL\SRL.scar}
    var
      x,y,WaitTime: Integer;

    Function UpText: Boolean;
    var
      fx,fy,MinotaurTxt: Integer;
    begin
      if(not(LoggedIn))then Exit;
      MinotaurTxt := DTMFromString('78DA63BCC6C0C010CE80029E3C61633002D28' +
           'C503EE32D4C35CF1EB3C2D5FC070246903931F8CD0100C63B0D93' +
           '');
      Result := FindDTM(MinotaurTxt,fx,fy,110,12,140,30);
      FreeDTM(MinotaurTxt);
    end;

    Function ClickRandom(Txt: String): Boolean;
    var
      fx,fy,i: Integer;
    begin
      if(not(LoggedIn))then Exit;
      if(Random(4) = 0)then
      begin
        Mouse(x,y,0,0,False);
        if(ChooseOption(Txt))then
        begin
          Status('Clicked!');
          Result := True;
          Exit;
        end else
        Result := False;
        Exit;
      end else
      Mouse(x,y,0,0,True);
      i := 0;
      for i := 0 to 10 do
      begin
        if(FindColor(fx,fy,255,x-8,y-8,x+8,y+8))then
        begin
          Status('Clicked!');
          Result := True;
          Exit;
        end;
        if(FindColor(fx,fy,65535,x-8,y-8,x+8,y+8))then
        begin
          Status('Missed');
          Result := False;
          Exit;
        end;
        Inc(i);
      end;
    end;

    Function FindMinotaur(var xx,yy: Integer): Boolean;
    var
      TTPA: T2DPointArray;
      TPA: TPointArray;
      TP: TPoint;
      CTS,i: Integer;
    begin
      if(not(LoggedIn))then Exit;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.00,0.26);
      x := mscx;
      y := mscy;
      FindColorsSpiralTolerance(x,y,TPA,11055537,msx1,msy1,msx2,msy2,13);
      if(Length(TPA) = 0)then
      begin
        Result := False;
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.20,0.20);
        Exit;
      end;
      TTPA := TPAtoATPA(TPA,30);
      SortATPAFromFirstPoint(TTPA,Point(mscx,mscy));
      for i := 0 to High(TTPA) do
      begin
        if(Length(TTPA[i]) < 10)then
          Continue;
        TP := MiddleTPA(TTPA[i]);
        MMouse(TP.x,TP.y,4,4);
        GetMousePos(xx,yy);
        Result := True;
        Exit;
      end;
      Result := False;
    end;

    Function ClickMinotaur: Boolean;
    begin
      if(not(LoggedIn))then Exit;
      if(not(UpText))then Exit;
      Result := ClickRandom('ck');
    end;

    begin
      //Smart_Server := 19;
      //Smart_Signed := True;
      SetupSRL;
      MouseSpeed := 18;
      repeat
        if IsFKeyDown(1) then //Move the mouse over the minotaur and it will detect it!
        begin
          while not UpText do
            Status('searching');
        end;
        if IsFKeyDown(2) then
        begin
          repeat
            if(FindMinotaur(x,y))then
              if(ClickMinotaur)then
                Break;
          until IsFKeyDown(2);
        end;
        Status('ready to fire');
      until false;
    end.
    METAL HEAD FOR LIFE!!!

  4. #4
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Try using this function I made!
    It counts color for uptext.

    SCAR Code:
    Function CountUpColor(Color:string; Q1, U1, Q2, U2, Count1, Count2:Integer):Boolean;
    var ColStats:TIntegerArray;
    Begin
      SetArrayLength(ColStats,2);
      Case Uppercase(Color) Of
        'Y':  ColStats:=[1105118, 36];
        'B':  ColStats:=[13882894, 30];
      End;
      If InRange(CountColorTolerance(ColStats[0], Q1, U1, Q2, U2, ColStats[1]), Count1, Count2) Then
       Result:=True;
    End;

    The B is for blue, and Y is for yellow (you'll want to use yellow since monster names are yellow)


    SCAR Code:
    If CountUpColor('B', 41, 5, 86, 24, 70, 140) Then
    (Color, Box to search (x1, y1, x2, y2), min count, max count)

    You can run something like this
    SCAR Code:
    program New;
    begin
      Repeat
      Wait(3000)
      Writeln(IntToStr(CountColorTolerance(1105118, x1, y1, x2, y2, 36))) //fill in box cords of monster name
      Until(false)
    end.

    So you know what you want the min/max count to be, and also if my yellow color/tol doesn't work, just get your own using ACA, good luck!

    Easier to make that DTM for text

  5. #5
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    Sweet im definitely using this then

    Still curious about mine though if anyone would care to investigate still...
    METAL HEAD FOR LIFE!!!

  6. #6
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    I would, but I'm lazy right now . Tell me if you need any help with that function, its pretty straight forward though...

  7. #7
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    How much positional tolerance did you add to your points?


  8. #8
    Join Date
    Apr 2006
    Location
    The Netherlands
    Posts
    106
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Function ClickMinotaur: Boolean;
    begin
      if(not(LoggedIn))then Exit;
      if(not(UpText))then Exit; <-----
      Result := ClickRandom('ck');
    end;

    Forgive me if I'm wrong, but isn't UpText bugged as of Dec. 16th? That might just cause one of your failsafes to trigger and stop your script from moving on..?
    Back to scripting.

  9. #9
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by tarajunky View Post
    How much positional tolerance did you add to your points?
    No positional tolerance... just color tol. The DTM works fine when doing a test on it, then fails when using it in combination with TPA + mouse moving procedures. This is what is boggling me.

    I have two working text DTMs in my other script that are still going strong, but this one is giving me hell.

    @Dub im not using "IsUpText" I am using my own "UpText" function which uses DTMs to detect the correct text.
    METAL HEAD FOR LIFE!!!

  10. #10
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Quote Originally Posted by gerauchert View Post
    No positional tolerance... just color tol. The DTM works fine when doing a test on it, then fails when using it in combination with TPA + mouse moving procedures. This is what is boggling me.

    I have two working text DTMs in my other script that are still going strong, but this one is giving me hell.

    @Dub im not using "IsUpText" I am using my own "UpText" function which uses DTMs to detect the correct text.
    You NEED positional tolerance. Text moves around a lot and has minor shits and fluctuations in letter positioning, try adding some positional tol, or just use color =D

  11. #11
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    hmm. I did not use positional tol in my other script and havent had a single problem yet. How much tol would you suggest?

    I am using ColorToleranceSpeed 2 now for text finding. The colors were too dynamic for your function yohojo

    EDIT: Heres the function if you wanna check it out:

    SCAR Code:
    Function UpTextTPA(color,tol,cmin,cmax:Integer;hue,sat:Extended): Boolean;
    var
      TPA: TPointArray;
      CTS: Integer;
    begin
      if(not(LoggedIn))then Exit;
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(hue,sat);
      FindColorsTolerance(TPA,color,0,0,140,30,tol);
      if(Length(TPA) = 0)then
      begin
        Result := False;
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.20,0.20);
        Exit;
      end;
      Result := InRange(Length(TPA),cmin,cmax);
      Writeln(IntToStr(Length(TPA))); //Used for testing what to set cmin and cmax as
      ColorToleranceSpeed(CTS);
      SetColorSpeed2Modifiers(0.20,0.20);
    end;
    METAL HEAD FOR LIFE!!!

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
  •