Author Topic: Usage of "PlaySound"  (Read 2091 times)

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Usage of "PlaySound"
« on: June 28, 2004, 07:11:09 PM »
From sheer laziness and unwillingness to try to add music for an NPC with the "how to add a .MUS file" I've resorted to the PlaySound script action function for a 9 sec .wav file.  One thing puzzles me though.  The sound has to be called from the "Sounds" sub-directory if it is not one of the already existnig in-game sounds.  Also, despite it blaring when I play the .wav file back via Sound Recorder it is rather subdued when activated by a NPC's .BCS file.  Also, it doesn't always play -- I"ve found that sometimes in the .BCS I've had to include a Wait(3) statement to ensure ti plays.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7244
Re: Usage of "PlaySound"
« Reply #1 on: June 28, 2004, 07:50:12 PM »
From sheer laziness and unwillingness to try to add music for an NPC with the "how to add a .MUS file" I've resorted to the PlaySound script action function for a 9 sec .wav file.  One thing puzzles me though.  The sound has to be called from the "Sounds" sub-directory if it is not one of the already existnig in-game sounds.

This one doesn't sound right. Kelsey's actual song plays out of override (we use PlaySong, but only to mute the other in-game music.)

Quote
Also, despite it blaring when I play the .wav file back via Sound Recorder it is rather subdued when activated by a NPC's .BCS file.  Also, it doesn't always play -- I"ve found that sometimes in the .BCS I've had to include a Wait(3) statement to ensure ti plays.

The Wait(3) thing might just be a vagary of the engine.

As for the in-game volume, it's affected by a few different things, including your in-game audio settings, and where the script plays and where the camera is currently viewing. PlaySound() is fixed to a point in space, so where you're looking actually affects the audio.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Usage of "PlaySound"
« Reply #2 on: June 29, 2004, 09:48:09 AM »
Thanks - will take another look at my ingame sound settings because I know I've reduced some of the defaults except for voice volume.  Since I have a save game prior to where it kicks in I'll delete it from Sounds and move it to Override.

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Usage of "PlaySound"
« Reply #3 on: June 29, 2004, 06:33:35 PM »
Frustration  :(

Adjusted in game sounds - no change in volume so no joy here.

What I'm trying to do is add the 9 sec .wav file to play before the SAY @112 or simiilar actions further down in the npc's J.D file.  It works when called from the .BCS file but not in the "NPCj.D" file.  I get a Weidu parse error.  I did take a quick look at Kelsey this afternoon but a quick search didn't turn up any use of the PlaySound action id so if you can direct me to the appropriate file I'd appreciate it.  I had  tried adding a PlaySound ("marylamb")  on the line before the "SAY @112" where I wanted it to activate and got a Weidu parse error.

IF WEIGHT #0 ~Global("SilDream1","GLOBAL",1)~ THEN DSildream1

this is where I want it to start playing if I remove it from the .bcs
SAY @112
  IF ~~ DO ~SetGlobal("SilDream1","GLOBAL",2)~ GOTO Sildream2
END

As always, thanks!

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Usage of "PlaySound"
« Reply #4 on: June 29, 2004, 06:59:32 PM »
What is @112?  If it doesn't have a sound file attached to it, you could just add the "song" .wav file that way.
Earn Money Sleeping.

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7244
Re: Usage of "PlaySound"
« Reply #5 on: June 29, 2004, 09:23:21 PM »
What I'm trying to do is add the 9 sec .wav file to play before the SAY @112 or simiilar actions further down in the npc's J.D file.  It works when called from the .BCS file but not in the "NPCj.D" file.  I get a Weidu parse error.  I did take a quick look at Kelsey this afternoon but a quick search didn't turn up any use of the PlaySound action id so if you can direct me to the appropriate file I'd appreciate it.

It's in J#KLSY.baf/.bcs, but Ghrey's right, you might be better off just putting it in the SAY line itself. At 9 seconds, it would be fine. Very long audio clips in SAY lines can cause the game to hiccup (a common complaint about Mirrabbo Imoen, for instance) but 9 seconds is just fine.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Usage of "PlaySound"
« Reply #6 on: June 30, 2004, 07:36:47 AM »
Thanks - I'll take a look at the J#KLSY.BAF tonite to see how you did it.  I have used .wav files in conjunction with .tra files but I wanted to ensure that these few bars would play before the dialog displayed.

It's funny though....when called from the dialog file the sound volume is fine.  Go figure.

Offline SimDing0

  • Back In Black
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3496
  • Gender: Male
  • Word Enhancer
Re: Usage of "PlaySound"
« Reply #7 on: June 30, 2004, 08:02:29 AM »
It's in J#KLSY.baf/.bcs, but Ghrey's right, you might be better off just putting it in the SAY line itself. At 9 seconds, it would be fine. Very long audio clips in SAY lines can cause the game to hiccup (a common complaint about Mirrabbo Imoen, for instance) but 9 seconds is just fine.
Hiccupping is not my complaint. Mirrabbo's music playing OVER the game music is, however. Don't do that. :)

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7244
Re: Usage of "PlaySound"
« Reply #8 on: June 30, 2004, 08:46:34 AM »
It's a shame that there's not a better way to kill the in-game music (that I'm aware of, anyway) than to use the mute-song trick. It's such a shame to fill up the precious SONGLIST.2DA slots with muters.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline SimDing0

  • Back In Black
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3496
  • Gender: Male
  • Word Enhancer
Re: Usage of "PlaySound"
« Reply #9 on: June 30, 2004, 08:51:49 AM »
PlaySong(0) doesn't work?

Offline Diana

  • Neophyte
  • Planewalker
  • *****
  • Posts: 251
  • Gender: Female
Re: Usage of "PlaySound"
« Reply #10 on: June 30, 2004, 09:23:01 AM »
Quote
PlaySong(0) doesn't work?
I don't have the technical smarts to convert a .wav file to .mus and add it to the songlist.  This was my quick and easy workaround.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: