control array element '1' doesn't exist

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

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

control array element '1' doesn't exist

Postby Imari » Mon Feb 16, 2009 9:49 pm

I'm back again (from trying to restore the "Project from ~~didn't mean to swear~~") with yet another problem.

I have a hotspot used to play a video when an inventory item is dragged/dropped onto it. When an item is dragged onto the hotspot, the looping video plays nicely. When the hotspot is clicked, the video should stop and it does. BUT, if I click on the hotspot when a video is NOT playing, I'm getting the message that the Scripting Engine returned the message - "control array element '1' doesn't exist."

This is how I have it set up ---
I have cut/pasted GM's code to allow playing video/audio (found here http://www.adventuremaker.com/help/vbscript_techniques.htm, #29) into my global properties. And --- if it matters -- in my global procedures, I also have Shadowhunter's sub routine for Particle+ and GM's sub for playing a looping AVI randomly (#15 on the same link) for an AVI that palys on another frame.

On the Advanced tab of the "Key on hotspot #1" window I have
Code: Select all
PlayVideo GetPath(2) + "KeyTurn.avi", 212, 115, 600, 600, True


On hotspot #1 in the advanced tab, I have
Code: Select all
StopVideo


Using the DeBug tool, it shows the Stop Video as the problem and taking that out does get rid of the error message, but it also lets the video keep playing on successive frame. :cry: Help, please?
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby mercedes » Mon Feb 16, 2009 10:05 pm

I kept getting that too..when i played a video..I ended up putting in the Frame's properties to go to another frame after so many seconds..being the same frame or another one..I'm not sure why that happens..I assume its because at that point the element is no longer there..--Meaning the video isn't playing..? I tried a few things..and couldn't get it to work..so i gave up on it and did that..Stopvideo stops it..but ur right..when u click it afterwards..once u stop it..it gives that error..:?

Hopefully someone else has a good solution for that..No doubt a script saying if stop video..= etc..then actions..sort of thing..might work..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby reneuend » Mon Feb 16, 2009 10:09 pm

You're accessing an object thats been unloaded. I would create a variable and switch between 0 and 1 depending on whether the video is playing or not.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2686
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby Imari » Tue Feb 17, 2009 12:03 am

I can't seem to do this --

On the Advanced tab of the "Key on hotspot #1" window I kept
Code: Select all
PlayVideo GetPath(2) + "KeyTurn.avi", 212, 115, 600, 600, True
and I added a variable "Play_KeyTurn", which goes to "1" when the key is dragged to the hotspot.

I then had the variable go to "0" when hotspot #1 is clicked, but I don;t know where or how to add the "StopVideo" code. :oops: Everything that I've tried either dosn't work or throws up even more errors.
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby reneuend » Tue Feb 17, 2009 12:25 am

Imari wrote:I can't seem to do this --

On the Advanced tab of the "Key on hotspot #1" window I kept
Code: Select all
PlayVideo GetPath(2) + "KeyTurn.avi", 212, 115, 600, 600, True
and I added a variable "Play_KeyTurn", which goes to "1" when the key is dragged to the hotspot.

I then had the variable go to "0" when hotspot #1 is clicked, but I don;t know where or how to add the "StopVideo" code. :oops: Everything that I've tried either dosn't work or throws up even more errors.


Ok....I need to feed the kiddies then I promise I'll work it out! :wink:
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2686
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby mercedes » Tue Feb 17, 2009 12:29 am

What u can do Imari..is disable the hotspot..Are u wanting the video to play again..or anything when the user clicks it again..? Not sure what u want if user clicks again..Might help me try and find a solution here..:D Just trying out stuff..~

If you want to disable the hotspot u can put this in the hotspot u drag the item too..Var=1
in the hotspot u want to stop the video..put this

If Var=1 Then
stopvideo
Hotspot(2).enabled=False
End If

unless u want something else..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Imari » Tue Feb 17, 2009 1:51 am

[doubled post, sorry]
Last edited by Imari on Wed Apr 15, 2009 5:13 pm, edited 1 time in total.
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby Imari » Tue Feb 17, 2009 1:55 am

I need to reuse the hotspot repeatedly and for several different items and videos.

This hotspot is part of the "Viewer" for the "template" that I'm trying to make, which is basically a "front end"/GUI that anyone could add to and build a game in AM. I've got splash screens, a custom menu, a journal, and final scrolling credits. On each page there are four buttons - "menu", "transporter", "viewer" and "journal". I'm still (:cough:) working on the save-load screen, but I thought that I had the "Viewer" finished --- until the error message popped-up. :?

For the Viewer --- Click on the Viewer button on any frame and you goto the Viewer frame. On the Viewer frame, drag any inventory item icon onto a "screen" (hotpsot #1) and a rotating image (the looping AVI) of your inventory item plays. (The magnifier screen with video.)

I need to code it so that no error occurs when the hotspot is clicked and the AVI is not playing.

(I'd have sworn that I had this working yesterday, but the only thing that I've done is to add in the save info in the Save-Load screen and that doesn't appear to have anything to do with video or controls.... I ...don't ...think... )
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby juhuwoorps » Tue Feb 17, 2009 2:14 am

On the variable tab of where you drag the item (HS1) you have to set a variable=1 (on key on hotspot properties)

In the advanced tab you have to use this:
if variable=1 then
StopVideo
variable=0
end if

So you can just call StopVideo when a video is running
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby mercedes » Tue Feb 17, 2009 2:18 am

Yup..that works..I had tested that before..and it wouldn't work for me..before..I must have missed something..Oh thats right..i set the variable afterwards to 0..Ok..lol..

Peace
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Imari » Tue Feb 17, 2009 3:00 am

Holy cow.... it works like a charm. Many, many thanks.
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Postby reneuend » Tue Feb 17, 2009 3:44 am

Glad someone stepped in! I got too busy on other things and couldn't get back.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2686
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby 3dgamer » Wed Apr 15, 2009 6:58 am

juhuwoorps wrote:On the variable tab of where you drag the item (HS1) you have to set a variable=1 (on key on hotspot properties)

In the advanced tab you have to use this:
if variable=1 then
StopVideo
variable=0
end if

So you can just call StopVideo when a video is running


Thanks, Juhu, for posting this solution. So far it seems to be helping a similar issue I am currently having. Will need to test it just a couple of more times to make sure, but I think this will do the trick.

Thanks for the suggestion! :)

-------------------[EDIT]---------------------------
Hi Juhu,

Okay, it seems this code helped resolved the "Stop Video" issues I was having, but I still was getting the "Control Array" error messages for some reason.

However, I believe I was been able to find one way to resolve this thing, once and for all. :D

Please read my notes and mini-tutorial at the following link - [VBS Code] Why Am I Getting This Error Message? [SOLVED! :)] - http://www.adventuremaker.com/phpBB/viewtopic.php?t=4891

Thanks to all! :D
3DGamer
User avatar
3dgamer
Expert Member
 
Posts: 301
Joined: Mon Dec 15, 2008 7:12 am


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron