Author Topic: Variable Save/Restore when using included profiles.  (Read 2279 times)

AlanBell68

  • Newbie
  • *
  • Posts: 6
Variable Save/Restore when using included profiles.
« on: October 21, 2018, 04:54:24 PM »
I have a profile that I have developed and using in conjunction with the HCS Singularity profile.

The profile essentially uses two variables, which I had originally named with ">>" prefixes, to ensure that they were local to my profile, and would be retained between profile changes. The latter was required to assist in the development and debugging of my profile.

The two integer variables are as follows:

>>CurrentFireGroup
>>LastFireGroup

I set these initially with two commands:

When I Say "The Current Fire Group Is [1..8]"
When I Say "The Last Fire Group Is [1..8]"

Each parses out the number with the CMDSEGMENT token and assigns the value to the corresponding variable. In the assignment command, I have the checkbox set to save the variable's value to the profile.

A further command is defined as follows:

"Fire Group Diagnostics"

When I call this command, it does the following:

* Retrieves the saved state of >>CurrentFireGroup
* Retrieves s the saved state of >>LastFireGroup
   (In both cases, I am not checking the box to return zero when not set.)

* Says "The Current Fire Group is X OF Y", using tokens to retrieve the values, and where X and Y are the correct variable values.

This all works fine when I execute the three commands in sequence as above.

If I close out of Voice attack and re-open, however, this is where the issues begin.

* First it launches Singularity.
* I say "Fire Group Diagnostics"

The response is "The Current Fire Group Is X Of Y", where X is usually plus or minus one from the value from the previous session. Y is consistently correct.

If I switch to my profile directly thereafter, repeat the previous "Fire Group Diagnostics" command, both variables are reported as being unset.

If I set Voice Attack to just use my profile as the primary profile, everything works as expected.

I have other commands that utilize these variables, but repeating the steps above is not utilizing any of these, so I would expect there to be no issues with those.

I have been able to run the "Fire Group Diagnostics" command after each of them and the results as as expected.

As a result, I modified the variable name to replace the ">>" characters with "SMG_" (an abbreviation picked to hopefully avoid collision with HCS variables), thereby making them global, in case there was an issue with local variables in included profiles. The result is the same, however.

Any insight/help/tips anyone can offer would be appreciated.

I will provide a trimmed down version of this profile, should anyone Require it.

Thanks in advance for any help or guidance!

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Variable Save/Restore when using included profiles.
« Reply #1 on: October 21, 2018, 06:34:38 PM »
None of this is actually necessary with the HCS Singularity profile....there is an INT variable called hcsFiregroup which holds the live position of what firegroup is currently selected. HTH :)
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

AlanBell68

  • Newbie
  • *
  • Posts: 6
Re: Variable Save/Restore when using included profiles.
« Reply #2 on: October 22, 2018, 05:19:04 AM »
That is very useful to know, thanks! Is there a variable that holds the number of firegroups defined? I’m assuming there would have to be, so that it would know when to reset it back to after saying “Next Fire Group” when the last one was selected etc.

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Variable Save/Restore when using included profiles.
« Reply #3 on: October 22, 2018, 05:57:42 AM »
no there isn't as it rolls around back to the beginning when using next firegroup
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

AlanBell68

  • Newbie
  • *
  • Posts: 6
Re: Variable Save/Restore when using included profiles.
« Reply #4 on: October 22, 2018, 06:08:04 AM »
If I have 4 fire groups, I am on fire group 4, and I say “next fire group”, the current fire group would then be 1. If I had 5 or more fire groups, it would be 5. How does it determine the correct “current” fire group if it doesn’t know how many I have defined?

TheThingIs

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 278
    • HCS Voicepacks
Re: Variable Save/Restore when using included profiles.
« Reply #5 on: October 22, 2018, 03:08:11 PM »
it doesn't, the game reports to us which firegroup is currently selected. It's a "live" variable which is updated by the journal and plugin.
The Singularity profile - One profile to rule them all and at HCS we bound them ;)

You see, TheThingIs, eventually you'll be allright.

AlanBell68

  • Newbie
  • *
  • Posts: 6
Re: Variable Save/Restore when using included profiles.
« Reply #6 on: October 22, 2018, 07:39:05 PM »
Well, I have used a combination of the hcsFiregroup variable and my original code, and so far, everything seems to be working ok without any conflicts. I need to clean up some of my legacy code, but I think I have got past the final hurdle. Only some more extensive testing will tell.


The profile, which works in tandem with Singularity, allows me to set fire groups by number, for example:
saying "Fire Group 1" or any valid numbered fire group, will automatically select the correct fire group.


I can also assign labels to fire groups, allowing me to select "Primary Weapons", "Primary Scanners", "Primary Utilities", in addition to secondary variants of each, all programmable by voice from within the profile.


Settings should be preserved between sessions, only needing tweaked when changing ships or loadouts.


Unfortunately, I have Chapter 4 to look forward to, with Fire Groups being assigned to letters rather than numbers...


That aside, if anyone is interested in a copy, let me know and I will wing one your way once I have cleaned up the code this weekend.