functionName(player, value, id)
player: A direct Player reference to the person that triggered the input.
In hotseat room allway refer to Player1 instead the player who have the turn.
confirmed… ran into this myself…. button(obj, colour, alt_click) will always return the colour of the 1st player on game load in hotseat mode… breaking all camera movment buttons. There is no workaround as far as I know apart of coding a way to input the colour manual someway. So basically all camera movment code dose not work in hotseat mode
Can you give example button code that has this issue? I used deck_c.createButton({
label="Hello", click_function='click', function_owner=Global,
position={x=0, y=0, z=5}, rotation={0,0,0}, scale={10, 10 ,10}
})
and it worked fine
This the XML panel:
<Panel id="panel_voto" active="false" color="#FFFFFF" height="300" width="500">
<Panel color="[#000000](/000000)" height="22" rectAlignment="UpperLeft">
<Text alignment="MiddleCenter" color="#FFFFFF" fontSize="16" fontStyle="Bold">VOTACIÓN Leisure Room:</Text>
</Panel>
<Text position="0 -28 0" alignment="UpperCenter">Cada jugador debe elegir a otro para acusarlo de ser el alien, o abstenerse.</Text>
<Text id="tx_votos_emi" position="0 -130 0" fontSize="16" fontStyle="Bold">Votos realizados: 0/0</Text>
<Button id="boton_vot1" onClick="votacion" height="30" width="120" position="-150 60 0" active="false">COLOR</Button>
<Button id="boton_vot2" onClick="votacion" height="30" width="120" position="-150 -10 0" active="false">COLOR</Button>
<Button id="boton_vot3" onClick="votacion" height="30" width="120" position="-150 -80 0" active="false">COLOR</Button>
<Button id="boton_vot4" onClick="votacion" height="30" width="120" position="0 60 0" active="false">COLOR</Button>
<Button id="boton_vot5" onClick="votacion" height="30" width="120" position="0 -10 0" active="false">COLOR</Button>
<Button id="boton_vot6" onClick="votacion" height="30" width="120" position="0 -80 0" active="false">COLOR</Button>
<Button id="boton_vot7" onClick="votacion" height="30" width="120" position="150 60 0" active="false">COLOR</Button>
<Button id="boton_vot8" onClick="votacion" height="30" width="120" position="150 -10 0" active="false">COLOR</Button>
<Button id="boton_vot9" onClick="votacion" height="30" width="120" position="150 -80 0">ABSTENERSE</Button>
</Panel>
And here the lua code:
function votacion(votante, valor, botonid)
– print(votante.color .. ‘ / ‘ .. botonid .. valor)
if votante_hab_array[votante.color] == false then
broadcastToColor(‘UD YA HA VOTADO’, votante.color, col_tab_array[votante.color] )
else
if UI.getAttribute(botonid, ‘text’) ~= votante.color then
votante_hab_array[votante.color] = false
cuenta_votos = cuenta_votos + 1
UI.setAttribute(“tx_votos_emi”, “text”, ‘Votos realizados: ‘ .. cuenta_votos .. ‘/‘ .. jugadores)
votos_array[votante.color] = UI.getAttribute(botonid, ‘text’)
if UI.getAttribute(botonid, ‘text’) ~= ‘ABSTENERSE’ then
vot_rec_array[UI.getAttribute(botonid, ‘text’)] = vot_rec_array[UI.getAttribute(botonid, ‘text’)] + 1
end
else
broadcastToColor(‘NO PUEDE VOTARSE A SI MISMO’, votante.color, col_tab_array[votante.color] )
end
-- trigerea el fin de la votacion
if cuenta_votos == jugadores then
UI.setAttribute("panel_voto", "active", false)
UI.setAttribute("resultado", "active", true)
print('VOTOS:')
for contador, jug in pairs(sentados) do
textojuntado = jug.color .. ' votó a: ' .. votos_array[jug.color]
UI.setAttribute("tx_voto" .. contador, 'active', true)
UI.setAttribute("tx_voto" .. contador, 'text', textojuntado)
print(textojuntado)
end
print('CONTEO:')
for contador, jug in pairs(sentados) do
textojuntado = jug.color .. ' recibió: ' .. vot_rec_array[jug.color]
UI.setAttribute("tx_votos" .. contador, 'active', true)
UI.setAttribute("tx_votos" .. contador, 'text', textojuntado)
print(textojuntado)
end
end
end
in hotseat votante refers always to Player1, instead the player who was the turn.