noob help please

Thanks very much seth.

I haven’t played around with commands and references at all yet, but let me give it a bash and I’ll let you know how I get on!

You can download my Here I Stand module and look at what I did for card dealing via toolbar menu. I’m not saying it’s the best or only approach, but it works. Each player hand has a named region on it, then all event cards have triggers and STLs on them to send them to a player’s hand, even if you don’t have access to that hand. The toolbar menu organizes all the Global Key Commands (which “deal” varying numbers of cards) by power.

Done. Thanks.

Now how do I get that right-click dialog to work when I right click on one of the cards in the deck?

Also, ideally when I use the “draw” command on a card, I would like it to display them side-by-side in the player window. However it currently adds them to a pile. I tried to use the additional x/y offset in the ‘Send to location’ settings, but it didn’t seem to do anything.

To issue a command to a card in a deck, add a Global Key Command to the deck. Right-click the deck entry in the module editor.

The easiest way to display cards side-by-side is by using a Player Hand.

Ace, worked a treat (once i figured out how to make a basic GKC work!).

I am using a Player Hand window, but when I ‘Send to location’ the cards get stacked, is there an option somewhere for offsetting each additional card or something?

b0n3r,
Dogboy has an excellent post on how to improve the behavior of Player Hands. Admittedly, I never use them myself, but I recall this working perfectly:
https://forum.vassalengine.org/t/help-for-a-newbie/4656/1
Essentially:

  1. Have the Player Hand window send a command to all pieces ending movement on the map; this should be a Trigger Action which then calls a Send to Location to the position of the first piece.
  2. Avoid infinite loops with a Property Match Expression in the Trigger Action (‘only apply when properties match:’) - either check OldMap != NewMap or set a dynamic property such as ‘Moving’ as described in dogboy’s post.

I realize this is brief, so let us know if you have any trouble implementing it.

-Seth

okay I figured out how to do this, however I’m having some trouble with the next part

Decide on a position for the first piece sent to the hand, say, 100,100. Create a Send To Location trait to send your pieces to that point. Now create a Trigger Action trait which calls your STL trait under ‘Perform these keystrokes’. For the ‘Trigger when properties match’ field, or whatever it’s called, enter ‘OldMap != $CurrentMap$’, without quotes. Have your map call the Trigger Action trait, not the STL trait.

Sorry man, I think I missed something, I’m still a little confused.

I played about with various ways to implement this, but I still can’t get it to work, nor really understand how it’s supposed to work.

I drew out a plan to make it work in a way that made sense to me, however maybe slightly messy, but it still wont work, any idea what i’ve got wrong?

Card Protoype:

  • Set dynamic property “NEW” = “true”

Main Map:

  • Right-click on deck activates global key command CTRL-4 to one piece in the deck

Card protoype:

  • CTRL-4 orders ‘Sent to location’ on map “$playerSide$”, board “hand”, position 130, 130.

P1 [Player Hand]:

  • Pieces ending movement here trigger hotkey CTRL-SHIFT-1
  • CTRL-SHIFT-1 is hotkey for GKC for P1 [Player Hand], sending Key Command CTRL-SHIFT-M when matching properties “$NEW$ = false”

Card Prototype:

  • CTRL-SHIFT-M is Trigger Action sending out CTRL-SHIFT-A and CTRL-SHIFT-B
  • CTRL-SHIFT-A is a ‘Move fixed distance’ trait, moving 255,0.
  • CTRL-SHIFT-B resets “NEW” to “false”

Sooooo… When I draw a NEW card, I want it placed at 130,130. THEN move all -OLD- cards on the board 255 to the right. THEN call all cards on the board -OLD-

I’ve been playing around with the setup described above, but I can’t get the desired effects :frowning:

Here’s the link to my vmod file in case that’s easier
dl.dropbox.com/u/28512566/spacefuckbeta.vmod

The settings I applied above apply to the weapon deck (main map), weapon card prototype and P1 hand only

