Results 1 to 4 of 4

Thread: TReflectGroundItemArray.GetAll function not functioning correctly

  1. #1
    Join Date
    Jun 2016
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default TReflectGroundItemArray.GetAll function not functioning correctly

    When using the GetAll function, it does not find items correctly. After a whole bunch of testing, I worked out what the problem is. I narrowed it down to the sort function. When it sorts through each item in the array, if it finds the item at the tile, it sets the new array's value to that. The problem being that when there was a stack of objects, all the objects would appear as the same object. Meaning when trying to find something such as feathers like this guy https://villavu.com/forum/showthread.php?t=116860 If there were other things in that stack, there was a chance the getall function (and in turn any function that used the getall function, such as get and find) would not return feathers as being there at all. So if there is a stack on the ground of raw chicken, feathers and bones, Getall would return Raw chicken Raw Chicken Raw Chicken.

    So after narrowing it down to the sort function and managed to see what the problem was.

    So, in the GroundItems script, line 17
    Simba Code:
    for C := 0 to L - 1 do
          if (Tpa[I].Y = Self[C]._Tile.Y) and (Tpa[I].X = Self[C]._Tile.X) then
          begin
            Temp[I] := Self[C];
            exit; // add this line
          end;


    EDIT: Okay, now it's really fixed. Rather than increment in the C for loop, i just exit out, so that it does the I for loop again, automatically doing it. No more errors!
    Last edited by Rangerxmage; 02-17-2017 at 04:05 AM.

  2. #2
    Join Date
    Jul 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    After I edit the file and add what you've said it works. Although won't the GroundItems script be changed again back to default when Reflect lib updates? If so is there another way to do this without modifying the Reflection library script?

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by My Original Nickname View Post
    After I edit the file and add what you've said it works. Although won't the GroundItems script be changed again back to default when Reflect lib updates? If so is there another way to do this without modifying the Reflection library script?
    Override the reflection function in the local script.

  4. #4
    Join Date
    Jul 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by tls View Post
    Override the reflection function in the local script.
    Didn't know how to at first but with a bit of trial and error figured it out. Thanks, everything works perfectly now.

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
  •