Results 1 to 4 of 4

Thread: Unknown Delcaration Issue

  1. #1
    Join Date
    Apr 2014
    Posts
    323
    Mentioned
    0 Post(s)
    Quoted
    131 Post(s)

    Default Unknown Delcaration Issue

    Hello. I am getting this error on every Reflection script I run

    Code:
    Error: Unknown declaration "Widget_ScrollX" at line 138
    And it's coming from the Widgets.simba file. Any Idea about how I can go about fixing this?

    Here is the Widgets.Simba File for reference:

    Code:
    type
      TReflectWidget = type(TReflectPointer);
    
    procedure TReflectWidget.GetWidget(ContainerIndex, ParentIndex: Integer);
    begin
      Self.Reference := Reflect.Smart.GetFieldArray2DObject(0, Client_Widgets,
        ContainerIndex, ParentIndex);
    end;
    
    function TReflectWidget.GetWidgetID: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_WidgetID);
    end;
    
    function TReflectWidget.GetParentID: Integer;
    var
      HeadUID, I: Integer;
      CurrentNode, HeadNode, Table, TempNode: TReflectPointer;
      Freed: Boolean;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_ParentID);
      if (Result > 0) then
        Exit;
      Result := Sar(Self.GetWidgetID, 16);
      Table.GetFieldObject(0, Client_WidgetNodeCache);
      try
        for I := 0 to Reflect.Smart.GetArraySize(Table.Reference, HashTable_Buckets, 0) - 1 do
        begin
          HeadNode.GetFieldArrayObject(Table.Reference, HashTable_Buckets, I);
          HeadUID := HeadNode.GetFieldLongL(Node_UID);
          CurrentNode.GetFieldObject(HeadNode.Reference, Node_Next);
          while HeadUID <> CurrentNode.GetFieldLongL(Node_UID) do
          begin
            if CurrentNode.GetFieldLongL(Node_UID) = -1 then
              Break;
            if Result = CurrentNode.GetFieldInt(WidgetNode_ID) then
              Exit(CurrentNode.GetFieldLongL(Node_UID));
            TempNode := CurrentNode;
            CurrentNode.GetFieldObject(Node_Next);
            TempNode.Free;
          end;
          Freed := True;
          HeadNode.Free;
          CurrentNode.Free;
        end;
      finally
        HeadNode.Free;
        CurrentNode.Free;
        TempNode.Free;
        Table.Free;
      end;
      Result := -1;
    end;
    
    function TReflectWidget.GetParent(ParentID: Integer): Boolean;
    begin
      Result := False;
      if (ParentID >= 0) and Self.Exists(ParentID shr 16, ParentID and $FFFF) then
      begin
        Self.GetWidget(ParentID shr 16, ParentID and $FFFF);
        if Self.GetParentID = ParentID then
          Self.Free
        else
          Result := True;
      end;
    end;
    
    function TReflectWidget.GetBoundsIndex: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_BoundsIndex);
    end;
    
    function TReflectWidget.Exists(ContainerIndex, ParentIndex: Integer): Boolean;
    var
      Parent: TReflectPointer;
    begin
      Parent.GetFieldArray2DObject(0, Client_Widgets, ContainerIndex, ParentIndex);
      Result := Parent.NotNull;
      if Result then
        Parent.Free;
    end;
    
    function TReflectWidget.HasChild: Boolean;
    begin
      Result := Reflect.Smart.GetArraySize(Self.Reference, Widget_Children, 0) > 0;
    end;
    
    procedure TReflectWidget.GetChild(Parent: TReflectWidget; Index: Integer);
    begin
      Self.Reference := Reflect.Smart.GetFieldArrayObject(Parent.Reference,
        Widget_Children, Index);
    end;
    
    procedure TReflectWidget.GetWidget(ContainerIndex, Parent, Child: Integer); overload;
    var
      ParentWid, ChildWid: TReflectWidget;
    begin
      ParentWid.GetWidget(ContainerIndex, Parent);
      ChildWid.GetChild(ParentWid, Child);
      Self.Reference := ChildWid.Reference;
      ParentWid.Free;
    end;
    
    function TReflectWidget.GetText: String;
    begin
      Result := Reflect.Smart.GetFieldString(Self.Reference, Widget_Text);
    end;
    
    function TReflectWidget.GetItemID: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_ItemID);
    end;
    
    function TReflectWidget.GetItemStackSizes: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_ItemAmount);
    end;
    
    function TReflectWidget.GetRelativeX: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_RelativeX);
    end;
    
    function TReflectWidget.GetRelativeY: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_RelativeY);
    end;
    
    function TReflectWidget.HasValidBoundsIndex: Boolean;
    begin
      Result := (Self.GetBoundsIndex >= 0) and
        (Self.GetBoundsIndex < Reflect.Smart.GetArraySize(0, Client_WidgetPositionX, 0));
    end;
    
    function TReflectWidget.GetScrollX: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_ScrollX);
    end;
    
    function TReflectWidget.GetScrollY: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_ScrollY);
    end;
    
    function TReflectWidget.GetWidth: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_Width);
    end;
    
    function TReflectWidget.GetHeight: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_Height);
    end;
    
    function TReflectWidget.GetBoundsX: Integer;
    begin
      if HasValidBoundsIndex then
        Result := Reflect.Smart.GetFieldArrayInt(0, Client_WidgetPositionX, Self.GetBoundsIndex);
    end;
    
    function TReflectWidget.GetBoundsY: Integer;
    begin
      if HasValidBoundsIndex then
        Result := Reflect.Smart.GetFieldArrayInt(0, Client_WidgetPositionY, Self.GetBoundsIndex);
    end;
    
    function TReflectWidget.GetAbsoluteX: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_AbsoluteX);
    end;
    
    function TReflectWidget.GetAbsoluteY: Integer;
    begin
      Result := Reflect.Smart.GetFieldInt(Self.Reference, Widget_AbsoluteY);
    end;
    
    function TReflectWidget.GetX: Integer;
    var
      Parent: TReflectWidget;
    begin
      if not Parent.GetParent(Self.GetParentID) then
        Exit(Self.GetBoundsX);
      Result := Parent.GetX + Self.GetAbsoluteX;
      Dec(Result, Self.GetScrollX);
      Parent.Free;
    end;
    
    function TReflectWidget.GetY: Integer;
    var
      Parent: TReflectWidget;
    begin
      if not Parent.GetParent(Self.GetParentID) then
        Exit(Self.GetBoundsY);
      Result := Parent.GetY + Self.GetAbsoluteY;
      Dec(Result, Self.GetScrollY);
      Parent.Free;
    end;
    
    function TReflectWidget.GetPosition: TPoint;
    begin
      Result := Point(Self.GetX, Self.GetY);
    end;
    
    function TReflectWidget.IsHidden: Boolean;
    var
      Parent: TReflectWidget;
    begin
      Result := (Parent.GetParent(Self.GetParentID) and Parent.IsHidden) or
        Reflect.Smart.GetFieldBoolean(Self.Reference, Widget_IsHidden);
      Parent.Free;
    end;
    
    function TReflectWidget.IsValid(ContainerIndex, ParentIndex: Integer): Boolean;
    var
      Parent: TReflectWidget;
    begin
      Parent.GetWidget(ContainerIndex, ParentIndex);
      Result := (Parent.NotNull) and (not Parent.IsHidden);
      Parent.Free;
    end;
    
    function TReflectWidget.GetBounds: TBox;
    begin
      if not Self.NotNull then
        Exit(IntToBox(-1, -1, -1, -1));
      Result.X1 := Self.GetX;
      Result.Y1 := Self.GetY;
      Result.X2 := Result.X1 + Self.GetWidth;
      Result.Y2 := Result.Y1 + Self.GetHeight;
      if (Result.X1 < MSX1 - 5) or (Result.Y1 < MSY1 - 5) or (Result.X2 > 764) or
        (Result.Y2 > 502) then
        Exit(IntToBox(-1, -1, -1, -1));
    end;
    
    function TReflectWidget.Interact(Option: string = ''): Boolean;
    var
      Bounds: TBox;
    begin
      Bounds := Self.GetBounds;
      Reflect.Mouse.Move(Bounds);
      if (Option = '') or (Reflect.Text.IsUpText(Option, RandomRange(80, 120))) then
      begin
        Reflect.Mouse.Click(Mouse_Left);
        Exit(True);
      end else
      begin
        Reflect.Mouse.Click(Mouse_Right);
        RandomRange(50, 150);
        Result := Reflect.Text.ChooseOption(Option);
      end;
    end;
    
    function TReflectWidget.Interact(Offset: Integer): Boolean; overload;
    var
      Bounds: TBox;
    begin
      Bounds := Self.GetBounds;
      Bounds.X1 := Bounds.X1 + Offset;
      Bounds.X2 := Bounds.X2 - Offset;
      Bounds.Y1 := Bounds.Y1 + Offset;
      Bounds.Y2 := Bounds.Y2 - Offset;
      Reflect.Mouse.Move(Bounds, Mouse_Left);
    end;
    
    function TReflectWidget.Interact(
      Option: string = ''; Offset: Integer): Boolean; overload;
    var
      Bounds: TBox;
    begin
      Bounds := Self.GetBounds;
      Bounds := [Bounds.X1 + Offset, Bounds.Y1 + Offset,
        Bounds.X2 - Offset, Bounds.Y2 - Offset];
      Reflect.Mouse.Move(Bounds);
      if (Option = '') or (Reflect.Text.IsUpText(Option, RandomRange(80, 120))) then
      begin
        Reflect.Mouse.Click(Mouse_Left);
        Exit(True);
      end else
      begin
        Reflect.Mouse.Click(Mouse_Right);
        RandomRange(50, 150);
        Result := Reflect.Text.ChooseOption(Option);
      end;
    end;
    
    function TReflectionWidget.GetText(Parent, Child: Integer;
                                       GrandChild: Integer = -1): String;
    var
      W, WChild: TReflectWidget;
    begin
      W.GetWidget(Parent, Child);
      If (GrandChild > -1) then
      begin
        WChild.GetChild(W, GrandChild);
        Result := WChild.GetText;
        WChild.Free;
      end else
        Result := W.GetText;
      W.Free;
    end;
    
    function TReflectionWidget.WaitText(Text: String; Parent, Child: Integer;
                                 GrandChild: Integer = -1; WaitTime: Integer = 5000;
                                 PerLoop: Integer = 100): Boolean;
    var
      T: TReflectTimer;
    begin
      T.Restart;
      repeat
        If (GrandChild = -1) then
          Result := (Pos(Text, Self.GetText(Parent, Child)) > 0)
        else
          Result := (Pos(Text, Self.GetText(Parent, Child, GrandChild)) > 0);
        Wait(PerLoop);
      until(Result)or(T.ElapsedTime > WaitTime);
    end;
    If all pork-chops were perfect, we wouldn't have hot-dogs.

  2. #2
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Reflection is up to date? hooks too?
    Formerly known as Undorak7

  3. #3
    Join Date
    Apr 2014
    Posts
    323
    Mentioned
    0 Post(s)
    Quoted
    131 Post(s)

    Default

    Quote Originally Posted by Lipcot View Post
    Reflection is up to date? hooks too?
    I think so. How can I check?
    Last edited by hakishakataki; 10-10-2017 at 03:05 AM.
    If all pork-chops were perfect, we wouldn't have hot-dogs.

  4. #4
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by hakishakataki View Post
    I think so. How can I check?
    check the hooks thread to see if you have the same.

    And to check if reflection is up to date look in the Reflection.Simba if you have the same one as the github.

    If not, just delete your include and re-download it from the github
    Formerly known as Undorak7

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
  •