logo

Live Production Software Forums


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

Notification

Icon
Error

15 Pages«<131415
Options
Go to last post Go to first unread
doggy  
#281 Posted : Thursday, September 15, 2022 6:59:20 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 4,221
Belgium
Location: Belgium

Thanks: 244 times
Was thanked: 758 time(s) in 618 post(s)
Originally Posted by: titasas Go to Quoted Post






Thanks, but elseif not work for me :|

do while True
if Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
elseif
Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
elseif
Input.Find("home-powerplay.gtzip").Text("pp.Text") < "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5") and something with setpanX
else
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="5")
end if
sleep(500)
Loop


And get Error Line 4 BC30201: Expression expected error




Please put code in language syntax highlights for clarity in posting !

Error says it all , there is no expression after if (and use Else if ). it's asking else if what ?

Helps to browse through this topic/post to find examples!
Studying vb.net (can google for it) helps too

Code:
If x = 1 then
 'do this
Else if x = 2 then
 'do this 
Else if x=3 and x= 4 then
 'do that
else 
 'do something else
end if  
Roy Sinclair  
#282 Posted : Thursday, September 15, 2022 8:43:53 AM(UTC)
Roy Sinclair

Rank: Advanced Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 48
United States
Location: Wichita

Thanks: 5 times
Was thanked: 8 time(s) in 7 post(s)
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: titasas Go to Quoted Post






Thanks, but elseif not work for me :|

do while True
if Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
elseif
Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
elseif
Input.Find("home-powerplay.gtzip").Text("pp.Text") < "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5") and something with setpanX
else
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="5")
end if
sleep(500)
Loop


And get Error Line 4 BC30201: Expression expected error




Please put code in language syntax highlights for clarity in posting !

Error says it all , there is no expression after if (and use Else if ). it's asking else if what ?

Helps to browse through this topic/post to find examples!
Studying vb.net (can google for it) helps too

Code:
If x = 1 then
 'do this
Elseif x = 2 then
 'do this 
Elseif x=3 or x= 4 then
 'do that
else 
 'do something else
end if  


Corrected code example, there's no space between else and if in "elseif" and "x = 3 and x = 4" will never be true since x cannot be equal to both 3 and 4 at the same time. Probably would have been ok, but there's always someone who will try an example and spend hours scratching their heads because what's obvious to us is not at all clear to them.

titasas  
#283 Posted : Thursday, September 15, 2022 4:33:13 PM(UTC)
titasas

Rank: Newbie

Groups: Registered
Joined: 9/21/2021(UTC)
Posts: 6
Lithuania
Location: Elektr─Śnai

Originally Posted by: Roy Sinclair Go to Quoted Post
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: titasas Go to Quoted Post






Thanks, but elseif not work for me :|

do while True
if Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
elseif
Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
elseif
Input.Find("home-powerplay.gtzip").Text("pp.Text") < "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5") and something with setpanX
else
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="1")
API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="5")
end if
sleep(500)
Loop


And get Error Line 4 BC30201: Expression expected error




Please put code in language syntax highlights for clarity in posting !

Error says it all , there is no expression after if (and use Else if ). it's asking else if what ?

Helps to browse through this topic/post to find examples!
Studying vb.net (can google for it) helps too

Code:
If x = 1 then
 'do this
Elseif x = 2 then
 'do this 
Elseif x=3 or x= 4 then
 'do that
else 
 'do something else
end if  


Corrected code example, there's no space between else and if in "elseif" and "x = 3 and x = 4" will never be true since x cannot be equal to both 3 and 4 at the same time. Probably would have been ok, but there's always someone who will try an example and spend hours scratching their heads because what's obvious to us is not at all clear to them.



Thank you so much to all :)

I think it's possible to combine everything into one script, but I didn't get it, but even with two scripts, what I need finally works.

I share, maybe it will be useful for someone

