Trigger sound events via script

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

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

Trigger sound events via script

Postby Lyberodoggy » Tue Jun 22, 2010 11:23 am

A lot of you guys where concerned when the newest version of AM disabled the option to trigger sounds via scripting. Well, me too. But while working on a project I figured a temporary workaround.

Well the concept is quite simple. You need an amount of sounds to be triggered on a frame through code. In older versions, you just needed to have the sounds in the external folder and then use the custom sub PlaySound included in the help files.
Now what I thought is: At first create the same amount of hotspots as the sounds needed. You need to play five sounds? Create five different hotspots and keep their numbers in mind.
Go to the hotspots' sound tab and add one sound per hotspot.
Then drag and drop every hotspot on top of each other and create a bigger hotspot over them with no action at all (this will prevent the user from clicking the sound hotspots by accident)

Now all you have to do is trigger the hotspot using
SimulateHotspotClick hotspot_number
in the code that should trigger the sound.
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Wed Jun 23, 2010 4:54 am

I didn't know that the PlaySound command was disabled, I just thought that it wouldn't work for Windows 7. But since I haven't used the new beta version, I don't know.

Anyhow, your workaround would work for Windows 7?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Wed Jun 23, 2010 1:26 pm

yes, since the sound tabs work
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Imari » Wed Jun 23, 2010 10:52 pm

Nice, Lyberodoggy. :)
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest