Results 1 to 9 of 9

Thread: Bug/Scripting -- change color

  1. #1

    Bug/Scripting -- change color

    Attempting to use the following in onLoad() to set all current players to 'spectator' status (player grey).

    Code:
    	Player[ 'Brown' ].changeColor( 'Grey' )
    	Player[ 'Orange' ].changeColor( 'Grey' )
    	Player[ 'Teal' ].changeColor( 'Grey' )
    	Player[ 'Yellow' ].changeColor( 'Grey' )
    	Player[ 'Green' ].changeColor( 'Grey' )
    	Player[ 'Purple' ].changeColor( 'Grey' )
    	Player[ 'Pink' ].changeColor( 'Grey' )
    	Player[ 'White' ].changeColor( 'Grey' )
    	Player[ 'Blue' ].changeColor( 'Grey' )
    	Player[ 'Red' ].changeColor( 'Grey' )
    On loading the game, it places me as player White, irrespective of what my color was prior to loading the game.

    There's multiple reasons to do this -- the primary one I see being that when loading a saved in-progress version of the game, the host doesn't automatically have to see all the hidden components of player White.

    Perhaps my use of the changeColor() function is wrong, but hard to know since it's currently not included in the scripting documentation.

  2. #2
    Looking at this, my hunch is that it should be "Gray" rather than "Grey". I think TTS just defaults to white if it doesn't understand what you're trying to do.

  3. #3
    Tried it with both Gray and Grey... actually was Gray first, then tried changing.

    Note:
    Tried again today, and works now. Maybe I fumbled something earlier.

  4. #4
    Wait, there is a player "changeColor" function? I couldn't find it in the API.

    This would be so useful for this mod, except... I need to figure out whether undesired behavior would occur if grey is used as a temporary holding zone.

    The main problem I have though is that multiplayer functions are difficult to test. I'm not confident testing on a hotseat table, as some functions (like getting player name) don't seem to work right.

  5. #5
    That snippet of code in the original post will change all seated players to the neutral Grey -- I need to test in MP to confirm, but it is functional in SP. I use it in the onLoad() function to clear everyone's assignment.

    Where you may run into trouble is assigning someone that is currently Grey into another color -- since more than 1 player can be Grey, I think you'll run into issues changing color of any player grey.

    I haven't had issues with getting player name.
    Code:
    Player['White'].steam_name = x
    print(x)
    Will result in getting player White's steam name and printing it in chat for host. Note that the color is a string.

    and if you're triggering a function with a button....

    Code:
    function clickedButton(clickedObj, playerClicked)
    Player[playerClicked].steam_name = x
    print(x)
    Will print the steam name of the player that clicked the button triggering that function.

  6. #6
    Oh, I should've clarified - if using the hotseat function, the steam_name variable works fine for Player 1. But not any of the other players.

    Where you may run into trouble is assigning someone that is currently Grey into another color -- since more than 1 player can be Grey, I think you'll run into issues changing color of any player grey.
    Yeah that's what I was worried about. It'll all depend on whether if I use "x = Player['Blue']", is x tied to that player regardless of how I reseat them, or is it tied to the blue seat?

  7. #7
    The colors of the players is all by seat, as far as I can tell.

    So if player blue changes to player white, that player will not be player white for all subsequent commands.

    So you could use an unused color as a holding color if you need an interim between switching? maybe? just speculation.

  8. #8
    Join Date
    Jan 2014
    Posts
    986
    Hotseat will not really 100% behave correctly for player scripts due to how we fake it internally, this might improve in the future when we rewrite the code for it.

  9. #9
    So you could use an unused color as a holding color if you need an interim between switching? maybe? just speculation.
    Problem is that won't work if all ten seats are filled.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •