#Sypherr - pointers

1 messages · Page 1 of 1 (latest)

dusk peak
#

So, You need to specify a zone per player. Either by using tags, name, description, gm_notes
You need to get references to all of these zones through either looping and checking names/description/gm_notes, or getting them by tag.

#

Then you want to check if getSeatedPlayers is the right number of players seated.
If so, loop over the zones to check if they have a card in them

wooden dagger
#
function getSeatedPlayersWithHands()
    local playerOut = {}
    for _,player in pairs (Player.getPlayers()) do
        if player.getHandCount() > 0 then
            table.insert(playerOut,player)
        end
    end
    return playerOut
end

^ useful for finding only "legal" players.

dusk peak
#

If you do this on a timed Wait (like Wait.time(check_zones, 1, -1) you will loop forever to check this. Or better yet

Wait.time(check_zones, 1)
function check_zones()
  -- do the check
  if check_passed then
    -- do what needs to be done
  else
    Wait.time(check_zones, 1) -- check again in 1 second
end
wooden dagger
#
local seatedPlayerColorsWithHands= getSeatedPlayerColorsWithHands() -- get the colors of the players who are both seated and have hands
local playerZones = {}
for _,o in ipairs(getObjects()) do
  if o.type == "Scripting" then -- if o is a scripting zone
    if o.hasAnyTag(seatedPlayerColorsWithHands) then -- tag each of your scripting zones with the player color string of the owner e.g: "Blue", possibly filter by other tags if required
      table.insert(playerZones ones, o)
    end
  end
end

local faceDownCount = 0
for _,zone in ipairs (playerZones) do
  if card exists and is face down then -- pseudocode
    faceDownCount = 0
  end
end

if faceDownCount == #seatedPlayerColorsWithHands then
  -- all players have placed a card face down!
end

----

function getSeatedPlayerColorsWithHands() -- variant of my link above
    local playerOut = {}
    for _,player in pairs (Player.getPlayers()) do
        if player.getHandCount() > 0 then
            table.insert(playerOut,player.color)
        end
    end
    return playerOut
end
#

^ something like that, a few comments to help you out