Results 1 to 2 of 2

Thread: Cutting a Deck after dealing assumes initial deck size

  1. #1

    Question Cutting a Deck after dealing assumes initial deck size

    Hi,

    I want to shuffle, then deal, then cut a deck using a script to automate setup. However, the deck.cut() seems to assume the deck still has all the cards in it. For example, if the deck has 20 cards and I deal 4, then cutting creates a new deck with 10 cards, leaving 6 in the original deck. Why is that and can I do anything about it?

    By the way, how to best get the GUID of the newly cut-created deck?

    I skimmed through some of the cards and deck related threads in the scripting section and, apparently, the source code is not up-to-date on that topic. Is there some central place where the currently relevant information on decks and the exceptions (e.g. default decks) are collected and updated? Reading bits and pieces here and there in the forum is quite tedious.

    Thanks!

  2. #2
    Join Date
    May 2016
    Posts
    1,072
    There is no centralized place, no. But I am happy to share my experience.

    To cut a deck without issue, I would recommend using takeObject on every card in a deck and placing them into 2 separate piles. Then use a short timer to wait about 0.5 or 1 seconds to continue the code, allowing the cards to fall down into place and become decks. Then use either a scripting zone to locate your 2 new decks or some such method.

    For reference, the deck splitter workshop tool does split decks into even piles, and if you needed a reference it could help for that portion. Also, if your deck has over 100 cards in it, then spitting it in this way is problematic (you're effectively spawning 100 objects in an instant). So depending on your goals here, it may not work.

    As for .cut(), support for deck handling via scripts is pretty light. If you're using deck.cut() in the same time you're using takeObject() to remove cards from the deck, then I could see that causing an uneven split. Even though you just told the deck to take out some cards, the cut happens at the same instant, so you're cutting the whole deck and a few cards are flying out of the old deck as you do it. I haven't tested this but it wouldn't surprise me.

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
  •