Author Topic: Remembering variables between sessions  (Read 14385 times)

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Remembering variables between sessions
« on: December 11, 2016, 04:24:26 AM »
Quick question

I have a scripts for Elite dangerous that totals up how many jumps I have made in a session.

It all works fine but I've found when I shut down VA and start it up again it clears the variables. Not a good thing if I'm doing a long exploration and want to keep my total distance, total jumps, total fuel scoops etc.

I got VA to save to a .txt for each item for OBS to display when screaming.

I've got the variables and scripts to save to profile but the variables still get cleared every reboot of VA which is annoying :(
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #1 on: December 11, 2016, 04:27:19 AM »
When saving a variable to the profile, are you recalling it later on using "Retrieve saved value"?

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #2 on: December 11, 2016, 04:37:17 AM »
When saving a variable to the profile, are you recalling it later on using "Retrieve saved value"?

No I've never seen or used that before. New to this scripting stuff so I'm learning as I go.

Do I have to make a new command for my variables to retrieve the saved value?

Current script is totaling up the number of jumps in Elite Dangerous. If I restart VA it clears the number of jumps I made. I don't see in the Set a decimal action how to (Compute against a value:add) and (retrieve saved value) at the same time

Yes Saved value to profile is ticked too
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #3 on: December 11, 2016, 04:50:39 AM »
You can add the action before you do the addition:
Code: [Select]
Set decimal [Jumps] value to [Saved Value]
Set decimal [Jumps] to [Jumps] plus [EliteJumps] (save value to profile)
It'll retrieve the saved value, then do the addition, and save it again.

When the command is triggered a again the value retrieved will include the addition from the last time.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #4 on: December 11, 2016, 04:58:04 AM »
You can add the action before you do the addition:
Code: [Select]
Set decimal [Jumps] value to [Saved Value]
Set decimal [Jumps] to [Jumps] plus [EliteJumps] (save value to profile)
It'll retrieve the saved value, then do the addition, and save it again.

When the command is triggered a again the value retrieved will include the addition from the last time.

On the first step do I still have Save value to profile ticked?
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #5 on: December 11, 2016, 05:01:11 AM »
No. Having "Save value to profile" checked when retrieving an already saved value is actually redundant, as it'd just save the same value it just retrieved.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #6 on: December 11, 2016, 12:20:08 PM »
Thanks for the help I managed to get it working. O7
--
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

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #7 on: December 16, 2016, 05:19:31 PM »
ok how do I reset the values? I want to make a command so I can reset everything back to zero when i start a big journey.
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #8 on: December 16, 2016, 06:49:41 PM »
You should be able to literally set the value to 0 and save it:
Code: [Select]
Set decimal [Jumps] value to 0 (save value to profile)

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #9 on: December 16, 2016, 08:04:37 PM »
You should be able to literally set the value to 0 and save it:
Code: [Select]
Set decimal [Jumps] value to 0 (save value to profile)

Tried that but it doesn't reset my variables, next time it updates it still gets the old values and adds it

I'm currently using 1.6.1.5 (pre release) needed it for the append txt function to update txt files instead of completely overwritting it
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #10 on: December 17, 2016, 06:05:47 AM »
Can you post your action list? It works fine on my end in v1.6.1.7

ralf44

  • Newbie
  • *
  • Posts: 41
Re: Remembering variables between sessions
« Reply #11 on: December 17, 2016, 10:32:26 AM »
I manage this kind of thing by having one command called "init" which is not voice activated and setting my profile to run that command upon launch.

As I find variables which I want to (re)initialise after VA has closed or crashed I just add them into that "init" command - retrieving stored values, or setting them up manually.

For your purpose, you could do this to avoid having to clutter a bunch of individual commands with retrieval code, and then make a second new command which is voice activated and called maybe "New Session" or "Clear saved data" and have that one set variables which "init" has retrieved back to zero.

You seem to be talking about two separate problems - VA's actual internal variables, and a text file or files that you're appending to for OBS to display. You could use VA's log or text to speech functions to confirm what variables it is seeing while you debug, and then I think you'll need the "New journey/Clear saved data" type custom command to wipe or reset the OBS text file. Otherwise you're just appending more and more correct and incorrect data to one long file.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #12 on: December 19, 2016, 06:40:13 PM »
ok I made a small bounty kill & total script which goes like this...

