stopvideo scripting error

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

stopvideo scripting error

Postby Tony_LaRocca » Sun Mar 30, 2008 4:00 am

Little story behind this one: For some reason, the Divx 6x videos I make won't play correctly if I integrate them directly into the frames, so I've played them with scripting instead. Looping videos, such as clock pendulums, to make the game more realistic.

If I click on a direction leading from the "clock room" I use the stopvideo script command, or else my pendulum animation will be playing on the next frame. So far so good.

The problem is, I have a few "examine item" frames. (If I drag one item on top of my "examine" icon, which leads to a frame showing a closeup of the item in question) Unless I use the "stopvideo" command in the frame's script, my pendulum vid will obviously continue over such frames, if the player decides to examine an item from the "clock room." HOWEVER - If the player examines an item when he/she is NOT in a frame where a video is playing, I get this error:

"Control array element 1 doesn't exist"

Obviously, this is because I'm telling it stop playing a video that is not there. But can anyone think of a way around it?

Thank you
-Tony
User avatar
Tony_LaRocca
Member
 
Posts: 34
Joined: Wed Feb 20, 2008 4:14 am

Postby Lyberodoggy » Sun Mar 30, 2008 8:07 am

Well tony, this is is an easy one:
You can either type the stopvideo command in every frame which hasn't got a video, or place an if:
Alter the procedure for playing videos so that it has one more line
Code: Select all
videoenabled=1

the same for the procedure for stopping it
Code: Select all
videoenabled=0

Create the integer variable videoenabled
Now go to your code and add this IF:
Code: Select all
If videoenabled=1 then
your code goes here
end If




Hope this helped
The problem was generated by the fact that there is no MediaplayerObject(1) in the frames where you have already stopped the video.
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby GM-Support » Sun Mar 30, 2008 5:01 pm

Alternatively, you can replace the "StopVideo" code (which I guess you have placed under the "Advanced" tab of the "Project Properties" so that it is executed in every frame) with the following one:

Code: Select all
If UBound(MediaPlayerObject) > 1 Then
  'your StopVideo code goes here
End If


The "if" condition in the code allows making sure that the MediaPlayerObject(1) exists.
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Lyberodoggy » Sun Mar 30, 2008 5:25 pm

Thanks GM, that's what I originally tried to do, but I didn't know how...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Tony_LaRocca » Sun Mar 30, 2008 9:10 pm

thanks very much!
User avatar
Tony_LaRocca
Member
 
Posts: 34
Joined: Wed Feb 20, 2008 4:14 am


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests