Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support
'User clicked on the hotspot, so toggle the value of the variable
if play_music = 0 then
play_music = 1
else
play_music = 0
end if
'Now decide if the sound should be played
if play_music = 0 then
PlaySoundWin7 "soundfile", 1, 10
else
StopSoundWin7 10
end if
Sub PlaySoundWin7(SoundFile, NumRepeat, ChannelNumber)
If ChannelNumber < 9 Then
'With VBScript it is currently not possible to interact with the 8 first audio channels.
MsgBox "The specified audio channel is invalid.", vbCritical, "Error"
Exit Sub
End If
If Action.IsComponentInstalled("NSPlay.NSPlayCtl.1") = False Then
MsgBox "Unable to find the media player component.", vbCritical, "Error"
Else
If Action.DoesComponentExist("MediaPlayer" + CStr(ChannelNumber)) = false Then
AddComponent "NSPlay.NSPlayCtl.1", "MediaPlayer" + CStr(ChannelNumber)
End If
Component("MediaPlayer" + CStr(ChannelNumber)).Object.FileName = SoundFile
Component("MediaPlayer" + CStr(ChannelNumber)).Object.PlayCount = NumRepeat
Component("MediaPlayer" + CStr(ChannelNumber)).Object.Play
End If
End Sub
Sub StopSoundWin7(ChannelNumber)
If ChannelNumber < 9 Then
'With VBScript it is currently not possible to interact with the 8 first audio channels.
MsgBox "The specified audio channel is invalid.", vbCritical, "Error"
Exit Sub
End If
If Action.DoesComponentExist("MediaPlayer" + CStr(ChannelNumber)) = true Then
Component("MediaPlayer" + CStr(ChannelNumber)).Object.Stop
End If
End Sub
PlaySoundWin7 GetPath(4) & "wolves_howling.wav", 1, 9
Return to Adventure Maker General Discussion
Users browsing this forum: No registered users and 0 guests