Code:
do while True
 if Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" then
   API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="1")
 else
   API.Function("MultiViewOverlayoff", Input:="scoreboard.gtzip", Value:="1")
 end if
sleep(100)
Loop


Code:
do while True
 if Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01"  then
   API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
   API.function("setpanX", Input:="home-powerplay2.gtzip", Value:="0.102")
 elseif Input.Find("home-powerplay.gtzip").Text("pp.Text") < "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
   API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
   API.function("setpanX", Input:="home-powerplay2.gtzip", Value:="0")
 else
   API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="5")
   API.function("setpanX", Input:="home-powerplay2.gtzip", Value:="0.102")
 end if
sleep(100)
Loop


If anyone can merge into one, I would appreciate it :))
doggy  
#284 Posted : Thursday, September 15, 2022 5:18:52 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 4,221
Belgium
Location: Belgium

Thanks: 244 times
Was thanked: 758 time(s) in 618 post(s)
Originally Posted by: Roy Sinclair Go to Quoted Post




Code:
If x = 1 then
 'do this
Elseif x = 2 then
 'do this 
Elseif x=3 or x= 4 then
 'do that
else 
 'do something else
end if  


Corrected code example, there's no space between else and if in "elseif" and "x = 3 and x = 4" will never be true since x cannot be equal to both 3 and 4 at the same time. Probably would have been ok, but there's always someone who will try an example and spend hours scratching their heads because what's obvious to us is not at all clear to them.



yeah my mistake (and versus or ) in my hurry
Elseif with or without the space work both in vMix scripting
Roy Sinclair  
#285 Posted : Thursday, September 22, 2022 6:57:17 AM(UTC)
Roy Sinclair

Rank: Advanced Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 48
United States
Location: Wichita

Thanks: 5 times
Was thanked: 8 time(s) in 7 post(s)
Originally Posted by: titasas Go to Quoted Post


...


Thank you so much to all :)

I think it's possible to combine everything into one script, but I didn't get it, but even with two scripts, what I need finally works.

I share, maybe it will be useful for someone

Code:
do while True
 if Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" then
   API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="1")
 else
   API.Function("MultiViewOverlayoff", Input:="scoreboard.gtzip", Value:="1")
 end if
sleep(100)
Loop


Code:
do while True
 if Input.Find("home-powerplay.gtzip").Text("pp.Text") >= "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01"  then
   API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
   API.function("setpanX", Input:="home-powerplay2.gtzip", Value:="0.102")
 elseif Input.Find("home-powerplay.gtzip").Text("pp.Text") < "0:01" and Input.Find("home-powerplay2.gtzip").Text("pp.Text") >= "0:01" then
   API.Function("MultiViewOverlayOn", Input:="scoreboard.gtzip", Value:="5")
   API.function("setpanX", Input:="home-powerplay2.gtzip", Value:="0")
 else
   API.Function("MultiViewOverlayOff", Input:="scoreboard.gtzip", Value:="5")
   API.function("setpanX", Input:="home-powerplay2.gtzip", Value:="0.102")
 end if
sleep(100)
Loop


If anyone can merge into one, I would appreciate it :))


I would caution you to examine the code more closely, you are comparing String variables that have numerical values in them. You are getting away with it in this code because the strings that are found are time values that stay within a range of values that will work but be aware that you are NOT comparing numbers in this code but string values.

If you need to measure actual Time differences in the future you would do well to use DateTime and TimeSpan variable types (or objects) and of course for when comparing for strictly numeric values convert them using the CINT function before comparing. I greatly simplified some code when I found the Timespan variable type could be used to get the interval between two times which I needed for a countdown of the type vMix does NOT provide.

One other thing you should make a habit out of, add comments to your code to say what you are doing. That way someone else looking at your code later to fix a bug or add a feature will be able to follow your thought processes, this is especially important if that later person is you. You won't have to spend as much time remembering why you did something.
Users browsing this topic
15 Pages«<131415
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.