Page 1 of 1

CMANO Lua Key Values, Counters and Behaviors.

Posted: Thu May 11, 2017 9:10 am
by mikmykWS
New blog post

CMANO Lua Key Values, Counters and Behaviors

Let me know what you think.

Mike

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Thu May 11, 2017 1:47 pm
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?

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Thu May 11, 2017 1:58 pm
by mikmykWS
a=Scenedit_GetKeyValue("Counter")
print(a)

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Thu May 11, 2017 5:17 pm
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.

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Sat Jun 03, 2017 10:46 pm
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?

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Sun Jun 04, 2017 12:16 am
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.

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Sun Jun 04, 2017 1:26 am
by AdmiralSteve
OK, got it. Thank you.

RE: CMANO Lua Key Values, Counters and Behaviors.

Posted: Tue Jun 06, 2017 4:55 am
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.