sound scripting

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
dukester70
Posts: 21
Joined: Thu May 16, 2013 11:31 pm

sound scripting

Post by dukester70 »

so my issue is that i get a stackoverflow on my etitly script from the playsound

defineSound{
name = "rat_2",
filename = "mod_assets/samples/dungeon/rats_2.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 1,
}

and my scripte et.

function playSound()
playSound ("rats_2")
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: sound scripting

Post by Neikun »

I'm not sure.
Have you tried

Code: Select all

function playSound()
playSound ("rats_2")
end
Also, your playSound says "rats_2"
but your defined sound is "rat_2"

This sort of error is almost always just a typo.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: sound scripting

Post by JohnWordsworth »

Suggestions...

1. As Neikun said, make sure you call 'playSound(...)' with the same name that you have defined in your defineSound command.

2. Make sure your function has a unique name that doesn't hide an existing function. If the function you are making is indeed called playSound, then when you try to call 'playSound' from within that function you are calling that function from within itself, which is causing infinite recursion (that would cause a crash). You might want to use a different name for your function to play that SFX.

Code: Select all

function playRatSound() 
  playSound("rat_2");
end
3. If your wav file is of an invalid format, that too can cause a crash / problems. I've outlined a bunch of settings I have successfully used here: http://grimwiki.net/wiki/Custom_Sound_Tutorial
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: sound scripting

Post by Neikun »

Also, for future reference, please don't post the same question in multiple spots because you hadn't received an answer yet.
The best course of action is to start your own thread as you've done here. And then simply bump if you feel your question has been forgotten. If the topic is still on the first page, it's too early to bump.

Welcome to the forums! =D
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: sound scripting

Post by Komag »

I cleaned up the other posts. :)
Finished Dungeons - complete mods to play
dukester70
Posts: 21
Joined: Thu May 16, 2013 11:31 pm

Re: sound scripting

Post by dukester70 »

thank you all for the help will try out the links and sorry for being impatient and posting everywhere... again thank you and will tell how it worked out.... :D
dukester70
Posts: 21
Joined: Thu May 16, 2013 11:31 pm

Re: sound scripting

Post by dukester70 »

thank you all again .... and thank you john ... i did have to rename the playsound and add the rat to it and it worked :mrgreen:
Post Reply