@DJ and team.
I give a small request that I hope you would consider adding to EZ-Script.
Would it be possible to add a new script command for servostop()? I'm not talking about the one the one that already exists for modified servos, but for standard ones (more like a stopservo() or possitionstop() command). The idea is to add this for things like controllers and joysticks.
E.g, you have a servo which has a centre possition of 90, and a set max possition of say 160, and a set speed of 2. When a button is pressed on a controller the servo starts to move from 90 towards 160, but if you release the button the servo stops in its current possition and stays there. Press the button again and it continued to travel towards 160, or back to 90 by pressing another button.
I'm aware that there are ways to write a script for this, but I've had a lot of trouble with it so far, and having a simple script command in the script menu would make things so much easier. Would it be something that you would consider adding? And if there is a command to do just this, then I apologise in advance and would appreciate someone informing me of what script command to use.
Thanks, Steve.
you can use the functions
and loop them while the joystick button is pressed and set a max value for that specific servo to stop at.
This could be a simple script that you call each time the button is pressed.
I hope i understood you're problem correctly and that this helps
@VGosine
Thanks for your reply. I am currently using servoup() and servodown() commands but don't like having to repeatedly press a button to move through increments. I must admit though that I haven't considered using a loop. I will give it a try a little later. Thanks for the advice.
I still think having a simple command to use to achieve this would be a good idea. Something that could be put in to "when button is released" in the control config. Is it something you would consider adding DJ?
Didn't I provide you with a script which does exactly what you are asking? (Which is pretty much the same method @VGosine posted above).
You shouldn't need to keep pressing a button over and over to make it work. Check out Gwen's B9 movement help topic and the code I provided for her, this runs when button is pressed and stops when released. The project is in my cloud and is public. Use a similar method for your required actions.
@Rich.
yeah, the script example you supplied is what I'm currently using which is good, but I do have to keep pressing the button to move each increment I set (I have them set at 10). So if I want the servo to move, to say possition 120, I have to press the button lots of times, and if I change the increment value to 20 or more and want the servo to stop at possition 105, it will over shoot that possition.
I just thought it would be a lot easier to have a specified script command (like servo(), servospeed() ect) to simply stop a servos travel that could be inserted in to the "when button is released" configuration. Kind of like a momentary switch action.
Have had a look through Gwens thread and the cloud project. Unfortunately, looking through the code I'm not sure what I'm looking for. Just to be clear, I am talking about joystick/pad "buttons", not the D pad.
Use some if commands then... set your servo increment to 20... Then use an if statement to set it at 105 if it should over shoot...
Thanks Richard. I'll try this a bit later. Where do I put this script, in the "when button is pressed" or "when button is released" script editor? (I asume its the first one).
If you want everything to stop when the button is released you need that script to be empty and only have the commands, loops and ifs in the on button down part.
While the button is pushed the script will loop.
You may find it easier to write the scripts in script manager and use ControlCommand() with ScriptStart and ScriptStop on the on button down and on button up. This way, when the button is pressed and held the script runs and loops etc. as soon as the button is release the script is stopped by control command.
Check the version history of the project I made for Gwen, originally the movement was assigned to buttons not joysticks as I had a brain fart and totally forgot the joystick controls the movement panel.