Results 1 to 3 of 3

Thread: onObjectLeaveContainer from an infinite bag

  1. #1

    onObjectLeaveContainer from an infinite bag

    When an object is taken out of an infinite bag, the onObjectLeaveContainer event is called with the first instance of the object as the second parameter. This happens even if you take out a second, third, fourth copy of the object. This continues until the first instance is deleted. Once it's deleted it will start calling the event with the first instance taken from the bag since the original one was deleted.

    For example, if there is an infinite bag b which holds instances t1, t2... of a token:
    take t1 from b -> onObjectLeaveContainer(b, t1), which is correct
    take t2 from b -> onObjectLeaveContainer(b, t1), which is incorrect
    take t3 from b -> onObjectLeaveContainer(b, t1), which is incorrect
    delete t1
    take t4 from b -> onObjectLeaveContainer(b, t4), which is correct
    take t5 from b -> onObjectLeaveContainer(b, t5), which is incorrect

  2. #2
    Are you checking the leaving object reference or its GUID? GUID is known to be weird and sometimes incorrect for newly spawned objects. There are open bug reports on that.

    Before someone jumps in with "USE CALLBACK", the onLoad() trigger of copied and pasted object will always have wrong GUID.

    Try this code:
    Code:
    function onObjectLeaveContainer(bag, obj)
        obj.highlightOn({0, 1, 0}, 3)
        print(obj.getGUID())
    end
    As you can see, the printed GUID will be wrong just like you posted, but each new obj highlights green just fine. Which mean the "obj" variable is good, it's just "obj.getGUID()" screwed up. Conclusion - don't use GUID, use the object ref itself. Of course, this is still a bug but there are reports on that already, but onObjectLeaveContainer itself has nothing to do with it.

  3. #3
    You are right, only the GUID is wrong.

Similar Threads

  1. held_by_color is nil in onObjectLeaveContainer
    By kccricket in forum Scripting Bug Reports
    Replies: 3
    Last Post: 05-18-2017, 07:39 AM
  2. held_by_color is nil in onObjectLeaveContainer
    By kccricket in forum Scripting
    Replies: 3
    Last Post: 05-13-2017, 03:36 PM
  3. Infinite Deck?
    By WoodVTier in forum Scripting
    Replies: 8
    Last Post: 11-06-2016, 11:51 AM
  4. Infinite loading
    By Hosboglot in forum General Discussion
    Replies: 0
    Last Post: 04-16-2016, 01:59 PM
  5. [SOLVED] Infinite bag glich
    By merovigiam in forum Technical Support
    Replies: 2
    Last Post: 01-21-2016, 10:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •