CMANO Lua Key Values, Counters and Behaviors.

Share your best strategies and tactics with other players by posting them here.

Moderator: MOD_Command

Post Reply
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

CMANO Lua Key Values, Counters and Behaviors.

Post by mikmykWS »

New blog post

CMANO Lua Key Values, Counters and Behaviors

Let me know what you think.

Mike
User avatar
CCIP-subsim
Posts: 467
Joined: Tue Nov 10, 2015 6:59 pm

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by CCIP-subsim »

Thanks for following up with these as well - it's a feature I was interested in, now I should start using it!

As per a recent discussion, I was doing things the same way as Gunner98 - just using scores for other sides (even creating "fake" sides) to keep track of values in the game. This does seem to be potentially more elegant, at least for simpler variables that are meant to be hidden in the background.

There's one thing I was wondering about: is there an easy way to display key values to the player? That's one reason score is useful, since at least for the player side you can always read it in the scenario results, and for events that are matched to specific point counts - in the game log under events, without having to pop up a message box every time. I suppose one way could be a Special Action, to do a query for the current key value/counter, and display it as a message when the player wants to check it.

Could you (or MichaelM) do an example of a script for querying/outputting the a current counter value?
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by mikmykWS »

a=Scenedit_GetKeyValue("Counter")
print(a)
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by Rory Noonan »

As for displaying it to the non-editing player, I use a special action to display tension levels in Seven Days. Feel free to use the code there for whatever you like.
Image
User avatar
AdmiralSteve
Posts: 288
Joined: Mon Mar 28, 2011 2:32 pm
Location: Red Bluff, CA

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by AdmiralSteve »

Hey guys,

I tried this today and this was the result;

Lua script execution error: [string "P-3 Destroyed"]:1: unexpected symbol near char(147)

I copied the script directly from the page but to no avail. Scen file is attached. Any suggestions?
Attachments
TroubledScenarios.zip
(12.95 KiB) Downloaded 16 times
“There are no extraordinary men...just extraordinary circumstances that ordinary men are forced to deal with.”
Admiral William Frederick Halsey Jr. 1882-1959

User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by michaelm75au »

Change your " to '
It is double quoting the first one.

The double quote is valid, but there are 2 quotes marks on the first one. I deleted and retyped it fully with the double quote and it worked.
Michael
User avatar
AdmiralSteve
Posts: 288
Joined: Mon Mar 28, 2011 2:32 pm
Location: Red Bluff, CA

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by AdmiralSteve »

OK, got it. Thank you.
“There are no extraordinary men...just extraordinary circumstances that ordinary men are forced to deal with.”
Admiral William Frederick Halsey Jr. 1882-1959

Dan109
Posts: 175
Joined: Thu Apr 27, 2017 1:04 pm

RE: CMANO Lua Key Values, Counters and Behaviors.

Post by Dan109 »

For more depth, I was thinking of using Keys to create various variables for each unit, to allow enabling of certain modded behavior per unit and some memory requirements those mods would need. Couldn't the GUID of a unit be a suffix for any variable? String functions can then be used to create a variable name for retrievable or storage. I'm going to be trying it out, on an RTB Mod I'm working on, which creates intercept courses for Surface Craft RTBing back to a moving mothership. I have the need to retain the original missionname for the craft - and I'm trying to design this to be able to easily plug into anyone's scenario.
Post Reply

Return to “The War Room”