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.

Random Triggers

If you have a question or need help, this is the place to be.
Post Reply
holdestmade
Experienced User
Posts: 182
Joined: Thu Dec 04, 2014 2:44 pm

Random Triggers

Post by holdestmade »

Hi

I was wondering if there is any way to trigger an event randomly from a group of 10, over a period of time ?

I have 10 UDP-connected lights that I would like to randomly sequence.

Any ideas ?

Thanks in advance

Si
leothlon
Experienced User
Posts: 59
Joined: Tue Dec 17, 2013 6:29 pm

Re: Random Triggers

Post by leothlon »

think you'd do it with a scritp..

i'm not good at python but a quick google search gave me this:
http://effbot.org/pyfaq/how-do-i-genera ... python.htm
import random
print random.randrange(1,10)

so i guess your scritpt would be something like this:

import random
eg.TriggerEvent("randomBlinkingLight." + random.randrange(1,10))

if i'm not mistaken it would trigger an event named:
randomBlinkingLight.1 to randomBlinkingLight.10

then you can drag that to the correct udp command macro.


So step-by-step:
1, set an timmer with scheduleghost or simmular to trigger event "myBlinkingLightTrigger" or something.
2, drag this trigger to a macro with the above script, (also if you want the other lights to turn off here could be a good place to add udp commands to turn all lights off)
3, drag the triggers from the script to macros containing the corresponding udp command.
holdestmade
Experienced User
Posts: 182
Joined: Thu Dec 04, 2014 2:44 pm

Re: Random Triggers

Post by holdestmade »

Brill, worked a treat !

Thanks very much.
dt1000
Posts: 27
Joined: Thu Apr 01, 2010 5:46 am

Re: Random Triggers

Post by dt1000 »

Thanks for the great info!
I had to make a teeeny little change to get it working, but otherwise it was perfect! :)

Code: Select all

import random
eg.TriggerEvent("Playlist." + str(random.randrange(1,4)))
Post Reply