Results 1 to 14 of 14

Thread: making your own upchars [problem]

  1. #1
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default making your own upchars [problem]

    Hey guys!
    I am kind of struggling for a while now on this script.
    It just can't seem to find the upchars from a RSPS that i created myself from a guide from schuttleu.
    so here's a picture of my script:
    version 1:


    Simba Code:
    Program New;
    {$i SRL/SRL.simba}

    procedure GetText;
    begin
    LoadFont(RSPS, True);
    Wait(5000);
    writeln(GetTextAtExWrap(3, 3, 200, 25, 0, 3, 0, 13948373, 50, RSPS));
    end;

    function steal:boolean;
    var
    x,y:Integer;
    begin
    if FindObjCustom (x, y, ['Ste','al'],[2490935,2490935,2490935], 5) then
    begin
      writeln('found');
      GetMousePos(x,y);
      case Random (1) of
       0:Mouse (x,y,2,2,mouse_Left);
       1:begin
        mouse(x,y,2,2,false);
        WaitOption('Steal',500);
    end;
    end;
    end;
    end;

    Begin
    SetupSRL;
    steal;
    GetText;
    end.


    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    over here, all it does is hover over the stall where i want to steal from and write some random letters in the debug box.





    version 2:



    Simba Code:
    Program New;
    {$i SRL/SRL.simba}

    procedure GetText;
    begin
    LoadFont(RSPS, True);
    Wait(5000);
    writeln(GetTextAtExWrap(3, 3, 200, 25, 0, 3, 0, 13948373, 50, RSPS));
    end;



    function LetterColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 14408668, 4, 4, 500, 330, 11);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 8.35) and (S >= 0.00) and (S <= 3.35) and (L >= 83.51) and (L <= 88.26) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 63.22) and (X <= 71.76) and (Y >= 66.52) and (Y <= 75.42) and (Z >= 72.42) and (Z <= 81.30) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;



    function steal:boolean;
    var
    x,y:Integer;
    begin
    if FindObjCustom (x, y, ['r','m'],[LetterColor,LetterColor,LetterColor], 4) then
    begin
      writeln('found');
      GetMousePos(x,y);
      case Random (1) of
       0:Mouse (x,y,2,2,mouse_Left);
       1:begin
        mouse(x,y,2,2,false);
        WaitOption('Steal',500);
    end;
    end;
    end;
    end;

    Begin
    SetupSRL;
    steal;
    GetText;
    LetterColor;
    end.

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    so i tried using autocolor.
    over here it just hovers around the chatbox and does nothing.





    what am i doing wrong guys?? any help is appreciated
    Last edited by hete taart; 08-21-2013 at 01:59 PM.

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    You have to create your own custom finding function or override rs_GetUpText() (if using lape), as FindObjCustom() calls rs_GetUpText() which directly uses a font only for the official RS.

  3. #3
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    thanks alot already! but couldd you tell me more about that own costum finding function? i don't really seem to get that part.

    bump!
    i am really willing to learn this. I promise i will use my knowledge to help others in the future D. Just like Yohojo, he's like my big example.
    Last edited by masterBB; 08-21-2013 at 01:28 PM.

  4. #4
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by hete taart View Post
    thanks alot already! but couldd you tell me more about that own costum finding function? i don't really seem to get that part.
    After moving your mouse to the target through ATPA etc, get the uptext using GetTextAtEx()/GetTextATPA() etc where the argument for 'font' would be the new font you have created, then compare the result with the desired object's uptext using Pos() or ExecRegExpr().

  5. #5
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    ty i will try to figure that out! Will post result as soon as i got it. Ty alot for your help man! It's really appreciated!

  6. #6
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    When posting code place them inside simba tags: [ simba]code[ /simba] <- without space after [

    or use paste.villavu.com
    Working on: Tithe Farmer

  7. #7
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    sorry edited

  8. #8
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    ok so i changed my script alot. And i did what Riwu said; I guess... I don't really know what I did .

    so now it looks like this:

    version 3:
    Simba Code:
    Program New;
    {$i SRL/SRL.simba}

    Function RSPS_GetUpText: String;
    Var
      WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
    Begin
      WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'RSPS');
      BlueT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'RSPS');
      YellowT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'RSPS');
      OrangeT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'RSPS');
      FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
      FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
      Result:=FoundText;
    End;

    function StallColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.05, 0.09);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 10728640, MSX1, MSY1, MSX2, MSY2, 16);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 27.16) and (X <= 67.46) and (Y >= 27.98) and (Y <= 70.66) and (Z >= 20.78) and (Z <= 71.06) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    procedure Steal;
    var X, Y:Integer;

    begin
      if FindObjTPA(X, Y, StallColor, 5, 1, 41, 21, 23, ['em']) then
      begin
        MMouse(X, Y, 3, 3);
        Mouse(X, Y, 0, 0, True);
      end;
    end;


    Begin
    SetupSRL;
    RSPS_GetUpText;
    Steal;
    end.

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    It still does nothing. It doesn't even move the mouse anymore .
    But ACA does recognise the color i guess.

    here's my debug box

    debug box.png

    Now what guys? What am i doing wrong?

    A big thanks to the people who already helped me so far! You guys are amazing!!!

  9. #9
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Try this, it should compile. The findObjTPA() in SRL has a login check (for the official rs) so it would always return false and exit, and regardless after that it would look for the uptext using the official rs uptext font.

    Simba Code:
    Program New;
    {$i SRL/SRL.simba}

    Function RSPS_GetUpText: String;
    Var
      WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
    Begin
      WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'RSPS');
      BlueT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'RSPS');
      YellowT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'RSPS');
      OrangeT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'RSPS');
      FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
      FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
      Result:=FoundText;
    End;

    function FindObjTPA2(var X, Y: Integer; Color, Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: string): Boolean;
    var
      I, tCTS: Integer;
      myPoint: TPoint;
      Points: TPointArray;
      aPoints: T2DPointArray;
    begin
      Result := False;

      tCTS := GetColorToleranceSpeed;
      CTS := Integer(CTS * 9 mod 3 <> 0);
      ColorToleranceSpeed(CTS);
      FindColorsSpiralTolerance(X, Y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
      if Length(Points) = 0 then
      begin
        writeln('findObjTPA(): Found no colors.... exiting');
        ColorToleranceSpeed(tCTS);
        Exit;
      end;
      ColorToleranceSpeed(1);
      aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
      SetLength(Points, 0);
      for I := 0 to High(aPoints) do
      begin
        if Length(aPoints[i]) < minCount then
          Continue;
        myPoint := MiddleTPA(aPoints[i]);
        MMouse(myPoint.X, myPoint.Y, 0, 0);
        wait(100 + random(50));

        if (pos(upText, RSPS_GetUptext) > 0) then
        begin
          writeln('findObjTPA(): We found the object!');
          GetMousePos(X, Y);
          Result := True;
          ColorToleranceSpeed(tCTS);
          Exit;
        end else
          writeln('findObjTPA(): Did not find the uptext... :<');
      end;
      ColorToleranceSpeed(tCTS);
    end;

    procedure Steal;
    var
      X, Y: Integer;
    begin
      if FindObjTPA2(X, Y, StallColor, 5, 1, 41, 21, 23, 'em') then
        clickMouse2(MOUSE_LEFT);
    end;


    begin
      SetupSRL();

      Steal();
    end.

  10. #10
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    ok, so i copied your script and it got me sooo much further thanks for that! but now it hovers over multiple stalls (i would like it to hover over just one, the one i want to steal from). But it still doesnn't click. this is what i get in my debug box. Any help? sorry if I am asking so much :S

    debug box2.png

    i know my font is made right because i copied it from dannyrs who made one for the private server called P06.
    My RSPS uses the same upchars font because it's also a 06 server.


    here's my new script if you need it:

    Simba Code:
    Program New;
    {$i SRL/SRL.simba}

    Function RSPS_GetUpText: String;
    Var
      WhiteT,BlueT,YellowT,OrangeT,FoundText: String;
    Begin
      WhiteT:=GetTextAtExWrap(8, 8, 80, 21, 0, 5, 1, 14541281, 55, 'RSPS');
      BlueT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 13423640, 65, 'RSPS');
      YellowT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 1235160, 40, 'RSPS');
      OrangeT:=GetTextAtExWrap(35, 8, 150, 21, 0, 5, 1, 4687583, 53, 'RSPS');
      FoundText:=WhiteT + ' ' + BlueT + YellowT + OrangeT;
      FoundText:= ReplaceWrap(FoundText, '.', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '/', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '\', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, ',', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '*', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '^', '',[rfReplaceAll]);
      FoundText:= ReplaceWrap(FoundText, '"', '',[rfReplaceAll]);
      Result:=FoundText;
    End;

    function StallColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.05, 0.09);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 10728640, MSX1, MSY1, MSX2, MSY2, 16);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 27.16) and (X <= 67.46) and (Y >= 27.98) and (Y <= 70.66) and (Z >= 20.78) and (Z <= 71.06) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    function FindObjTPA2(var X, Y: Integer; Color, Tol, CTS, ObjWidth, ObjHeight, minCount: Integer; UpText: string): Boolean;
    var
      I, tCTS: Integer;
      myPoint: TPoint;
      Points: TPointArray;
      aPoints: T2DPointArray;
    begin
      Result := False;

      tCTS := GetColorToleranceSpeed;
      CTS := Integer(CTS * 9 mod 3 <> 0);
      ColorToleranceSpeed(CTS);
      FindColorsSpiralTolerance(X, Y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
      if Length(Points) = 0 then
      begin
        writeln('findObjTPA(): Found no colors.... exiting');
        ColorToleranceSpeed(tCTS);
        Exit;
      end;
      ColorToleranceSpeed(1);
      aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
      SetLength(Points, 0);
      for I := 0 to High(aPoints) do
      begin
        if Length(aPoints[i]) < minCount then
          Continue;
        myPoint := MiddleTPA(aPoints[i]);
        MMouse(myPoint.X, myPoint.Y, 0, 0);
        wait(100 + random(50));

        if (pos(upText, RSPS_GetUptext) > 0) then
        begin
          writeln('findObjTPA(): We found the object!');
          GetMousePos(X, Y);
          Result := True;
          ColorToleranceSpeed(tCTS);
          Exit;
        end else
          writeln('findObjTPA(): Did not find the uptext... :<');
      end;
      ColorToleranceSpeed(tCTS);
    end;

    procedure Steal;
    var
      X, Y: Integer;
    begin
      if FindObjTPA2(X, Y, StallColor, 5, 1, 41, 21, 23, 'teal-from') then
        clickMouse2(MOUSE_LEFT);
    end;


    begin
      SetupSRL();

      Steal();
    end.

  11. #11
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Move your mouse over a object, then run the script with this

    Simba Code:
    writeln(RSPS_GetUptext);

    And then you will see if your uptext works or not..

    Also remove setupSRL() from your script, that will offset the whole client (because of the nav bar in official rs)

  12. #12
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    ok so i tested what you said and it sees the uptext perfectly.
    But for some reason when i delete SetupSRL; the mouse will move reaaaal slow

  13. #13
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    but it does work it does click the stall. it just moves so slow.

  14. #14
    Join Date
    Dec 2012
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    fixed it myself i just did
    MouseSpeed :=12;

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
  •