Results 1 to 1 of 1

Thread: Moving Cards/Decks From Script Zone to Coordinates

  1. #1

    Question Moving Cards/Decks From Script Zone to Coordinates

    Hello there, I am looking for a solution on how to gather cards in one zone and move them to another (In this case, a discard pile). The following is what I have so far. My knowledge is self taught and pieced together, so any advice or help is appreciated.
    Note that the obj.destruct() is a placeholder for me to test that the script was recognizing cards and decks are in the zone at the same time:

    Code:
    BlueZoneGUID = "6e422e"
    BlueDiscardGUID = "4b9679"
    
    function onLoad()
        BlueZone = getObjectFromGUID(BlueZoneGUID)
        BlueDiscard = getObjectFromGUID(BlueZoneGUID)
    
        params = {
            click_function = "DiscardArea",
            function_owner = self,
            label          = "Discard",
            position       = {0, 1, 0},
            rotation       = {0, 180, 0},
            width          = 800,
            height         = 400,
            font_size      = 340,
            color          = {0.5, 0.5, 0.5},
            font_color     = {1, 1, 1},
        }
        self.createButton(params)
    end
    
    function DiscardArea(obj, color, alt_click)
      zoneObjects = BlueZone.getObjects()
      for k, obj in pairs(zoneObjects) do
        if obj.tag == 'Card'or obj.tag == 'Deck' then
        obj.destruct()
        end
      end
    end
    EDIT:
    Oooooooooooo boy am I a smarty. I forgot to bracket my coordinates with {} so when I was doing "obj.setPositionSmooth(...)" earlier I was getting an error. Here's the fixed bit for future reference so nobody else has to look dumb like me
    Code:
    function DiscardArea(obj, color, alt_click)
      zoneObjects = BlueZone.getObjects()
      for k, obj in pairs(zoneObjects) do
        if obj.tag == 'Card'or obj.tag == 'Deck'then obj.setPositionSmooth({10,10,10},false,true)
        end
      end
    end
    Last edited by AzureFalcon; 01-11-2021 at 10:47 PM.

Similar Threads

  1. Replies: 2
    Last Post: 05-14-2020, 05:38 PM
  2. Replies: 0
    Last Post: 10-24-2018, 01:03 AM
  3. Suggestion: Moving the hand zone in VR
    By Unreal_Ed in forum VR Support
    Replies: 0
    Last Post: 07-21-2017, 12:26 PM
  4. [SOLVED] Hidden Zone and object script bug
    By MrStump in forum Scripting Bug Reports
    Replies: 1
    Last Post: 05-20-2017, 01:06 PM
  5. Can you create a script zone using scripts?
    By Tragic in forum Scripting
    Replies: 2
    Last Post: 05-11-2017, 03:18 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
  •