logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Patrick N  
#1 Posted : Thursday, August 29, 2024 2:57:37 PM(UTC)
Patrick N

Rank: Newbie

Groups: Registered
Joined: 8/29/2024(UTC)
Posts: 4
Australia
Location: Sydney

Thanks: 2 times
Hey Guys,

I am looking for the quickest way to transition between images or pull from an excel etc. I have set up a coin flip as an image slide show and can do a cube wipe in between, but I can not set the change duration to less than 1 second. I would ideally like to have the coin "flip" multiple times in a second and pause it.

I was thinking of a similar scenario using dice to "roll" and then pause on any random number.

Any ideas of the best/quickest way to do this?

Thanks.
doggy  
#2 Posted : Thursday, August 29, 2024 7:55:47 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,177
Belgium
Location: Belgium

Thanks: 288 times
Was thanked: 943 time(s) in 778 post(s)
Originally Posted by: Patrick N Go to Quoted Post
Hey Guys,

I am looking for the quickest way to transition between images or pull from an excel etc. I have set up a coin flip as an image slide show and can do a cube wipe in between, but I can not set the change duration to less than 1 second. I would ideally like to have the coin "flip" multiple times in a second and pause it.

I was thinking of a similar scenario using dice to "roll" and then pause on any random number.

Any ideas of the best/quickest way to do this?

Thanks.


Forget about pulling them from an Excel file etc

preload the images (say their input locations are 20 to 25 = 6 sides)
then use a script to let them "roll"

Code:
dim  i as integer

do while true
  for i = 20 to 25
     API.Function("Cube",Input:=i,Duration:="300")
     sleep(300)  'IMPORTANT
  next
loop


use another script to run this one and let it decide a random moment to stop the first script or manually stop the scrip ( shortcut) to make a draw
Mind you random is subjective

is one possible option
thanks 1 user thanked doggy for this useful post.
Patrick N on 8/30/2024(UTC)
WaltG12  
#3 Posted : Friday, August 30, 2024 4:34:37 AM(UTC)
WaltG12

Rank: Advanced Member

Groups: Registered
Joined: 7/4/2021(UTC)
Posts: 209
United States

Thanks: 6 times
Was thanked: 27 time(s) in 25 post(s)
Originally Posted by: doggy Go to Quoted Post
Mind you random is subjective


I want to second this part specifically.

Going through images in order and manually stopping will yield a predictable, if not controllable, result.

If you're looking to do something where that matters, like a raffle or contest, it will likely not pass regulatory muster.

If you need that, look into scripting for a random number generator.

Then use the result of that as a variable to stop the script when it lands on that input.

There's not really such a thing as a random number generator, but this will be a lot closer, if that's something that matters here.

If you go this route, what I'd recommend is actually using 3 scripts:

-1 that calls the random number generator once and sets the resulting value to a title (hidden), dynamic value, or dynamic input

-1 that starts your looping and lets it run for a bit

-1 that's called after a rotation or 2 of all the values (in case the number is an early one you don't want it just rolling once and stopping) that loops 2x faster (or more) than the first script that compares the saved value from the random number generator to the active input. Making it loop at twice the rate of the other script (or faster) will help ensure it stops on the random number, not one or more after it.

EDIT:

Here's a code I found online--I threw it into vMix and it seems to work.

Code:
dim MinValue as integer = 1
dim MaxValue as integer = 6
dim RandomNumber as integer

Static Generator As System.Random = New System.Random()

' Get a random number greater than or equal to MinValue and less than or equal to MaxValue
RandomNumber = Generator.Next(MinValue, MaxValue + 1)

' By default, MaxValue isn't included. Using MaxValue + 1 instead of MaxValue fixes that.  You can also just set MaxValue as 1 higher than needed.

API.Function("SetDynamicValue1",Value:=RandomNumber)


EDIT 2:

Actually, I'd suggest 4 scripts, just to keep things clean.

Script 1 will be called "StartRoll".

This will be the script you start manually when you're ready.

Code:
API.Function("ScriptStart",Value:="RandomGenerator")
Sleep(100)
API.Function("ScriptStart",Value:="RollDie")
Sleep(3000)
API.Function("ScriptStart",Value:="CheckWinner")



Script 2 will be called "RandomGenerator".

It's the one I posted earlier, but adapted to use doggy's suggestion, it'll look like this:

Code:
dim MinValue as integer = 20
dim MaxValue as integer = 25
dim RandomNumber as integer

Static Generator As System.Random = New System.Random()

' Get a random number greater than or equal to MinValue and less than or equal to MaxValue
RandomNumber = Generator.Next(MinValue, MaxValue + 1)

