Results 1 to 3 of 3

Thread: takeObject help, please....

  1. #1

    takeObject help, please.... has a nifty black cube that draws specific cards. I've modified it a bit to suit my needs, but one aspect of its behavior is driving me nuts.

    What it currently does:

    1. You change the object's name to the name of the card you want and push the button.
    2. It draws the matching card that's closest to the bottom.
    3. Continued pushing of the button continues to draw cards with that name.
    4. When those cards run out, it starts drawing whatever random card is on the bottom.

    #4 is the problem. When it runs out of cards I want it to draw nothing and print ('No Card Found') -- or better yet change an 'R' do a 'D' and try again. Everything I do to try change this just breaks it's finding ability. I've searched this forum (and every other) and can't seem to find any examples of a similar approach to inspire a solution. I would appreciate any help someone would be willing to give.

    Here's the current modified script:

    color = {r=255,g=255,b=2550,a=0},

    ad_GUID = 'fadf55'

    function onload()

    adv_deck = getObjectFromGUID(ad_GUID)


    function draw()
    local params = {top=false,position={-5.189,8,-31.253}}
    for k,v in pairs(adv_deck.getObjects()) do
    if (string.find(string.lower(v.nickname),string.lower (self.getName()))) then
    params.guid = v.guid

  2. #2
    Move the adv_deck.takeObject(params) to just before the break statement. You only want to take a card if the match succeeds.

    Good lucki!

  3. #3
    That fixed it. Thanks, CCHE!

Similar Threads

  1. Need Help with takeObject() Please
    By in forum Scripting
    Replies: 7
    Last Post: 08-03-2017, 08:30 PM
  2. Decks Not Loading After takeObject
    By Eskander in forum Scripting
    Replies: 1
    Last Post: 09-14-2016, 07:29 PM
  3. Replies: 3
    Last Post: 08-15-2016, 07:08 AM
  4. [SOLVED] 7.7 seems to have introduced a bug in takeObject for decks
    By dlgreenwald in forum Technical Support
    Replies: 4
    Last Post: 07-24-2016, 10:33 PM
  5. Unity5-b5 .takeObject() BUG
    By dizneyguy in forum Scripting
    Replies: 2
    Last Post: 04-05-2016, 09:55 AM

Posting Permissions

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