Asked
Resolved Resolved by DJ Sures!

Variables Not Saving

I'm not sure if I'm missing something but my created Variables are not being saved with my project.

I'm using blocky to create the variables, the scripts work great and I can see then changing state using the skill to see the state.

However once I've saved my project, closed ARC down, then open the project up my variables are all gone.

What am I missing? Thanks


Related Hardware Arduino Due/Mega
Related Control EZ-Script Console

ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

PRO
Belgium
#1  

hi

did you save your project on your pc and in the cloud ?

PRO
Synthiam
#3  

Variables don’t save in programming languages. You define a variable, because they are, well, variable! Pardon the pun:)

Here’s a good introduction to programming with Blockly and stuff

Now, if you want to save data from a variable between projects, you can use this robot skill: https://synthiam.com/Support/Skills/Scripting/Variable-State-Saver?id=15995

that allows you to save state of variables. So when you reload a project, the data from the specific variables are maintained.

#4   — Edited

Thanks JD

The issue was I was not defining the initial state of the variable anywhere.

I see my mistake now, I have arms that deploy in and out that I created a script for. I needed the variable to prevent certain actions if the arms were not deployed. Initially I created the variable and had the script for deploying them set the variable after completing the action which worked fine.

I then added a check at the beginning of the deploy arms script to check it the deployed variable was set, if so halt the script. The issue was at start up this check would be before the variables where as the first time this would happen after the deploy script ran defined.

For now since I shut the droid down with the arms in I've defined the variables in the init script for the EZBs.

The Variable state saver I could load during Init but is there a way to script a save on disconnect automatically?

Also amazing product you guys have here, I have an electronics background but not programming and the things I've been able to do so far are awesome, great job.

#6  

Thanks again DJ, that really makes things easier.