Results 1 to 7 of 7

Thread: Pointer Help

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Pointer Help

    I'm being lazy and I'm getting a runtime error I'm not sure why. So heres a condensed version of the code:

    SCAR Code:
    program New;

    const
      PWR_Mining = 0;
      PWR_Woodcutting = 1;
      PWR_Fishing = 2;

      Inv_Count = 1;
      Inv_Load = 2;

    type
      TPointerInfo = Record
        Check: Function(Index: Integer): Integer;
        FollowObj: Function(Col: Integer; TP: TPoint): Boolean;
        Equiptment: Function(Index: Integer): Boolean;
        Rec: Procedure(Index: Integer);
        Move: Function: Boolean;
      end;

    var Location: Array of TPointerInfo;
        GlobalIndex: integer; ConstIndex: Integer;
        DropArr: TStringArray;

    Procedure LoadLibrary(Index: Integer);
    begin
      case Index of
        PWR_Mining:
        begin
          with Arr[CurrentPlayer][0] do // iron
          begin
            timer := 6000;
            sat := 0.17;
            hue := 0.07;
            lum := 15;
            Col := 2371405;
            name := 'Iron';
          end;
          with Arr[CurrentPlayer][1] do // copper
          begin
            timer := 12000;
            sat := 0.84;
            hue := 0.02;
            lum := 10;
            Col := 4225488;
            name := 'Copper';
          end;
          with Arr[CurrentPlayer][2] do // tin
          begin
            timer := 12000;
            sat := 0.12;
            hue := 0.07;
            lum := 15;
            Col := 8027016;
            name := 'Tin';
          end;
        end;
        PWR_Woodcutting:
        begin
          with Arr[CurrentPlayer][0] do // Normal
          begin
            hue := 0.10;
            sat := 1.58;
            col := 1988169;
            Lum := 8;
            Width := 8;
            Height := 8;
            name := 'Tree';
            timer := RandomRange(50000, 120000);
          end;
          with Arr[CurrentPlayer][1] do // Oak
          begin
            hue := 0.06;
            sat := 0.79;
            col := 3176040;
            Lum := 10;
            Width := 15;
            Height := 15;
            name := 'Oak';
            timer := RandomRange(50000, 120000);
          end;
          with Arr[CurrentPlayer][2] do // Willow
          begin
            hue := 0.50;
            sat := 0.45;
            col := 7314065;
            Lum := 8;
            Width := 5;
            Height := 5;
            name := 'Willow';
            timer := RandomRange(50000, 120000);
          end;
        end;
        PWR_Fishing:
        begin
          with Arr[CurrentPlayer][0] do // Fishing Spot
          begin
            hue := 0.07;
            sat := 0.13;
            col := 10919318;
            Lum := 15;
            Width := 3;
            Height := 3;
            name := 'Fishing Spot';
            timer := RandomRange(12000, 240000);
          end;
        end;
      end;
    end;
       
    Procedure SetPointers(Which: String);
    begin
      case Lowercase(Which) of
        'mining':
        begin
          with Location[CurrentPlayer] do
          begin
            Rec := @LoadLibrary;
            FollowObj := @IsMining;
            Check := @TextCheck;
            Equiptment := @FindEquipt;
            Move := nil;
          end;
          ConstIndex := PWR_Mining;
          DropArr := [Arr[CurrentPlayer][GlobalIndex].Name, 'em'];
        end;
        'woodcutting':
        begin
          with Location[CurrentPlayer] do
          begin
            Rec := @LoadLibrary;
            FollowObj := @FollowPixelBox;
            Check := @TextCheck;
            Equiptment := @FindEquipt;
            Move := nil;
          end;
          ConstIndex := PWR_Woodcutting;
          DropArr := ['og', 'est'];
        end;
        'fishing':
        begin
          with Location[CurrentPlayer] do
          begin
            Rec := @LoadLibrary; // Runtime Error (probably for all)
            FollowObj := @FollowPixelBox;
            Check := @TextCheck;
            Equiptment := @FindEquipt;
            Move := @MoveFishingSpots;
          end;
          ConstIndex := PWR_Fishing;
          DropArr := ['almon', 'rout', 'hrimp', 'chovie', 'ardine', 'erring'];
        end;
      end;
    end;

    This error occures when I try to set up a player fishing. Help would be appreciated (I think I set my pointers wrong?).
    “Ignorance, the root and the stem of every evil.”

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    /me points at code
    "rite der!"
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  3. #3
    Join Date
    Sep 2009
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    /me points at code
    "rite der!"
    ‎‎‎

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    /me points at code
    "rite der!"
    Quote Originally Posted by ABC.def.GHI View Post
    ‎‎‎
    I dont get the point of either of those posts
    “Ignorance, the root and the stem of every evil.”

  5. #5
    Join Date
    Dec 2007
    Location
    Williston, ND
    Posts
    3,106
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    I dont get the point of either of those posts
    it's called spam blumble, ignore it
    Proud owner of "Efferator" my totally boted main account!
    "You see, sometimes, science is not a guess" -Xiaobing Zhou (my past physics professor, with heavy Chinese accent)

  6. #6
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The rest work? If so, I don't know. I always thought that to call the property of a Record, you had to do this:

    RecordName.ProperyName

    ~Sandstorm

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    The rest work? If so, I don't know. I always thought that to call the property of a Record, you had to do this:

    RecordName.ProperyName

    ~Sandstorm
    the record works fine its the pointers. I'm using a With..do Statement with the records which allows me to just use Rec not Location[CurrentPlayer].Rec . So I dont think thats the problem. Edit: If the parameters arent required when setting the pointer I cant find the problem :/

    Edit: /Thread I didnt set the length of the array -.- Sorry for the trouble people.
    “Ignorance, the root and the stem of every evil.”

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
  •