' By default, MaxValue isn't included. Using MaxValue + 1 instead of MaxValue fixes that.  You can also just set MaxValue as 1 higher than needed.

API.Function("SetDynamicValue1",Value:=RandomNumber)


Script 3 is called "RollDie"--this is the script doggy provided above.

Script 4 is called "CheckWinner".

This is where you pull it all together.

Code:
Do while true

dim xml as string = API.XML()
dim DynamicValue1 as string = ""
dim Output as string = ""

dim x as new system.xml.xmldocument
x.loadxml(xml)

DynamicValue1 = (x.SelectSingleNode("//dynamic/value1").InnerText)
Output = (x.SelectSingleNode("/vmix/active").InnerText)

If DynamicValue1 = Output
API.Function("ScriptStop",Value:="RollDie")
Sleep(100)
API.Function("ScriptStop",Value:="CheckWinner")
End if

Sleep(10)
loop


I tested--it all works for me.

I did have to significantly decrease the wait time for looping on the "Check Winner" (as you can see), because I kept hitting the next input after the generated one with "Sleep(100)".

That may not matter to you--in fact, you may prefer it with the additional randomness added.

EDIT 3

Another thing you may want to consider is using a larger number set from the generator instead of giving it a choice of only 6 numbers, and then adjusting them separately.

