Results 1 to 7 of 7

Thread: Reflection Detecting Autocast?

  1. #1
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Reflection Detecting Autocast?

    Hey guys,
    Quick question, is there a Reflection function which detects the autocast? If not, can someone explain how I could make one, or could someone create one for me? I can't get any other debuggers to work (RSBot, etc.), so I can't try around myself... Need it to finish my chicken killer (TheFox)...
    Thanks a lot,
    Pure1993
    There is nothing right in my left brain and there is nothing left in my right brain.

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

    Default

    What do you mean if auto cast is set up? Sorry but that confused me.

    EDIT: Cause you could always do a
    SCAR Code:
    function CheckForAutoCast: boolean;
    begin
      GameTab(Tab_Combat);
      Result := (GetColor(cords) = redcolor);
      GameTab(Tab_Inv);
    end;
    If thats what you mean
    Last edited by All that is man; 08-08-2009 at 01:59 AM.

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

    Default

    He is talking about a magic spell.
    You can autocast firespell for example.
    He wants to get in a string or a integer what the player has set as spell.
    ~Hermen

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

    Default

    Quote Originally Posted by All that is man View Post
    What do you mean if auto cast is set up? Sorry but that confused me.

    EDIT: Cause you could always do a
    SCAR Code:
    function CheckForAutoCast: boolean;
    begin
      GameTab(Tab_Combat);
      Result := (GetColor(cords) = redcolor);
      GameTab(Tab_Inv);
    end;
    If thats what you mean
    he means like, have reflection check it, without going to the combat tab and such, i think.

    and i dont think you can do it using reflection
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Yeah, I don't think we have hooks for that.

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

    Default

    So he would have to resort back to the function that I made, or something like it, correct?

    EDIT: and you said that you couldn't get rsbot's debugger working so heres a really nice one:
    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.

  7. #7
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Try debugging the settings array with RSBot or KBot. It might be an option in there.

    Otherwise, you can grab the interface text to see what spell is selected, though you may have to have the tab open to do so.
    :-)

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
  •