Page 1 of 1
Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 2:08 am
by Paul
New to the forum, hello everyone...
Long time Grimrock player, including most mods. This past weekend I fired up the editor for the first time to try my hand at my own work. If you could spare a moment, I'm rather frustrated with the basic scripting function of playing a built-in sound being activated by a lever. Done the research, forum search, modding page help, google, etc. have the printHud functioning just fine, but the playSound returns error message "Warning! no such sample". Here's the lua script call, based on my understanding that the built-in sounds only require the specific .wav file name all should be well. I looked into custom sound scripting where it shows the assets path but again, my understanding is that is only required if I were to download a specific .wav file that required it to be defined. I must be missing something simple, can't put my finger on it and it's driving me nutz. Note that the sound is an example, I've tried a couple to no avail. Also, specific to the file path, and using Steam, it's my understanding that the .wav files are located in the .dat file, I can not locate any specific directory for the .wav files. Is this also correct? Thanks! - Paul
-- warning world script
function warning()
hudPrint("You Were Warned")
playSound("party_move_overloaded_01")
end
Re: Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 2:31 am
by Komag
just use the sound name on the left side of the list, not the file name
Re: Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 3:05 am
by JohnWordsworth
Hi Paul, you are correct in saying that all of the pre-defined sound effects that come with the game are packed into the .dat file which is read by the game. However, you can see a list of all of the sound effects that come packaged with the game here;
http://www.grimrock.net/modding/list-of ... ed-sounds/
You should be able to play any of those sound effects by simply using... playSound(<sound name>)
So, the one it looks like you are hunting for would be... playSound("party_move_overloaded");
Adding your own WAV files is just a case of defining your own sound assets with your own names, and then you can play them in the same way. There are a bunch of gotcha's - so if you start wanting to use your own WAVs, then feel free to check back here on the forums!
Re: Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 3:50 am
by JohnWordsworth
Note. If you would like to add your own custom .wav files, or .ogg files as background music, I have just finished my latest tutorial on the GrimWiki!
Custom Sound Tutorial:
http://grimwiki.net/wiki/Custom_Sound_Tutorial
Re: Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 11:29 am
by SpiderFighter
Welcome to the forums, Paul!
JohnWordsworth wrote:Note. If you would like to add your own custom .wav files, or .ogg files as background music, I have just finished my latest tutorial on the GrimWiki!
Custom Sound Tutorial:
http://grimwiki.net/wiki/Custom_Sound_Tutorial
I've played with audio a lot, and was going to jump in with my own 2 cents, but you've left not much for me to give! Seriously, terrific tutorial, JW. The only thing I would add is the playSoundAt("yourCustomSound",8, 6, 2) where 8 is the level of the dungeon the sound is to be played on, 6 is the X coordinate, and 2 is the Y coordinate. If you want the .wav included in the filename (for custom sounds), you can change that in your objects.lua. You can also define the distances (in terms of player tile movement around the sound) at which your sound can be heard:
Code: Select all
defineSound{
name = "yourCustomSound", --this can also be "yourCustomSound.wav"
filename = "yourCustomSound.wav",
loop = true,
volume = 1,
minDistance = 2,
maxDistance = 6,
}
Has your original problem been sorted out, Paul?
Re: Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 1:34 pm
by Grimfan
Welcome to the gang Paul, and listen to these guys. They are damn good!

Re: Noob basic scripting issue, playing sound "error"
Posted: Wed Apr 03, 2013 8:59 pm
by JohnWordsworth
Hey SpiderFighter - I totally left playSoundAt out of my tutorial. Thanks for the heads up, I have added that section to my tutorial, along with an explanation of the minDistance and maxDistance parameters.
Re: Noob basic scripting issue, playing sound "error"
Posted: Thu Apr 04, 2013 2:07 pm
by Neikun
To help with any debugging, I'd like to mention that for any new sound file you define (even so much as switching the file in the filename: line) you will need to close and reopen Legend of Grimrock to be able to hear it in the editor.
Re: Noob basic scripting issue, playing sound "error"
Posted: Thu Apr 04, 2013 3:39 pm
by SpiderFighter
JohnWordsworth wrote:Hey SpiderFighter - I totally left playSoundAt out of my tutorial. Thanks for the heads up, I have added that section to my tutorial, along with an explanation of the minDistance and maxDistance parameters.
No worries, JW; I figured it wasn't in the scope of your tutorial.
@Neikun: Good point!
Re: Noob basic scripting issue, playing sound "error"
Posted: Sat Apr 06, 2013 9:49 pm
by Paul
Thank you all for your responses, you have a great crew here! It was my ignorance of the sound list and the proper call function being that listed on the left side of the predefined sounds list was the issue. I've since moved on, spending an inordinate amount of time learning the basics of the editor, scripting, importing assets, etc. Not sure how you guys do it, but you have created some fantastic work here. I find myself a bit overwhelmed keeping everything straight in my head. At the moment I'm working on customs sounds, found a decent editor to help create proper atmosphere. Toyed with lighting a bit, but put that aside for the time being, too much too soon!
Thanks again, I'm sure you will see more questions from me from time to time...
-Paul