Create account / Log in

Reporting a Property from the Global Key Command window

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Reporting a Property from the Global Key Command window

Postby BigAl737 » August 10th, 2019, 9:06 pm

Is it possible to report a property if it's listed in the Report Format window of the Global Key Command window?

I can't make it work. Unless you need the details, I'm positive the property Blue CVP is updating correctly. I just can't figure out how to make the value of the Blue CVP property appear in the message bar.

Here's my GKC window:

GKC.jpg
GKC.jpg (66.58 KiB) Viewed 2259 times


Here's the result in the message bar after clicking the GKC button a bunch of times:

Window.jpg
Window.jpg (23.61 KiB) Viewed 2259 times


The Blue CVP value for this example is confirmed to be 2.

I would like the GKC to report "Blue CVP: 2" in the message bar when the GKC button is pressed.

Thanks for your help.
BigAl737
 
Posts: 47
Joined: July 10th, 2009, 6:47 am
Location: Eagle River, AK

Re: Reporting a Property from the Global Key Command window

Postby DrNostromo » August 11th, 2019, 5:51 pm

One thing I would avoid is spaces in variables. Have you tried renaming the variable BlueCVP and using the report format of

Blue CVP: $BlueCVP$

What you're doing appears to be correct but I've never used spaces in a variable so I'm thinking that may be a problem.
User avatar
DrNostromo
 
Posts: 1033
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Reporting a Property from the Global Key Command window

Postby BigAl737 » August 11th, 2019, 9:53 pm

Thanks but I did try that and it didn't work. I agree with you that properties should probably not have spaces just to avoid any issues spaces can cause.

I went back and renamed the GP to BlueCVP:

GKCWindow.jpg
GKCWindow.jpg (78.07 KiB) Viewed 2233 times


I didn't mention this before but to ensure the BlueCVP property is updating correctly, I tagged it to a playing piece. Using the exact same property syntax, the playing piece updates and reports correctly.

PieceWindow.jpg
PieceWindow.jpg (59.41 KiB) Viewed 2233 times


And though I can use the playing piece report action to report BlueCVP in the message bar, I'd; one, prefer to delete this piece; and two, it takes two clicks of the GKC to update the message window to the correct value after an update. In the example message window (one click of the GKC yields two lines of report messages), you can see that the GKC does not report the value of BlueCVP and that the playing piece report action initially reported BlueCVP to be 0 after it was updated to 2. The second click of the GKC still does not report the value of BlueCVP through the GKC but does reflect the correct value of BlueCVP as reported through the playing piece report action trait.

MessageWindow.jpg
MessageWindow.jpg (27.21 KiB) Viewed 2233 times


I'm wondering if the placement of the BlueCVP property is an issue. It's defined within a Zone on the Casualties map. Here's the DropBox shortcut to the module if you'd care to have a look:

https://www.dropbox.com/s/1p5yzelaidrhf ... .vmod?dl=0

Only the Blue Zone and Allied and Blue CVP pieces are updated. Ignore the Red Zone and Axis piece. To replicate the issue, place an allied piece in the blue zone of the Casualties map and click the GKC button.

Thanks very much!

Al
BigAl737
 
Posts: 47
Joined: July 10th, 2009, 6:47 am
Location: Eagle River, AK

Re: Reporting a Property from the Global Key Command window

Postby DrNostromo » August 12th, 2019, 4:14 pm

I looked at the mod and I'm not sure exactly what you want to do but it seems that what you've developed is overly complicated for what appears to be a simple task. Could you provide some details about how this is supposed to work and maybe I can come up with something a bit more simplistic.

Couple questions:

Do you need the button? In other words, is there a reason the reporting can't be done automatically when things change or does this report need to be reported only as specific times?

Is it used simply to see the total value of the pieces? If that's the case, you can simply place a display at the top of the box with the current total value of the pieces and it will update automatically whenever things change.

Anyway, I don't think what you have is going to work as I can't figure it out so there's probably some broken logic in there.
User avatar
DrNostromo
 
Posts: 1033
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Reporting a Property from the Global Key Command window

Postby BigAl737 » August 12th, 2019, 4:39 pm

I do tend to over engineer :-) You've got me thinking of other options.

