Conditional Branch Script

Hope this is the right place.
I've found this cool script by Maximusmaxy that creates a Triple Triad system but I'm having an issue.
To play, I must have at least 5 cards, but when I call the minigame by
Ruby:
$scene = Scene_Triple_Triad.new(  [TYPE,NUMBER])
my cards number gets ignored and if I have less than 5 cards I get stuck.
I was thinking I could use a Conditional Branch to check the card number, but I dunno how.

Unsure about the rules, but if needed I can post the script here.
You can set a script condition in two different ways.

1. Option

if NUMBER >= 5
$scene = Blah... Blah... # Whatever goes here.
end

2. Option

Script Call Condition Command

if NUMBER >= 5

And later place the scene script call inside the event command branch.

In both cases you gotta replace NUMBER with the actual variable that holds your number of cards currently available.
Okay, I kind of figured it out, problem is I don't know how to set the card variable.
I've found a $game_party.tt_cards in the script but I don't know how to put it.
I tried
Code:
if $game_party.tt_cards < 5
          @tt_help = Window_TT_Help.new
          @tt_help.pop_up('XXX')
          else $game_player.straighten
          $scene = Scene_Triple_Triad.new( 
[1,1])
But it doesn't seem to work.
Also, it seems $game_party.tt_cards somehow results as "6" even when I have one card, and it actually corresponds to the card ID of the only card I own... I don't know if I've been clear, it's kinda messy
Like, if I have the ID 25 card, $game_party.tt_card results as 25... So I guess I'm using the wrong thing?
It should say >= 5 (greater or equal to) not < 5 (less than)...
sorry. I thought writing it like that would mean
"if cards are less than 5 don't play
Else (?) start the triple triad minigame"

So should it be
if $game_party.tt_cards >= 5
$game_player.straighten
$scene = Scene_Triple_Triad.new(
[1,1])
?

Also, what about the fact that $game_party.tt_cards doesn't seem to indicate the number of cards I'm holding but just the ID of the last card I got (or something like that?)
Sorry for the bother, I barely understand codes...
Looks like a bug with the tt_cards method:
Code:
  def tt_cards
    cards = 0
    for i in [email hidden]
      cards += 1 unless i == nil #<=== This one right here, officer
    end
    return cards
  end
I believe the author meant to check if the number of possessed cards for ID was nil. It's also not taking into consideration if you have more than 1 of a specific card, assuming that's how TT works...not sure if it's 5 total cards or 5 unique cards. Also needed to consider if you removed cards later.
Code:
cards += @cards[i] if @cards[i] && @cards[i] > 0
Due to a lack of a Ruby-centric coding style, I doubt this is all the bugs this script has to offer.
It should check 5 unique cards, vanilla style.
Btw, seems to work... Yes, I'm already fixing other bugs but thankfully it's been simple stuff til now.
Thanks a lot for now!

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-script.145920/