Code: [Select]

Set decimal [BEE Total Bounty Kills] value to [Saved Value]
Set decimal [BEE Total Bounty awarded reward] value to [Saved Value]

Set decimal [BEE Total Bounty Kills] to [BEE Total Bounty Kills] plus 1.00000 (round to 0 decimal places) (save value to profile)
Set decimal [BEE Total Bounty awarded reward] to [BEE Total Bounty awarded reward] plus [EDDI bounty awarded reward] (round to 0 decimal places) (save value to profile)

Write (overwrite), 'Kills: {DEC:BEE Total Bounty Kills} - Total Bounties: {DEC:BEE Total Bounty awarded reward}' to file 'C:\Program Files (x86)\obs-studio\Snaz\TextFiles\Bountys.txt
The above works from what I can see.


I wrote a reset script as follows:

Code: [Select]

Set decimal [BEE Total Bounty Kills] value to 0 (save value to profile)
Set decimal [BEE Total Bounty awarded reward] value to 0 (save value to profile)
Write (overwrite), '          ' to file 'C:\Program Files (x86)\obs-studio\Snaz\TextFiles\Bountys.txt'

Now if I add  kills to the script and then run my reset script, close VA & restart VA I then get the old number of kills back and it continues counting instead of resetting.

I have a number of scripts like this to count scanned stars, bodies etc and display them on my OBS overlay and they all doing the same thing.

It's probably something silly simple but I can't see it for the life of me.
« Last Edit: December 19, 2016, 06:57:01 PM by Bumble B »
--
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

ralf44

  • Newbie
  • *
  • Posts: 41
Re: Remembering variables between sessions
« Reply #13 on: December 19, 2016, 07:14:05 PM »
Does setting your VA Profile to run your kill-script on launch and then opening Bountys.txt in Textedit shed any light?

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #14 on: December 19, 2016, 08:01:18 PM »
Nothing is run at the launch of VA

When I run OBS to display the txt file it is zeroed but as soon as I run the count script it counts from the last number of kills not from 0 as it should do after being reset.

It looks like the txt file is set up right but for some reason VA is grabbing the last stored variables from BEFORE the reset even though I've run the script to reset to 0 and saved the values.
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #15 on: December 20, 2016, 06:19:27 AM »
Your example also works fine, in v1.6.1.7. Have your tried upgrading to the latest beta?

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #16 on: December 20, 2016, 01:12:54 PM »
Found the problem. I wasn't calling the variables properly

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)
Should be this
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)

Those "{}" where missing as soon as I put those in everything worked properly. But crazy that it worked for others but not me, very odd that *shurgs*
--
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: 4747
  • RTFM
Re: Remembering variables between sessions
« Reply #17 on: December 20, 2016, 01:18:55 PM »
Those "{}" where missing as soon as I put those in everything worked properly. But crazy that it worked for others but not me, very odd that *shurgs*
You never posted that action before now in that form. You don't need to use the "{DEC:}" token if "EDDI jumped distance" is another decimal value. You can put the name of that value into the "Another variable" field, and it'll work.

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #18 on: December 20, 2016, 01:50:48 PM »
Those "{}" where missing as soon as I put those in everything worked properly. But crazy that it worked for others but not me, very odd that *shurgs*
You never posted that action before now in that form. You don't need to use the "{DEC:}" token if "EDDI jumped distance" is another decimal value. You can put the name of that value into the "Another variable" field, and it'll work.

It was a whole load of similar actions that I was working on and I thought I posted the simplest one I could find to see if anyone could spot where I gone wrong. Once I made the changes to one and it worked did it to the others and they worked out too.

I may try your way just so its correct I guess but after my brain has cooled down abit, been working on this thing for a couple of weeks and been doing my head in, but glad for all the help I got on my little project though  and probalby be back for more help or something in future I'm sure
--
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

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #19 on: December 30, 2016, 05:24:19 AM »
I've pretty much finished my Twitch overlay for exploration using EDDI 2 and Voice Attack, will try and do a video of it in action as soon as I figured out decent settings in OBS. I've also got Bounty Hunting / Combat Zone overlays too which count up kills and vouchers/bonds as well as any on going mission count.