This is based, again, on a 6 sided die (102 options is divisible by 6 so every number is included 17 times--it doesn't cut off partway through the range) and the input numbers in doggy's original script.

Code:
dim MinValue as integer = 0
dim MaxValue as integer = 101
dim RandomNumber as integer
dim RandomNumberAdjusted as integer


Static Generator As System.Random = New System.Random()

' Get a random number greater than or equal to MinValue and less than or equal to MaxValue
RandomNumber = Generator.Next(MinValue, MaxValue + 1)

' By default, MaxValue isn't included. Using MaxValue + 1 instead of MaxValue fixes that.  You can also just set MaxValue as 1 higher than needed.


If RandomNumber < “6”
RandomNumberAdjusted = RandomNumber + 20
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “6” AndAlso RandomNumber < “12”
RandomNumberAdjusted = RandomNumber + 14
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “12” AndAlso RandomNumber < “18”
RandomNumberAdjusted = RandomNumber + 8
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “18” AndAlso RandomNumber < “24”
RandomNumberAdjusted = RandomNumber + 2
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “24” AndAlso RandomNumber < “30”
RandomNumberAdjusted = RandomNumber - 4
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “30” AndAlso RandomNumber < “36”
RandomNumberAdjusted = RandomNumber - 10
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “36” AndAlso RandomNumber < “42”
RandomNumberAdjusted = RandomNumber - 16
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “42” AndAlso RandomNumber < “48”
RandomNumberAdjusted = RandomNumber - 22
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “48” AndAlso RandomNumber < “54”
RandomNumberAdjusted = RandomNumber - 28
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “54” AndAlso RandomNumber < “60”
RandomNumberAdjusted = RandomNumber - 34
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “60” AndAlso RandomNumber < “66”
RandomNumberAdjusted = RandomNumber - 40
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “66” AndAlso RandomNumber < “72”
RandomNumberAdjusted = RandomNumber - 46
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “72” AndAlso RandomNumber < “78”
RandomNumberAdjusted = RandomNumber - 52
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “78” AndAlso RandomNumber < “84”
RandomNumberAdjusted = RandomNumber - 58
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “84” AndAlso RandomNumber < “90”
RandomNumberAdjusted = RandomNumber - 64
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “90” AndAlso RandomNumber < “96”
RandomNumberAdjusted = RandomNumber - 70
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Elseif RandomNumber >= “97” AndAlso RandomNumber < “102”
RandomNumberAdjusted = RandomNumber - 76
API.Function("SetDynamicValue1",Value:=RandomNumberAdjusted)
Console.WriteLine(RandomNumber)

Else
Console.WriteLine(“Number out of range”)

End if
thanks 3 users thanked WaltG12 for this useful post.
doggy on 8/30/2024(UTC), Patrick N on 8/30/2024(UTC), nikosman88 on 8/31/2024(UTC)
Patrick N  
#4 Posted : Friday, August 30, 2024 11:25:44 AM(UTC)
Patrick N

Rank: Newbie

Groups: Registered
Joined: 8/29/2024(UTC)
Posts: 4
Australia
Location: Sydney

Thanks: 2 times
Thanks all, I have never done scripting before, but I'm excited to give it a try.
WaltG12  
#5 Posted : Friday, August 30, 2024 3:08:02 PM(UTC)
WaltG12

Rank: Advanced Member

Groups: Registered
Joined: 7/4/2021(UTC)
Posts: 209
United States

Thanks: 6 times
Was thanked: 27 time(s) in 25 post(s)
I did a brief mockup of how this looks.



You'll notice you roll out of whatever screen you're on when the roll script starts.

If you want a different transition, you'll want to set it up in that first script that calls the others--the one I called "StartRoll".

I'd put it between the first ScriptStart and the second ScriptStart.
Peter1000  
#6 Posted : Friday, August 30, 2024 5:06:49 PM(UTC)
Peter1000

Rank: Advanced Member

Groups: Registered
Joined: 1/25/2019(UTC)
Posts: 300
Switzerland

Thanks: 16 times
Was thanked: 79 time(s) in 60 post(s)
In a numbers lottery, a distinction should be made between drawing the winning number and displaying the result.
For the winner, it is not important whether the result is generated in real time or whether a corresponding video is presented as the result of a draw.
We have realized various prize draws. First we draw a number, then we trigger the event and play the corresponding video, for example.
In the case of a dice game, these are 6 short videos that are played as a result of the draw.
The videos can be produced more elaborately than in vMix with cube roll. (e.g. Adobe AE or with HTML)

I have included a short script which draws a number and then plays the corresponding video.

Code:

Dim rand As New Random()
Dim randomNumber As Integer = rand.Next(1, 7) 

' the script assumes that the 6 videos are in inputs 1 - 6.
Select Case randomNumber
    Case 1
        API.Function("Cutdirect",1,)
        API.Function("Play",1,)
        console.writeline ("random number is 1")
    Case 2
        API.Function("Cutdirect",2,)
        API.Function("Play",2,)
        console.writeline ("random number is 2")
    Case 3
        API.Function("Cutdirect",3,)
        API.Function("Play",3,)
        console.writeline ("random number is 3")
    Case 4
        API.Function("Cutdirect",4,)
        API.Function("Play",4,)
        console.writeline ("random number is 4")
    Case 5
        API.Function("Cutdirect",5,)
        API.Function("Play",5,)
        console.writeline ("random number is 5")
    Case 6
        API.Function("Cutdirect",6,)
        API.Function("Play",6,)
        console.writeline ("random number is 6")
End Select
WaltG12  
#7 Posted : Saturday, August 31, 2024 4:20:04 AM(UTC)
WaltG12

Rank: Advanced Member

Groups: Registered
Joined: 7/4/2021(UTC)
Posts: 209
United States

Thanks: 6 times
Was thanked: 27 time(s) in 25 post(s)
Originally Posted by: Peter1000 Go to Quoted Post
For the winner, it is not important whether the result is generated in real time or whether a corresponding video is presented as the result of a draw.


Yes, it is an option to use pre-rendered graphics to display the winning number.

But there's a reason I didn't suggest it, and that reason is this line. It absolutely does matter.

Obviously, with a tool like vMix, you can prerender anything--

But if something looks obviously prerendered, it's going to raise suspicions.

We're already obfuscating some of the process here.

Combining that with a pre-rendered graphic will make it look like a raffle where you took the hat into a back room alone and came out 5 minutes later holding a ticket and declaring that the winner was your friend Steve.

People not only want to see the draw in real time, they want to feel like they're seeing the draw in real time.

Having a really clean and smooth animation might look nicer, but you're also taking a random number draw that they can't see and obviously starting playback on an obviously prerendered video.

The one doggy & I posted looks really rough. But that's a good thing. Like I said, it could still be prerendered, but people aren't thinking that. It looks live.

With yours, it's (presumably) obvious that you're initiating a video playback.

So you have to prove to your audience that you played the video that says the winner is 4, not because you just hit the button to play the video that says the winner is 4, but because a random number generator that they can't see says the winning number is 4.
Peter1000  
#8 Posted : Saturday, August 31, 2024 2:18:37 PM(UTC)
Peter1000

Rank: Advanced Member

Groups: Registered
Joined: 1/25/2019(UTC)
Posts: 300
Switzerland

Thanks: 16 times
Was thanked: 79 time(s) in 60 post(s)
Quote:
The one doggy & I posted looks really rough. But that's a good thing. Like I said, it could still be prerendered, but people aren't thinking that. It looks live.

So if a simple graph is proof of the correctness of the draw, then your solution would probably be the correct one.
The solution that separates the draw and the output does exactly the same thing. It just looks nicer.
But I hope that the trust of your viewers is not only based on the simplicity of the graphic. Keep it simple, but still attractive :-)
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.