Results 1 to 3 of 3

Thread: GUID assignment is not fast enough

  1. #1

    GUID assignment is not fast enough

    Suppose we have an infinite bag that spams tokens and global empty list a, then

    Code:
    for i = 1, 10 do
        a[i]= bowl.takeObject({})
        print(a[i].guid)
    end
    will print 10 identical guids. However, if you just save token objects into a and access it later

    Code:
    for i = 1, 10 do
        a[i]= bowl.takeObject({})
    end
    ...
    Some other function that are called much later
    ...
    for i = 1, 10 do
        print(a[i].guid)
    end
    will correctly print 10 different guids.

    It seems that game spawns 10 tokens at the same time and need more time than script to reassign guids.
    Last edited by Sowiks; 03-07-2017 at 02:10 PM.

  2. #2
    Join Date
    May 2016
    Posts
    1,072
    This is because the objects haven't spawned yet so, at the time of takeObject, they don't all have GUIDs yet. You've called for them to be spawned but they have not yet. Using the callback feature of takeObject is exactly what you need for this. It will trigger after the object has spawned into place, allowing you to get the GUID and execute further code if needed.

    I just had to do this for Roll-O-Matic actually.

  3. #3
    Thank you!

Similar Threads

  1. nil GUID
    By JHolder84 in forum Scripting
    Replies: 2
    Last Post: 04-06-2017, 10:06 PM
  2. takeObject() GUID bug or intended behaviour?
    By Kronark in forum Scripting
    Replies: 3
    Last Post: 02-16-2017, 09:28 AM
  3. Copy text guid
    By Crazy in forum Scripting Bug Reports
    Replies: 1
    Last Post: 02-14-2017, 09:22 AM
  4. Sorting a Deck Causes it to Have a New GUID
    By urenoiro in forum Scripting
    Replies: 8
    Last Post: 10-31-2016, 10:59 PM
  5. Replies: 11
    Last Post: 12-22-2015, 12:55 PM

Tags for this Thread

Posting Permissions

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