Results 1 to 12 of 12

Thread: i really must fail at reflection :P

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default i really must fail at reflection :P

    edit: fixed it. thanks all that is man for attempting to help

    also off topic, but how would you make this function for efficient?

    SCAR Code:
    function FindObjHue(var a, b: integer; color: longint; x, y, cx1, cy1, cx2, cy2, tol: integer; hue, sat: extended; text: tstringarray): boolean;
    var
      CTS, I: Integer;
      TPA: TPointArray;
      ATPA: Array of TPointArray;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(hue, sat);
      FindColorsSpiralTolerance(a, b, TPA, color, cx1, cy1, cx2, cy2, tol);
      ColorToleranceSpeed(CTS);
      ATPA := TPAToATPAEx(TPA, 15, 15);
      For I := 0 to High(ATPA) do
      begin
        MiddleTPAEx(ATPA[i], a, b);
        MMouse(a, b, 2, 2);
        wait(10 + random(30));
        if IsUpTextMultiCustom(text) then
        begin
          Result := True;
          GetMousePos(a, b);
          Break;
        end;
      end;
    end;

    it always gets the color, dont get me wrong :P but it takes a while for it to find the uptext, searching the entire screen for it.
    Last edited by Awkwardsaw; 07-07-2009 at 04:37 AM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    Jul 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try R_InvFull? Thats the only thing i can think of right now.

  3. #3
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What error do you get with:
    SCAR Code:
    function shapeid(shape: string): integer;
    begin
      case shape of
        'cube': result:= 10799;
        'cylinder': result:= 10800;
        'Icosahedron': result:= 10801;
        'Pentamid': result:= 10802;
      end;
    end;

    Procedure GetFromPile(name: string);
    Var
      shapepos :TPoint;
    begin
        If(FindObject(shapepos, shapeid(name)))then
        begin
          shapepos := TileToMS(shapepos, Random(5));
          mouse(shapepos.x, shapepos.y, 2, 2, True);
        end;
    end;

    procedure fillinv(shape: string);
    var c: integer;
    begin
      repeat
        Getfrompile(shape);
        inc(c)
      until invfull or (c > 35);
    end;

    procedure takeshapes;
    begin
      case location of
        'cubes': fillinv('cube');
        'cylinder': fillinv('cylinder');
        'icosahedron': fillinv('icosahedron');
        'pentamid': fillinv('pentamid');
      end;
    end;

  4. #4
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    no error at all, just that it doesnt find the ids

    sorry, should have put that in main post :P

    e: added
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    Jul 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    o.o
    I.d finding. Try adding 1 or minus'ing 1 from each id.

    cause ground objects are different from inv

  6. #6
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What did you use to get the IDs cause (rsbot debugger ids != rs ids)

  7. #7
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    oo good point :P

    i knew it was something obvious and stupid . one sec, i'll go get em
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  8. #8
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Here use this, by Heysus:
    SCAR Code:
    { REFLECTION DEBUGGER by Heysus

      Debugs:
       - Main Screen (Tiles, Objects, NPCs, Ground Items)
       - Minimap
       - Inventory
       - NPC Chat Interfaces
    }


    Program ReflectionDebugger;

    // SMART include without the color/mouse functions
    procedure SmartSetTarget;
    var
      Smart_Bitmap: Integer;
    begin
      Smart_Bitmap:= BitmapFromString(765,503,'');
      GetBitmapCanvas(Smart_Bitmap).Handle:= SmartGetDC;
      SetTargetBitmap(Smart_Bitmap);
      FreeBitmap(Smart_Bitmap);
    end;

    procedure SmartSetupEx(worldnumber: integer; members, signed, superdetail: boolean);
    var
      prefix: string;
    begin
      prefix := ReadINI('World' + IntToStr(worldnumber), 'Prefix', AppPath + 'includes\SRL\SRL\misc\worlds.ini');
      if(prefix = '')then
      begin
        writeln('Invalid world number or corrupted world list. Please review your settings');
        TerminateScript;
      end;
      SmartSetup('http://'+prefix+'.runescape.com/', 'plugin.js?param=o0,a' + IntToStr((Integer(not(Signed)) + 1) * Integer(not((SuperDetail and Signed)))) + ',m' + IntToStr(Integer(Members)));
    end;

    {.Include SRL\SRL.Scar}
    {.Include SRL\SRL\Reflection\Reflection.scar}

    var
      x, y, LastP: integer;
      Form: TForm;
      Box: TGroupBox;
      Labels: Array of TLabel;
     
    Procedure InitForm;
    var
      i: integer;
    begin
      Form := CreateForm;
      Form.Left := 0;
      Form.Top := 0;
      Form.Width := 205;
      Form.Height := 155;

      Form.Caption := 'ReflectionDebug';
      Form.Color := clBtnFace;
      Form.Font.Color := clWindowText;
      Form.Font.Height := 12;
      Form.Font.Name := 'MS Sans Serif';
      Form.Font.Style := [];
      Form.Visible := False;
      Form.PixelsPerInch := 96;
     
      Box := TGroupBox.Create(Form);
      Box.Parent := Form;
      Box.Left := 10;
      Box.Top := 5;
      Box.Width := 176;
      Box.Height := 105;
      Box.Caption := '';
      Box.TabOrder := 8;

      SetArrayLength(Labels, 6);
      for i:=0 to 5 do
      begin
        Labels[i] := TLabel.Create(Form);
        Labels[i].Parent := Box;
        Labels[i].Left := 10;
        Labels[i].Top := 17 + 15*i;
        Labels[i].Width := 160;
        Labels[i].Height := 17;
        Labels[i].Caption := '';
      end;
    end;


    Procedure SafeInitForm;
    var
      V: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('InitForm', V);
    end;


    Procedure ShowForm;
    begin
      Form.Show;
    end;


    Procedure SafeShowForm;
    var
      V: TVariantArray;
    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('ShowForm', V);
    end;
     

    Function GetMouseArea: string;
    begin
      GetMousePos(x, y);
      if PointInBox(Point(x, y), IntToBox(7, 32, 519, 366)) then
        Result := 'Main Screen';
      if PointInBox(Point(x, y), IntToBox(5, 368, 521, 507)) then
        Result := 'Interface';
      if (PointInBox(Point(x, y), IntToBox(MIX1, MIY1, MIX2, MIY2))) and (GetCurrentTab = 4)  then
        Result := 'Inventory';
      if Rs_OnMinimap(x, y) then
        Result := 'Minimap';
      if (not(LoggedIn)) or (GetTimeRunning < 3000) then
        Result := 'Reflection Debugger';
      Box.Caption := Result;
    end;


    Procedure Clear;
    var
      i: integer;
    begin
      for i:=0 to 5 do
        Labels[i].Caption := '';
    end;


    Procedure Start;
    begin
      FindWindowBySize(766, 504);
      Labels[1].Caption := 'Reflection Debugger';
      Labels[2].Caption := 'By Heysus';
      Labels[3].Caption := 'Version 1.0';
      ClearDebug;
    end;


    Function TileDist(MS, T: TPoint): integer;
    begin
      T := TileToMS(T, 0);
      Result := Distance(MS.x, MS.y, T.x, T.y);
    end;


    Procedure DebugInventory;
    var
      x, y: integer;
      Item: TInvItem;
    begin
      GetMousePos(x, y);
      Item := GetInvItemInfo(CoordsToItem(x, y));
      Labels[0].Caption := 'Name: ' + Between(' ', '/', rs_GetUpText);
      Labels[1].Caption := 'ID: ' + IntToStr(Item.ID);
      Labels[2].Caption := 'Amount: ' + IntToStr(Item.Stack);
    end;


    Function DebugInterface: boolean;
    var
      a, b, c, x, y, Count, P: integer;
      str: string;
      Letters: TStringArray;
      Exists: Array of Boolean;
    begin
      if LastP > 0 then
      begin
        for a:=1 to 8 do
        begin
          str := GetInterfaceText(LastP, a);
          if str <> '' then
            if FindText(x, y, str, NPCChars, MCX1, MCY1, MCX2, MCY2) then
              Inc(C);
        end;
        if C > 1 then
        begin
          Labels[0].Caption := 'Parent: ' + IntToStr(LastP);
          Labels[1].Caption := '(Text in Debug Box)';
          exit;
        end;
      end;

      Clear;
      Labels[0].Caption := 'Searching Interfaces...';

      Letters := ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
      SetArrayLength(Exists, 26);
      for a:=0 to 25 do
        if FindText(x, y, Letters[a], NPCChars, MCX1, MCY1, MCX2, MCY2) then
          Exists[a] := true;

      for a:=0 to 751 do
      begin
        if not ValidInterface(a) then
          continue;
         
        str := '';
        for b:=0 to 8 do
          str := str + GetInterfaceText(a, b);

        c := 0;
        for b:=0 to 25 do
          if (Pos(Letters[b], str) > 0) = (Exists[b]) then
            Inc(c);
       
        if c > Count then
        begin
          P := a;
          Count := c;
        end;
      end;
     
      if Count = 0 then
        exit;

      LastP := P;
      Labels[0].Caption := 'Parent: ' + IntToStr(P);
      Labels[1].Caption := '(Text in Debug Box)';
      ClearDebug;
      for C:=0 to 8 do
      begin
        str := GetInterfaceText(P, C);
        if str <> '' then
          Writeln(IntToStr(P) + ', ' + IntToStr(C) + '  ' + str);
      end;
    end;


    Procedure DebugMainScreen;
    var
      a, b, x, y, d, i: integer;
      TP, P: TPoint;
      TPA: TPointArray;
      Obj: UID;
      NPC: TNPC;
      NPCs: Array of TNPC;
    begin
      /// MOUSE POS ///
      GetMousePos(x, y);
      TP := GetMyPos;
      P := TileToMS(GetMyPos, 0);
      i := Distance(x, y, P.x, P.y)/30
     
      D := 10000;
      for a := TP.x - i to TP.x + i do
      begin
        for b := TP.y - i to TP.y + i do
        begin
          if (TileDist(Point(x, y), Point(a, b)) < D) or (TileDist(Point(x, y), Point(a, b)) < 30) then
          begin
            D := TileDist(Point(x, y), Point(a, b));
            P := Point(a, b);
          end;
        end;
      end;

      /// OBJECT ///
      Obj := GetObjectAt(P.x, P.y);

      /// NPC ///
      NPCs := GetNPCs;
      for i:=0 to High(NPCs) do
        if (NPCs[i].Tile.x = P.x) and (NPCs[i].Tile.y = P.y) then
        begin
          NPC := NPCs[i];
          break;
        end;
       
      /// GROUND ITEM ///
      TPA := GetGroundItems(P.x, P.y);

      i := 1;
      Labels[0].Caption := 'Mouse Tile: (' + IntToStr(P.x) + ', ' + IntToStr(P.y) + ')';

      if (Obj.objtype > 0) and (Obj.objtype <> NPC.Index) and (Obj.objtype <> 2047) then
      begin
        Labels[i].Caption := 'Object ID: ' + IntToStr(Obj.objtype);
        Inc(i);
      end;
     
      if NPC.Name <> '' then
      begin
        Labels[i].Caption := 'NPC Name: ' + NPC.Name;
        Labels[i+1].Caption := 'NPC Index: ' + IntToStr(NPC.Index);
        i := i + 2;
      end;
     
      if GetArrayLength(TPA) > 0 then
      begin
        Labels[i].Caption := 'Ground Item: ' + IntToStr(TPA[0].x);
        Inc(i);
      end;
     
      if i < 5 then
        for i:=i to 5 do
          Labels[i].Caption := '';
    end;



    Procedure DebugMinimap;
    var
      x, y, i: integer;
      P, P2: TPoint;
    begin
      P := GetMyPos;
      GetMousePos(x, y);
      Labels[0].Caption := 'Player Tile: (' + IntToStr(P.x) + ', ' + IntToStr(P.y) + ')';
      P2 := TileToMM(P);
      Labels[1].Caption := 'Mouse Tile: (' + IntToStr(P.x - (P2.x - x)/4) + ', ' + IntToStr(P.y + (P2.y - y)/4) + ')';
      Labels[2].Caption := 'Angle: ' + FloatToStr(GetMinimapAngleDeg);
      for i:=3 to 5 do
        Labels[i].Caption := '';
    end;



     
    Procedure Setup;
    begin
      SetupSRL;
      SMARTSetupEx(80, False, True, False);
      Wait(1000);
      SetTargetDC(SmartGetDC);
      SetupReflection;
    end;

    begin
      Setup;

      SafeInitForm;
      SafeShowForm;

      repeat
        try
          case GetMouseArea of
            '': Clear;
            'Reflection Debugger': Start;
            'Main Screen': DebugMainScreen;
            'Inventory': DebugInventory;
            'Interface': DebugInterface;
            'Minimap': DebugMinimap;
          end;
        except
        end;
       
        Wait(100);
      until(false);
    end.

  9. #9
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    i just now was using that :P and yes, the ids are the same
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  10. #10
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm is it not clicking on the object at all?

    because you don't have any wait()s in there that might be it idk and try making shapepos := TileToMS(shapepos, 5);

  11. #11
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    its not finding the object. i tried debugging it like this

    SCAR Code:
    writeln('1');
    If(FindObject(shapepos, shapeid(name)))then
        begin
          writeln('2');
          shapepos := TileToMS(shapepos, Random(5));
          mouse(shapepos.x, shapepos.y, 2, 2, True);

    and it never got to 2

    also, maby my hooks are out dated :P i'll try updating real fast

    yep, it was the hooks. sorry for wasting your guys time about that :P

    although i still would like to find out a better way for the findobjhue thing
    Last edited by Awkwardsaw; 07-07-2009 at 04:34 AM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  12. #12
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by akwardsaw View Post
    yep, it was the hooks. sorry for wasting your guys time about that :P

    although i still would like to find out a better way for the findobjhue thing
    Its not a problem glad you figured it out, and I have no idea about your findobjhue thing sorry.

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
  •