Okay, yes, this is completely different from what I thought you wanted. A few immediate notes, and more when I can look at the module:

  1. The syntax for ‘$NEW$ = false’ should be ‘NEW = false’. Actually, I don’t think that’s the correct logic, but in any case the left-hand side of a comparison is always evaluated as a property.
  2. The key command to send to all pieces ending movement on this map is sent to the piece ending movement on that map, not the map itself. Is there a trait on your pieces which listens for CTRL-SHIFT-1?
  3. CTRL-SHIFT-M is sent to pieces with NEW=false, which moves them and then resets NEW=false. I thought NEW was already false?

-Seth

  1. Ah I see, I’ll change that just now then see how it goes.
  2. aha, I had hoped that by sending a GKC to the map would apply it to every piece on that map, i’ll redirect CTRL-SHIFT-1 straight to the trigger instead
  3. right, thats perhaps just me not knowing exactly how this works, i thought it would apply the NEW=false after moving, so essentially every piece except the new one shifts, then the new one becomes NEW=false also, so next time it’s triggered, it will move too.*

i suppose this will probably cause some problems when I come to removing cards from the hand :-/


Ahhh okay, I see what you mean, I changed the points you mentioned in (1) and (2) now the card just moves as an infinite loop, because when it moves, it re-triggers the ‘ended movement on board’… thingy.

Right, I tidied it up a bit, but I’m noticing the real issue now.

I changed it so the ‘landed on P1 board’ triggers (if moved=false) to: set moved=true, move cards right

this stops the infinite loop by cancelling the trigger before moving

however, now that i can kind of see it almost working, the problem is that these triggers only seem to apply to the selected card, so each card is being drawn, moved right one space - i want every card on the board to move right one space… is this possible?

Yes; use a GKC. ;-)

My point about the GKC was, your map is sending a keystroke to your piece, not the map itself. So you need to have something on the piece that listens to CTRL-SHIFT-1, not on the map. You can have the piece immediately fire a global hotkey to the map if you want, or you can have it fire a GKC to all the other pieces, whatever, but it needs to have something listening for CTRL-SHIFT-1. Here’s what I would do for your situation:

Map:
Key command to all pieces ending movement blah blah: Trigger

Card prototype:
Trigger Action: Sequence GoTo_FirstPosition/SetCalling/GKC_ToOthers_MoveRight/UnsetCalling
Keystroke: Trigger
When properties match: CurrentMap = $playerSide$ Hand && OldMap != $CurrentMap$
Perform these keystrokes:
GoTo_FirstPosition
SetCalling
GKC_ToOthers_MoveRight
UnsetCalling

Send To Location
Key command: GoTo_FirstPosition
Map:
Board:
X: 130 (or whatever)
Y: 130 (or whatever - better, define a named region using a, what ‘irregular grid’ on your board - then it’s more obvious where people should look to change this value)

Dynamic Property: calling
Default: false
Set value directly: ‘true’, SetCalling
Set value directly: ‘false’, UnsetCalling

Global Key Command
Keyboard command: GKC_ToOthers_MoveRight
Global key command: Trigger_MoveRight
Matching properties: calling != true

Move fixed distance
Keystroke: Trigger_MoveRight
Distance to the right: 255
UNCHECK Move entire stack


Substitute whatever keystrokes you want for any of the named keystrokes, if you want to keep using Vassal 3.1.x.  What the above should do is send any card newly moved to the player hand window to the coordinates specified, and then moves all other pieces right by 255 pixels.  There are some problems with this.  What prevents your players from moving cards around themselves?  They may find it very frustrating that their cards keep shifting to the right when they want them organized top to bottom, for example.  Beware the dark, dark path of automation!

-Seth

Thanks a ton Seth. You’re my hero.

I have quite a busy afternoon planned, so will play around with this later when I get a chance.

I know exactly what you mean about the automation issue. I think later perhaps I will rethink the whole system, I really just wanted to get rid of the auto-stacking problem before I start testing the game itself.

Thanks again

