Error Executing Script - Type Mismatch: mediaplayerobject

Everything AM users with W7 computers need to know

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

Error Executing Script - Type Mismatch: mediaplayerobject

Postby reneuend » Sun Dec 19, 2010 6:31 pm

I'm getting this error every time I click on a hotspot or when a new frame loads. I can't seem to locate the issue. I turned off transitions, but that didn't make a difference. Has anyone else experienced this and know how to get around it?

(edit) I loaded my Picture Perfect puzzle game and for the most part it worked, except for this particular error showing up when I click on a hotspot. But it seems random because it doesn't happen on most hotspots. I'll check to see if it repeats with the same sequence.
Attachments
win7 type mismatch mediaplayerobject error.jpg
Windows 7 Error Message
win7 type mismatch mediaplayerobject error.jpg (23.58 KiB) Viewed 9668 times
---


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

Postby juhuwoorps » Mon Dec 20, 2010 7:50 am

Are you playing sounds in any of the hotspots with VBscript?
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Mon Dec 20, 2010 2:39 pm

Yes. I'm sure I am....let me guess..you can't do that? :oops:
---


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

Postby juhuwoorps » Mon Dec 20, 2010 3:36 pm

you need an other a code as normaly. Im typing this from my cellphone so i cant copy the right code now but you can find it here at the forum
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby reneuend » Mon Dec 20, 2010 4:25 pm

When you get a chance, I would really appreciate it! I need more control over the sound like with creating timed events and delays.

(edit) I found the thread where GM shows how to play sound now.
http://www.adventuremaker.com/phpBB2/viewtopic.php?t=5382
I created a subroutine with it. However, it would be better if there was a endless loop and then another routine to stop the sound.

Thanks for responding Juhu!


Code: Select all
sub PlaySoundWin7(SoundFile, NumRepeat)

  If Action.IsComponentInstalled("NSPlay.NSPlayCtl.1") = False Then
    MsgBox "Unable to find the media player component.", vbCritical, "Error"
  Else
    If Action.DoesComponentExist("MediaPlayer1") = false Then
      AddComponent "NSPlay.NSPlayCtl.1", "MediaPlayer1"
    End If
    Component("MediaPlayer1").Object.FileName = SoundFile '(replace with your file)
    Component("MediaPlayer1").Object.PlayCount = NumRepeat
    Component("MediaPlayer1").Object.Play
  End If
 
End Sub

---


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

Postby Mystery » Mon Dec 20, 2010 7:05 pm

Wouldn't 0 for NumRepeat loop it endlessly? That was at least the case with the previous code (that is not compatible with W7).
And if that works, there must be a way to stop the player, too.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby CBSection31 » Mon Dec 20, 2010 7:33 pm

If I recall, GM_Support released an updated code for playing sounds through VBScript in Windows 7. I used it for The Filmmaker, and it worked flawlessly...unfortunately, I don't have access to that project's code at the moment. If you search through the Windows 7 thread in this forum, I think the code is there. :)
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby Mystery » Mon Dec 20, 2010 7:36 pm

I think that's the script that reneuend quoted above :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby reneuend » Mon Dec 20, 2010 8:01 pm

Hi Mystery,
Nice to hear from you again.
I haven't found a way to stop the sound or to run multiple sounds at the same time, even though i experimented with GM's code. If someone knows of a way to do either or both of these that would help out a lot!
---


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

Postby Mystery » Mon Dec 20, 2010 8:40 pm

Thanks reneuend :D I was too busy lately, but now I have some Christmas vacation :D

Well, I just successfully used the following script to stop the sound - I'm on Vista, so double check it for W7:

Code: Select all
Component("MediaPlayer1").Object.Stop
Last edited by Mystery on Mon Dec 20, 2010 8:42 pm, edited 1 time in total.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby reneuend » Mon Dec 20, 2010 9:07 pm

AWESOME!!!!!!

W need to start a place where we can collect new routines for Windows 7. :wink:

Now, one more thing. How do you play multiple channels with this new routine? Since you're on vacation, I figure it wouldn't hurt to ask for more! :)
---


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

Postby Mystery » Mon Dec 20, 2010 9:12 pm

I don't think it was ever possible to use the different channels with scripting? I think the channel is selected randomly.
You should be able to add a sound by going to the Audio Tab of the Hotspot Properties.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby reneuend » Mon Dec 20, 2010 9:38 pm

Nice try. You're not getting out of it that easy! :)
It was possible because I wrote my own routine to allow channel selection.

Code: Select all
Sub PlaySound2(FileName, Channel, Repeat)
  Action.LoadControl MediaPlayerObject(Channel)
  MediaPlayerObject(Channel).FileName = FileName
  If Repeat = True Then
    MediaPlayerObject(Channel).PlayCount = 0
  Else
    MediaPlayerObject(Channel).PlayCount = 1
  End If
  MediaPlayerObject(Channel).Play
End Sub
---


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

Postby Mystery » Mon Dec 20, 2010 9:50 pm

LOL, how on Earth should I know how to update your own subroutine for W7? I'm not ShadowHunter ;) :lol:
Sorry, I have no idea how to add channels to the new code :?
You might have to wait for smarter people :lol:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby juhuwoorps » Mon Dec 20, 2010 10:27 pm

I'm glad you have found the code.
Mysterys code for stoping sound work with WIN7. I have tried it a longer time ago as AM4.6.0 was released.

Now I have to give your subroutine a try :)
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm


Return to Windows 7 issues

Who is online

Users browsing this forum: No registered users and 0 guests

cron