Create account / Log in

Player name associated with player side

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Player name associated with player side

Postby Chase » September 8th, 2013, 3:13 am

I would like to display the player name for each player in my game on the board but I can't figure out the correct property name. I've created an at-start stack with a text label containing $PlayerName$ but it displays the current player name. Is there a list of global properties somewhere that I can refer to?

Thanks!
Chase
 
Posts: 2
Joined: September 8th, 2013, 3:09 am

Re: Player name associated with player side

Postby capi3101 » September 9th, 2013, 3:15 pm

If I understand your issue correctly, try $playerId$. playerId lists the player name, playerSide lists their current side.

Unless I have your problem backwards...
No matter how many friends you think you have
and no matter how popular you think you are,
the size of your funeral is going to depend on the weather.
capi3101
 
Posts: 122
Joined: July 22nd, 2013, 9:39 pm
Location: Norman, Oklahoma (USA)

Re: Player name associated with player side

Postby Chase » September 10th, 2013, 12:34 am

Thanks for your help. I think my question was unclear. Say I have a game for up to three players, defined by player sides P01, P02 and P03. In a particular instance of the game, the players are:

P01 - Bob
P02 - Rachel
P03 - Adolpho

I would like to set it up so the usernames (Bob, Rachel, Adolpho) appear on the board automatically. I know the usernames are stored somewhere because the active player name can be accessed, but I can't figure out how to refer them.
Chase
 
Posts: 2
Joined: September 8th, 2013, 3:09 am

Re: Player name associated with player side

Postby capi3101 » September 10th, 2013, 3:58 am

Okay, so you would like for the names of the players to appear somewhere in your play area once the game has begun, right? That is a might trickier...I started working on a solution; I don't have time to finish it tonight but hopefully I can get back to you tomorrow.
No matter how many friends you think you have
and no matter how popular you think you are,
the size of your funeral is going to depend on the weather.
capi3101
 
Posts: 122
Joined: July 22nd, 2013, 9:39 pm
Location: Norman, Oklahoma (USA)

Re: Player name associated with player side

Postby capi3101 » September 10th, 2013, 1:52 pm

Lemme give you the short version of my solution - I haven't had opportunity to test it out this morning. Basically, what I was doing involved a set of Action Buttons on the main menu; after your players have rolled dice or picked straws or chucked a live raccoon the furthest distance or whatever they've done to pick the first player, they would use those buttons to "log in" as a particular Player Number - a set of three custom Global Properties (named P01, P02 and P03) serves as information holders for who's who. Your existing At-Start stack would contain at least one text label (I'm still working out whether or not you can get away with just one or if you need three; so far VASSAL has not been respecting \n as a newline character in 3.2.8), three Set Global Property traits - each of which sets a particular Player Number property to the player name of whoever activated it, and three Trigger Action traits - which 1) watches for the use of a particular button and 2) fires if the selected player number is still blank and if the current player hasn't already selected a different player number.

Now, that's what I was trying to do last night. It got late enough that I had to go to bed and it wasn't working then, but then again I hadn't set up some of the features either. I'll have a little time to work in VASSAL in about an hour from now; I'll try again, see if I can get it working, and give you more detailed instructions if it works.
No matter how many friends you think you have
and no matter how popular you think you are,
the size of your funeral is going to depend on the weather.
capi3101
 
Posts: 122
Joined: July 22nd, 2013, 9:39 pm
Location: Norman, Oklahoma (USA)

Re: Player name associated with player side

Postby capi3101 » September 10th, 2013, 6:24 pm

Figured out what was wrong with my mod...makes a hell of a difference when you're wanting to display the value of a Global Property if you've actually put that bit in correctly...

Okay, so here's what I did:
1) At the module level, I set up three Global Properties, P01, P02 and P03. I set their values to " " and made sure they were non-numeric.
2) I set up three Global Key Commands at the module level with the names "I am P1", "I am P2" and "I am P3". These would send the hotkey CTRL-1, CTRL-2 and CTRL-3 respectively.
3) I added a Toolbar Menu called "Player Select", which includes I am P1, I am P2 and I am P3; this is why they don't show up directly on the menu toolbars.
4) I added an At-Start Stack on the main board and added a Single Piece to it, Msg - here are its traits:
a) Basic Piece: just calls it Msg, no image tiles involved.
b) Does not Stack: Allows it to be selected normally but not moved. Not sure if it would work if you set it to not select; you might give that a try.
c) Text Label: The text label in place is <html>P01: $P01$<br/>P02: $P02$<br/>P03: $P03$<br/>$PlayerId$</html>. The last PlayerId was there for testing purposes; you can remove that in the final version.
d) Set Global Property - I have three of these, one for each of the three Global Properties involved. When they are invoked, they set the value of one of the Global Properties to PlayerId. Now here's the key - they're activated on ALT-1, ALT-2 and ALT-3.
e) Trigger Action - again, there are three of these. Each one sits and watches for a specific hotkey combination (CTRL-1, CTRL-2, and CTRL-3) and triggers ALT-1, ALT-2 or ALT-3 (i.e. these are the triggers for the Set Global Property traits). These are set up as filters - first, to make sure that no one has already claimed that particular player spot, and secondly to make sure that a player does not select more than one spot for themselves.

So, let's say I'm playing a game with the name "Fubar". I open up the module and want to play as P02. I go and select "I am P2" under the Player Section menu button. I am P2 sends out the Global Key Command CTRL-2, which my Msg piece picks up. CTRL-2 is one of the hotkey sequences it's watching, so it checks its trigger filters and sees that P02 is currently empty and Fubar has selected no other player positions, so it sends the ALT-2 hotkey sequence, which is then picked up by the Set Global Property command - P02 is then set to "Fubar", which the Text Label will then automatically display.

Right now, there is no provision in this design for a player to switch player number if they need to, but that can be added easily by additional action triggers and Set Global Property commands.

I've gone ahead and attached my text mod for your examination. Hopefully it'll better illustrate anything I haven't been clear about. And hopefully it's of some use to you.
Attachments
player_name_test.zip
Display Player Name example
(2.54 KiB) Downloaded 125 times
No matter how many friends you think you have
and no matter how popular you think you are,
the size of your funeral is going to depend on the weather.
capi3101
 
Posts: 122
Joined: July 22nd, 2013, 9:39 pm
Location: Norman, Oklahoma (USA)


Return to Module Design

Who is online

Users browsing this forum: No registered users and 2 guests