Is there a command or other way for a script to check the Pause state of the Speech Recognition or Personality controls? I want to keep a PauseOff command in a script from running for these two controls if they are already paused?
For example; I have several scripts written that turn on and then off these two controls while the scripts are running. I also have a button on the outside of the robot that's attached to an ADC port on EZB that I also use to toggle these controls Pause on and off. If I've activated the pause on either control using the external robot button through the ADC port I'd like to add lines to my other scripts that will check to see this state. Basically I don't want those scripts turning off the Pause if I've already turned it on.
Upgrade to ARC Pro
Get access to the latest features and updates with ARC Early Access edition. You'll have everything that's needed to unleash your robot's potential!
Speech Recognition PauseOn
Speech Recognition PauseOFF
You can use the value of $x in other scripts to determine whether the control is on or has been paused...
I could define and set the variable in the Button/ADC script that first turns the Pause on or off. Then in the following scripts that would have a pause command I'd also need to place a check on this variable to see if it's on or off with an "If" and "Elseif"?
Could I possibly set these variables in my "Int" script that first run when EZB first starts?
Still trying to wrap my head around coding. I kinda thought I could use a variable for this but just couldn't work out how to make it happen.
then as you turn on and off your controls via scripts you set the $speech and $personality accordingly... Then use if statements as you mentioned to check if the variables $speech and $personality is 1 or 0.... This is a good way to determine if you have already set the controls on or off in another script...
So something like this....
Next time this code is run the speech control is already paused (the $speech flag is set to 0) so the if statement will return false and won't try and pause it a second time...
The Flag comment is what helped me sort it out. I thought I had a good idea of how a variable worked but that's just it, a variable does not work. The way I understand it now is that It's just a bookmark of sorts, a simple value, a marker or a "flag" as you put it. The script just uses this value as a target or sign post for direction.
Anyway, I set the "flag" to whatever will tell the script is the proper On or Off value of the state of the Voice or Personality Pause. In my case; 0 for Pause, 1 for Unpause.
The script that runs when I push the button on the robot that's attached to a ADC port to toggle the Voice Recognition or Personality Generator script on or off will change the Variable to "0" when I first push it. Then an ADC_Wait() command will hold the script till the button is pushed again and the variable will again change to 1
In the mean time I can run other scripts that have a couple "If" statements in them looking at these variables and depending if it sees a "0" or "1" will pause either or both of the Voice Recognition or Personality Generator.
Simply amazing. Thanks so much for the guidance!
A little tip about variables... I have a bad habit of using short variable names like $x.... later as my program grows and evolves I end up scratching my head trying to figure out what I originally used $x for... Good practice is to instead use a variable name that represents what you are using it for... For example $PersonalityFlag or $PerFlag.... That way later when you come back to a script you know what the $PerFlag is for....
Like you, I do like fabricating, although I am not quite as skilled as you so I opted to use kits like Vex... Anyway, programming is just as awesome and a great way to express creativity.... Dave, you built an amazing bot.... If you dig into programming you can really make him come alive....
But with the speed at which things change, plus the V4 and revolution being announced I put a hold on what I was throwing together.
When I have more time I intend on getting back on to some type of unofficial EZ-B/ARC/EZ-Script for dummies style book.
It's just a whole bunch of separate documents or pages and pages of notes. When I find the time I'll get back on to putting it in some kind of order and covering the things I haven't yet covered.