can anyone help with sound script?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
MYNAMEIS
Posts: 7
Joined: Sun Oct 14, 2012 2:54 pm

can anyone help with sound script?

Post by MYNAMEIS »

i need to play sound, called "horror" in this place.
I already done all in the file "sounds.lua".
So i only need to do something with script.
Can anyone help me? :3

i used that script:
playSoundAt(sound, level, x, y), so i wrote this:

function playSound()
playSoundAt(horror, 10, 29, 16)
end

and pc says me:

bad argument #1 to 'playSoundAt' (string expected, got nil)

what i supposed to do? where is error?

Image
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: can anyone help with sound script?

Post by JohnWordsworth »

Hi MYNAMEIS,

Sounds are one of those things that can be a little bit fiddly. Luckily, this looks like a nice easy fix. As the error states: "bad argument #1 to 'playSoundAt' (string expected, got nil)"

The function playSoundAt requires the name of the sound effect definition as the first parameter. This should be a "string" variable, what you have provided is a variable named horror, which presumably doesn't exist and is therefore nil. The solution is just to add quotes:

playSoundAt("horror", 10, 29, 16);

Hope your mod is going well!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: can anyone help with sound script?

Post by Komag »

You also might consider naming the function something else just to be clear, because playSound is already a standard command
Finished Dungeons - complete mods to play
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: can anyone help with sound script?

Post by Neikun »

I agree with Komag,
try a function more like playHorror

Also, can we get a look at your sounds.lua?
"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!
MYNAMEIS
Posts: 7
Joined: Sun Oct 14, 2012 2:54 pm

Re: can anyone help with sound script?

Post by MYNAMEIS »

thanks! :D
Post Reply