The intent is to sum the CVP value of units placed on the Blue Zone of the Casualties map and have that sum reported in the message window each time a change is made or when a player requests it. If a unit is moved to the Blue Zone the value increases, if it is deleted it decreases, if it clones it increases, if it moves off the Blue Zone it decreases, if the piece CVP value is updated it increases/decreases as appropriate.

I'll work on this but I do welcome suggestions. For some weird reason, I enjoy trying to figure this stuff out.

But I'm still curious as to the GKC report format; it should call up a GP correct?

And the proper syntax of that property is $properyname$ ?

Thanks again for your help.
BigAl737
 
Posts: 47
Joined: July 10th, 2009, 6:47 am
Location: Eagle River, AK

Re: Reporting a Property from the Global Key Command window

Postby DrNostromo » August 12th, 2019, 5:27 pm

But I'm still curious as to the GKC report format; it should call up a GP correct?

And the proper syntax of that property is $properyname$ ?


Yes, that's true. However, unless you have a specific reason for containing a GP in a zone, you should just create it as a module level GP. That way, it can be addressed from anywhere without restrictions. If you contain your GP's in zones, then you need to have whatever trigger you're using to create that report specifically aimed at that zone in some fashion.

You might try this. In the Casualties map properties, add a transparent At-Stark Stack at the top ...make it say 100x50. Call the piece Value Display

In the "Text" box, have it display Blue CVP: $BlueCVP$. This will automatically display the current value of BlueCVP.

Also, add a Trigger Action to execute on the command UpdateValues You'll see why later.

Now go to your Causalities Map properties and add a command like CVPSwitch under "Key Command to apply to all units ending movement on this map"

On your pieces, set a Trigger Action with the Keyboard Command CVPSwitch. Under Perform These Keystrokes, have it execute the command Update. Now, every time a piece is moved on the map, the Update trigger will be set off.

Add a Global Key Command trait with keyboard command Update and the Global Key command of UpdateValues. Matching Properties would be CurrentMap = Casualties && BasicName = Value Display.

As noted above, a trigger action on the display piece will now receive this trigger. I'll let you figure it out from there but basically you want that trigger to send out a command to all pieces to increment the GP BlueCVP ...first by resetting it to zero and then having each piece add its value to it.

If you get it right, anytime you move a piece, it will update. When you remove a piece, it may NOT update but simply moving one of the existing pieces will update again. If you like, you can even place a right-click menu item on the display to have it Update manually.

Hope that helps.
User avatar
DrNostromo
 
Posts: 1033
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Reporting a Property from the Global Key Command window

Postby BigAl737 » August 14th, 2019, 7:35 am

It does help thank you. I can make the CVP value update automatically. At the piece level, I can make $BlueCVP$ report in the message window. I'd like to have a GKC option and it takes two clicks of the GKC to do update to the correct value but it does work.

What I can't do however is make the GKC by itself report the updated CVP value in the message window. I've even dumbed down the module to just the BlueCVP GP, a playing piece that will modify the BlueCVP GP, and a GKC that fires the piece to do so. Still $BlueCVP$ in the GKC report window does not generate anything in the message window. Either $BlueCVP$ is the wrong syntax or the GKC report window will only recognize the default properties in its pull down window.

Maybe I'm misunderstanding the purpose of the GKC report feature.
BigAl737
 
Posts: 47
Joined: July 10th, 2009, 6:47 am
Location: Eagle River, AK

Re: Reporting a Property from the Global Key Command window

Postby BigAl737 » August 14th, 2019, 2:53 pm

Update...

I got it to work :-)

Not sure what I did different than last night but the GP $BlueCVP$ will update and report in the message window as generated from the report window of the GKC.

To recap, I defined the GP BlueCVP at the module level. Initially I defined BlueCVP at the Zone level and that did not work.

I added a GKC at the map level that updates and reports BlueCVP when clicked. The correct syntax in the GKC report window is $BlueCVP$

All pieces that affect the value of BlueCVP are fired by the map level GKC to update the module level BlueCVP GP.

I added the suggestion to update the BlueCVP GP automatically when a piece is moved to the map. The message window report only gets fired when the GKC is clicked.

Thanks again for all your help!
BigAl737
 
Posts: 47
Joined: July 10th, 2009, 6:47 am
Location: Eagle River, AK


Return to Module Design

Who is online

Users browsing this forum: No registered users and 3 guests