Well this is embarrassing. Turns out the player hand tends to behave pretty much how I wanted to by default. The cards I was using had the “Does not stack” trait, simply to avoid snapping to grid. I never realised that with that trait deleted the cards would spread out automatically if i changed my stacking options. That aside, I’ve learned a lot along the way and I’m getting a bit more ambitious!

I’m wondering if there’s a way to remove a ‘right click’ function from a list when a card is face down. Anyone know?

I have a card, which when right clicked has an option “Trade”, and the action works fine, however I only want the “Trade” effect to show up when the card is face-up (so players cant tell its tradable when face-down). Trade is a trigger btw.

I figured it might be something to do with the order of traits, specifically “Mask” and ‘Trade’, however the Mask trait is in one prototype, and the Trigger (Trade) is in another prototype. Changing the order of the two prototypes on the item just moves the position of “Trade” in the right click menu.

I also tried having the trigger only work when certain properties match, eg the card being face-up, but that just grays out the “Trade” option when the card is face-down, so it’s still obvious the card is tradable.

Sure. Mask includes a property called ObscuredToOthers, and this has a value of ‘true’ when the masked piece is face down. So add a Restrict Commands trait and set the property to ObscuredToOthers = true, and for the command to restrict, use the keyboard shortcut for Trade. (Make sure Restrict Commands is beneath the Trade and Mask commands in the list of traits.)

Perfect, thank you very much.

Soooo… I’m back :smiley:

Where on earth would I implement some basic property calculations in Vassal?

I have a deck, where the number of cards in the deck represents the player’s “Power” and I want the user to be able to ‘spend’ the Power (and refresh it).

I have a property expression counter on the deck, which displays the number of cards in the deck (ie Max Power). Then created a Global Property “Power” with default value = $PowerDeck_count$, but this just sets the initial value to "$PowerDeck_count$ in text form even when i try to make it numeric.

So I figured instead have a “PowerSpent” property, with inital value zero, which increments by 1 every time the “Spend Power” command is used (and resetting to 0 when the “Refresh Power” command used. Then just have the text label display “$PowerDeck_count$-$PowerSpent$ of $PowerDeck_count$” where it applies the minus function to the value returned. Thus if Power was at 10, and 1 was spent, the label would read “9 of 10”

I also tried to have the Global Command window perform calculations there for a further property, but it also just ignores my maths expressions

Mr. b0n3r,
This is pretty hard to do in Vassal 3.1. Vassal 3.2 includes support for mathematical expressions through its Beanshell support. In 3.1, to subtract one number from another, the only method I know of is to use a loop, decrementing both values until the one reaches zero.
What about your original idea, however?

  1. The correct property name is probably ‘PowerDeck_numPieces’.

  2. It may not be initialized before the ‘default value’ of your property is evaluated, so it may initially still show as text. Resetting it any time after startup should work, however.

    Also, I don’t know about anyone else but I feel like it would be better to see new questions in new threads, to make searching easier in the future. I realize I’m picking on you at random, as there have been a number of very long threads recently. I’m no etiquette expert, so I apologize if I’m just being silly.

-Seth

If you know that the result of the subtraction will be non-negative, another method would be to create an invisible piece and use Send to Location to move it to, say, (0,$FirstNumber$). In the Advanced Options, your Additional Y Offset would be -1 and the “times” value would be $SecondNumber$. Then have your invisible piece update a ‘Result’ global property with its CurrentY value. (You could also perform multiplication in this way.)

Negative results probably could be accommodated by using a bias on the Y coordinate, the negative of which you have already stored in another global property; for example, a ‘SubtractionBias’ GP that’s set to -10000. In this case, you would first do a Send to Location to (0,10000) with no advanced options, then perform a Move Fixed Distance of (0,$FirstNumber$) with the Advanced Options on the Y coordinate of -1 and $SecondNumber$ as described above. After setting your ‘Result’ GP equal to $CurrentY$, you would then de-bias it by Incrementing it by $SubtractionBias$.

But really, though, all of this is duck-tape abuse of the Vassal engine. Personally I’d rather be patient for the stable production release of 3.2 and just use BeanShell to do the math.