![Alcorn Mcbride V+ series User Manual Download Page 130](http://html1.mh-extra.com/html/alcorn-mcbride/v-series/v-series_user-manual_2892709130.webp)
6-12
Advanced WinScript Programming
that will generate a good random number because the operator could push the
button any time, and will never push it twice at the same time. The following
sequence will generate a random number:
Random
(Autostart Enabled; Looping Enabled)
Label Time
Event
Data1
Data2 Data3 Comment
00:00.00 AddVar
RandomVar
1
increment RandomVar
The following sequences will get a random number when an operator pushes a
button attached to input9. The desired range of random numbers is 0 - 9, so we
will have to trim it down from 0 - 255.
GetRandom
(Start Trigger: Input9)
Label Time
Event
Data1
Data2
Data3 Comment
00:00.00 SetVarEQ MyVar
RandomVar
00:00.00 Start
ForceRange
ForceRange
Forces MyVar to be in range 0-9; (Looping Enabled)
Label Time
Event
Data1
Data2 Data3 Comment
00:00.00 IfVarLE MyVar
9
if <= 9, we’re done
00:00.00 SubVar
MyVar
9
00:00.00 Goto
End
Do it again Sam
Done
00:00.00 Start
GotRandom
00:00.02 Nop
wait 2 frames here
End
00:00.00 Nop
loop here
GotRandom
Random number now in range 0-9; (Looping Enabled)
Label Time
Event
Data1
Data2 Data3 Comment
00:00.00 Reset
ForceRange
Don’t Loop Anymore
00:00.00 Nop
Use MyVar Here
Now let's take these sequences, and add them to our Zoo Animals show above to
show an example of randomization. Assume the Art Director wants the first
four video segments to play at random, not allowing any segment to play more
than once, and then play the summary.
We can’t get a random number four times for two reasons. One, only the first
random number will be truly random, because it is based upon an operator
pressing a button, the remaining three random numbers would all be gotten at a
predictable time after the first one was gotten. Second, if we get four random
numbers, we could get a random number to play a segment we’ve already
played. Checking to see if we have already played a segment, and choosing
another one if so would force us to write way too many sequences. The correct
approach is to get one random number when the operator presses the button,
thereby guaranteeing it is a truly random number, and then using that one
number to determine what order all four segments will be shown in. The
maximum combinations of four selections, each with one unique position are 24.
We’ll also use the Modular Approach #2 for this job. This example shows how
useful the approach can be.
Random
(Autostart Enabled; Looping Enabled)
Label Time
Event
Data1
Data2 Data3 Comment
00:00.00 AddVar
RandomVar
1
increment RandomVar
Summary of Contents for V+ series
Page 2: ...User s Guide To Show Control by Alcorn McBride Inc...
Page 7: ...Third Party Equipment 18 3 Index 19 1...
Page 8: ......
Page 14: ...1 6 Welcome...
Page 28: ...3 14 Show Control Overview GoingToDayModeMsg ClearLine2Msg...
Page 38: ...3 24 Show Control Overview...
Page 82: ...4 44 WinScript User s Guide...
Page 118: ......
Page 144: ...6 26 Advanced WinScript Programming...
Page 170: ...7 26 Application Notes...
Page 220: ...13 8 DMX Machine Hardware Reference...
Page 236: ...14 16 SMPTE Machine Hardware Reference...
Page 254: ...15 18 Appendix A Adding User Defined Serial Protocols...
Page 264: ......