Moving a Piece between Two Fixed Positions via GKC

Howdy all. It’s been a few years since I’ve last visited these forums - I’ve largely been working on an RPG campaign these past two years. It’s still not done…

I am glad to see that somebody built a module for Kriegspiel; I really dropped the ball on that one, and I apologize.

As a side project, though, I’m currently working on a VASSAL mod of the Wing Commander Collectible Card Game. Work has been going along at a steady pace on that and I’m hoping to be able to post a finished module sometime in the next week or two for y’all to Share and Enjoy. I am, however, currently stumped with one of the module’s planned features and could use some help with trying to get it to work. What I’m wanting to do is to use an “End Turn” button in order to move a “turn shield”, basically just a semi-transparent piece that partially masks the name of one of the two factions in the game. Push the button, it moves from the left side of the screen to the right. Push the same button again, it moves from the right back to the left. I’ve got the left to right movement down. The right to left movement…isn’t working.

So - basic setup then. I’d got two defined zones on my Main Board, called “Left Player Tag” and “Right Player Tag”. My button is a Board-Level GKC with Button Text of “End Turn” Key Command of ALT-CTRL-0. No other traits are filled in.

My turn shield piece has Traits in this order:

  • Basic Piece
  • Does not Stack[list][*]Select Piece - Never
  • Move Piece - Never
    [/:m][]Send to Location - Move Right* Keyboard Command - ALT-CTRL-8
  • Destination - Zone of Selected Map
  • Zone Name - {“Right Player Tag”}
    [/:m][]Send to Location - Move Left* Keyboard Command - ALT-CTRL-9
  • Destination - Zone of Selected Map
  • Zone Name - {“Left Player Tag”}
    [/:m][]Trigger Action - Trigger Left* Trigger when Properties Match - {$CurrentZone$==“Right Player Tag”}
  • Watch for - ALT-CTRL-0
  • Perform Keystrokes - ALT-CTRL-9
    [/:m][]Trigger Action - Trigger Right* Trigger when Properties Match - {$CurrentZone$==“Left Player Tag”}
  • Watch for - ALT-CTRL-0
  • Perform Keystrokes - ALT-CTRL-8
    [/*:m][/list:u]

The piece is in an At-Start Stack, which is set to the proper board at coordinates 450x150, the centerpoint of the Left Player Tag zone. I’ve tried selecting Use Grid Location - Left Player Tag but I get a message when I try to save the module that that is a bad location name, and I doubt that’s the problem anyways.

From the behavior of the piece, I’m guessing what’s going on is that when I first hit the button, it fires the ALT-CTRL-0, and since the CurrentZone of the piece is the Left Player Tag, the Trigger Right shoots the ALT-CTRL-8 and the piece jumps to the Right Player Tag Zone. The next time I hit the button, the ALT-CTRL-0 is shot but since the piece isn’t in the Left Player Tag anymore, it doesn’t fire Trigger Right and doesn’t try to fire Trigger Left for some reason. Incidentally, when I’ve tried reversing the order of the two Trigger Actions, the End Turn button doesn’t work at all - and I think it’s for the same reason.

So what gives, y’all? How do I go about getting the mod to behave as it should?

I don’t know why your code isn’t working, but you should be able to do this with a single SendToLocation trait:

Send to Location - Move Left or Right

  • Keyboard Command - ALT-CTRL-0
  • Destination - Zone of Selected Map
  • Zone Name - {(CurrentZone == “Left Player Tag”) ? “Right Player Tag” : “Left Player Tag”}

You could give this a try to see if it avoids the problem, whatever that is.

That did the trick. Much thanks, Foobarius. I’d give you rep if the VASSAL forums had that feature.

I’d still like to know why the original setup didn’t work in the first place just for the sake of my own piece of mind. I also don’t quite understand the syntax of the solution - what exactly is going on there?

The Zone Name expression is choosing between two possible results based on a boolean expression, using a Java (well, technically BeanScript) language feature known as the conditional operator. It’s saying 'if CurrentZone equals “Left Player Tag” then use the value “Right Player Tag”, otherwise use the value “Left Player Tag” '.

You can see a more complete explanation of this on wikipedia: https://en.wikipedia.org/wiki/%3F:

Okay, so it’s an inline if-then-else statement. I had never encountered that particular form of the syntax before, but understand the concept (Python’s my usual go-to programming language) and I’ve used it plenty of times my own self. Something to note for the future. Thanks again.

Alright - different question, but same mod; hopefully I’m not derailing my own thread here. My mod is pretty much finished at this point and I’d like to upload the mod to the VASSAL server so folks can start playing with it, but it’s pretty far over the 150MB file size limit. Is the procedure still the same as it was in that case (i.e. contact the webmaster for help), or am I not allowed to have a file that big? Is that e-mail address up to date? If necessary, what do I need to do to have an external link made available to the mod file?

Thus spake capi3101:

Alright - different question, but same mod; hopefully I’m not derailing
my own thread here. My mod is pretty much finished at this point and I’d
like to upload the mod to the VASSAL server so folks can start playing
with it, but it’s pretty far over the 150MB file size limit. Is the
procedure still the same as it was in that case (i.e. contact the
webmaster for help),

Yes.

Is that e-mail address up to date?

Yes. Regardless, webmaster@ should work for any site which isn’t
ignoring decades of convention.


J.

Alright. I contacted the webmaster Sunday morning about helping me with the file. I don’t want to be a troll; when should I try again if I don’t hear back, do you think?

Thus spake capi3101:

Alright. I contacted the webmaster Sunday morning about helping me with
the file. I don’t want to be a troll; when should I try again if I don’t
hear back, do you think?

Your email went into my spam trap; I found it just now. I’ll reply soon.


J.

Ah - I figured something like that might’ve happened. Good to know.

(Joel, I took care of this - T)

I have optimized (reduced file size of the graphics) your module down to about 75mb and it is now uploaded here. The cards are also straightened out so that they are no longer skewed (some were pretty bad).

You can fix your comments section as required. Use this vmod file going forward if you are going to make changes hereafter

Alright, will do. Thanks for helping me out!

Out of curiosity (possibly for the next time I try to build a mod of this scope), what all did you do to the images to optimize them?

I knew about how badly the cards were skewed when I first downloaded them; at the time I figured I’d just leave them be as I thought it would make things look more “authentic”. Looking at the updated mod, I think I like it better with everything straightened out, so thanks for doing that as well.