Hi everyone,
first time poster, long time lurker. I've become pretty familiar with Eventghost's native functions over the years but now I need a function that I don't exactly know how to accomplish. I'm hoping someone can help.
I need a mutation of the "wait some time" function. I need to have a macro action to wait a random amount of time that I can set some parameters to. And I need to be able to set the parameters every time I invoke it. For example, I may want to wait a random amount of time between 4 and 8 seconds at one point and wait a random amount of time between 10 and 15 seconds another time.
In my head, this looks like a function call in my tree like <action> "wait.rand(X,Y)" </action> but that's just my imagination. I dont know if I would need to a custom plugin or if its a function defined somewhere else that I call later.
I'm a bit of a Python rookie so I don't completely understand how functions are created/stored or called. Any and all help would be greatly appreciated.
Thanks for looking.
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Wait random # of seconds between X and Y seconds...
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Wait random # of seconds between X and Y seconds...
You would enter the values for START STOP and STEP.
this will do whole seconds.
if you want something that will do fractions of a second. let me know. I will code something up for ya
example start of 0
stop of 10
step of 2
will spit out one of these numbers
0, 2, 4, 6, 8, 10
all ya have to do is add an action called Python Script into a macro. and copy and paste the code below
this will do whole seconds.
if you want something that will do fractions of a second. let me know. I will code something up for ya
example start of 0
stop of 10
step of 2
will spit out one of these numbers
0, 2, 4, 6, 8, 10
all ya have to do is add an action called Python Script into a macro. and copy and paste the code below
Code: Select all
import random
START = 0
STOP = 10
STEP = 2
waitTime = random.randrange(START, STOP, STEP)
# print waitTime
eg.plugins.EventGhost.Wait(waitTime)
Re: Wait random # of seconds between X and Y seconds...
this looks immensely helpful. Thank you. I may not get a chance to try it for about a week (Surprise biz trip). But I think this I may want to take you up on the fractional code. It would only need to be tenths of a second. Let me try this and I'll reply when I know more.
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Wait random # of seconds between X and Y seconds...
no worries, let me know if everything works out for ya.. I will make up the random for floats.
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Wait random # of seconds between X and Y seconds...
OK i am done.. i did this is an add-on to the EventGhost Plugin..
all You will have to do is extract it to c:\ProgramData\EventGhost\plugins it will do what is necessary from there..
then just restart EG. it will create a new action under the EventGhost plugin.. it will be the very last entry. It has a Configuration panel and all.
Let me know if you have any problems.
the file is attached
all You will have to do is extract it to c:\ProgramData\EventGhost\plugins it will do what is necessary from there..
then just restart EG. it will create a new action under the EventGhost plugin.. it will be the very last entry. It has a Configuration panel and all.
Let me know if you have any problems.
the file is attached
- Attachments
-
- RandomWait.zip
- (1.65 KiB) Downloaded 124 times
Re: Wait random # of seconds between X and Y seconds...
This works great! Thank you! I dont know if it will help others as well but thank you for posting it for public consumption.
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Wait random # of seconds between X and Y seconds...
you're welcome it was not a biggie.. but if you are using EG 0.5 then it will show up in the plugin list but be colored red. it's not a plugin but an addon so it has been coded alittle different.. and it's not something that you would install in the tree.. but even tho it is red it is still doing it's job.