All the elements update using Voice Attack Plugin EDDI 2 on jumped or scanned. (other than the stream viewers, followers elements)

As soon as I heard about the journal being made available to 3rd party plug ins this is exactly the kind of thing I had in mind for my EDDI 2 so this is what I have been working on the last couple of months as well as upgrading my internet connection so I can stream (from 0.5Mb/s upload (old connection) to 20Mb/s (fiber optic) ö7

I'm no programmer or script writer to say the least but with alot of help from folks here and in the Frontier forums my dream was given form and I'm basically "BUZZING"

Is it possible to change the Home system & station via Voice attack instead of loading up EDDI standalone, changing then reloading VA to catch the changes? I would like to change it on the fly if possible or have 2 variables that I can set Home system & Destination system that I can set manually or via Voice attack variables so when I'm out exploring it can calculate the distances from my start system/station & destination system/station from my current position each time I jump.

--
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

omega9380

  • Guest
Re: Remembering variables between sessions
« Reply #20 on: January 01, 2017, 02:28:44 PM »
Awesome that u are getting EDDI to work the way u want it.  Off topic tho, how did you get that cool looking overlay?  Is that a feature of OBS?  I use XSplit when I broadcast, so I've never really played with OBS.  Thanks!!!

Gangrel

  • Caffeine Fulled Mod
  • Global Moderator
  • Full Member
  • *****
  • Posts: 216
  • BORK FNORK BORD
Re: Remembering variables between sessions
« Reply #21 on: January 01, 2017, 02:34:33 PM »
Awesome that u are getting EDDI to work the way u want it.  Off topic tho, how did you get that cool looking overlay?  Is that a feature of OBS?  I use XSplit when I broadcast, so I've never really played with OBS.  Thanks!!!

Its the same basic thing between OBS and Xsplit.

omega9380

  • Guest
Re: Remembering variables between sessions
« Reply #22 on: January 02, 2017, 04:55:32 AM »
Suppose I should rephrase my question.  I'm looking to do something like that just for my gaming pleasure, not necessarily while broadcasting.  Any idea if there is a program that can do that locally?

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #23 on: January 02, 2017, 10:14:29 AM »
Suppose I should rephrase my question.  I'm looking to do something like that just for my gaming pleasure, not necessarily while broadcasting.  Any idea if there is a program that can do that locally?

I think Captains Log does that. Dont use it myself but could easily find the link for it somewhere.
--
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

Bumble B

  • Jr. Member
  • **
  • Posts: 64
    • Bumble B Gaming
Re: Remembering variables between sessions
« Reply #24 on: January 02, 2017, 12:54:02 PM »
ok latest problem I seem to have found.

I noticed that at some point my counters stopped working for some reason and not saving the latest values when I shut VA down and restart it.

Here is a little test script I made for testing:

Code: [Select]
Set decimal [BEE Total Distance] value to [Saved Value] (round to 0 decimal places)
Write '[Blue] Before total distance: {DEC:BEE Total Distance} LY' to log
Set decimal [BEE Total Distance] value to 7080 (round to 0 decimal places) (save value to profile)
Write '[Green] After total distance: {DEC:BEE Total Distance} LY' to log

Log:
19:52:35 - After total distance: 7080 LY
19:52:35 - Before total distance: 6723 LY
19:52:35 - External command : 'Total Travel distance'
19:47:48 - After total distance: 7080 LY
19:47:48 - Before total distance: 7080 LY
19:47:48 - External command : 'Total Travel distance'
19:46:51 - After total distance: 7080 LY
19:46:51 - Before total distance: 7080 LY
19:46:51 - External command : 'Total Travel distance'
19:46:42 - After total distance: 7080 LY
19:46:42 - Before total distance: 6723 LY
19:46:41 - External command : 'Total Travel distance'
19:46:36 - Plugin 'EDDI 2.1.0-b3' initialized.
19:46:35 - Plugin support enabled.


but after a little time or if I restart VA the value goes back to 6723 LY

I can't figure out why this happens, is this a bug?

All my scripts that I have written relay on this function to keep count. Using VA 1.6.1.7 (prerelease)
« Last Edit: January 02, 2017, 01:44:04 PM by Bumble B »
--
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