Author Topic: Same variables in 2 profiles?  (Read 2316 times)

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Same variables in 2 profiles?
« on: April 12, 2017, 07:07:46 AM »
Once again folks I'm here with probably a dumb question which I kinda already know but want a defo answer.

I just got myself a second ED account  ::)  ;D and want to use my VA scripting with it. What I've done is just duplicate my profile and change its name.

Do variables from one profile interfere with another profile with the same variable names?

So whenever I use one CMDR account it changes automatically to the correct profile for that CMDR & changes back when i change to the other.

CMDR 1 Profile 1 variables 1, 2, 3
CMDR 2 Profile 2 variables 1, 2, 3

I got my variables to save with profile when shutting VA down as always.

Once again thanks for the help
Boo yah ö7
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Same variables in 2 profiles?
« Reply #1 on: April 12, 2017, 08:11:09 AM »
The answer is provided in the "Advanced Variable Control (Scope)" section of VoiceAttackHelp.pdf:
Quote
You have two profiles: Profile A and Profile B. Profile A has a command that creates a text variable, ‘myTextVariable’. All of Profile A’s commands can see and modify, ‘myTextVariable’.
Also, when you switch to Profile B, all of Profile B’s commands can see and modify the same, ‘myTextVariable’ variable. In most situations this is alright, but let’s say your friend created Profile B and your friend also uses a text variable called, ‘myTextVariable’.
If you switch between Profile A and Profile B, you can see where modifying the same variable can be a problem.
Profile A and Profile B would need to be very aware of each other’s variables

If you don't want the variables to interfere with eachother, you need to modify them:
Quote
Profile-scoped variables will be prefixed with the, '>' (greater-than) character

If you have variables that aren't saved to your profile, but need to be retained between profile switches while VoiceAttack is running:
Quote
when a profile is switched, the profile-scoped variables are lost.
If you want to retain a profile-scoped variable between profile changes, prefix your variables with two '>' characters.
For example, '>myTextVariable' (single, '>') will be lost on profile switch. '>>myTextVariable' (note the double '>') will be retained and will be available when you switch back to that profile.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Same variables in 2 profiles?
« Reply #2 on: April 12, 2017, 11:06:25 AM »
ok so anywhere I use my variables I have to put a '>' in front of it?

so
Code: [Select]
Set decimal [Bee Star Main sequence] value to [Saved Value] becomes
Code: [Select]
Set decimal [>Bee Star Main sequence] value to [Saved Value] then?

Code: [Select]
Set decimal [BEE Total Distance] to [BEE Total Distance] plus [{DEC:EDDI jumped distance}] (round to 0 decimal places) (save value to profile)becomes
Code: [Select]
Set decimal [>BEE Total Distance] to [>BEE Total Distance] plus [>{DEC:EDDI jumped distance}] (round to 0 decimal places) (save value to profile)
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4780
  • RTFM
Re: Same variables in 2 profiles?
« Reply #3 on: April 12, 2017, 11:36:01 AM »
ok so anywhere I use my variables I have to put a '>' in front of it?
The ">" is part of the variable name, so
Code: [Select]
Set decimal [BEE Total Distance] to [BEE Total Distance] plus [{DEC:EDDI jumped distance}] (round to 0 decimal places) (save value to profile)becomes
Code: [Select]
Set decimal [>BEE Total Distance] to [>BEE Total Distance] plus [{DEC:>EDDI jumped distance}] (round to 0 decimal places) (save value to profile)
However, as "EDDI jumped distance" is a variable set by the EDDI plugin itself(I believe), it would be
Code: [Select]
Set decimal [>BEE Total Distance] to [>BEE Total Distance] plus [{DEC:EDDI jumped distance}] (round to 0 decimal places) (save value to profile)As stated, ">" is part of the variable name, so "EDDI jumped distance" and ">EDDI jumped distance" are not the same variable, so the plugin wouldn't set it the latter and you'd get "Not Set".

In this case it's a question of when the EDDI plugin is called to set the value. If it's before the variable is used, it'll work fine as the data you add to your internal variables is relevant to the current profile; If it's after the variable is used, the data would still pertain to the old profile.

If EDDI has to be called manually(rather than running and updating continuously in the background), you should have a command in your profile that runs on startup which calls EDDI and makes it refresh all data to make it relevant to the current profile, if you don't have that in place already.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Same variables in 2 profiles?
« Reply #4 on: April 12, 2017, 02:50:20 PM »
ok I think I got you now, just have to go though ALL my scripting and add the ">" to my own variables, then dupe the profile and name it different and I should be good to go.

Well EDDI's connection to Frontiers API is broken at mo so while its quiet I've spent the last few hrs writing my code, haven't got the strength to test it right now.
--
CMDR Bumble B ö7
ASUS P6TD Deluxe, Intel i7 960 @ 3.2GHz, 12Gb G.Skill, Windows 7 SP1 (64bit), ASUS Geforce GTX 970 Strix (4Gb), ThrustMaster T-Flight HOTAS X, Cosair Void RGB USB Gaming Headset, TrackIR, EDDI, Voice Attack, ED Engineer