Noob basic scripting issue, playing sound "error"
Noob basic scripting issue, playing sound "error"
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
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"
just use the sound name on the left side of the list, not the file name
Finished Dungeons - complete mods to play
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: Noob basic scripting issue, playing sound "error"
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!
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!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: Noob basic scripting issue, playing sound "error"
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
Custom Sound Tutorial: 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.
- SpiderFighter
- Posts: 789
- Joined: Thu Apr 12, 2012 4:15 pm
Re: Noob basic scripting issue, playing sound "error"
Welcome to the forums, Paul!
Has your original problem been sorted out, Paul?
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: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
Code: Select all
defineSound{
name = "yourCustomSound", --this can also be "yourCustomSound.wav"
filename = "yourCustomSound.wav",
loop = true,
volume = 1,
minDistance = 2,
maxDistance = 6,
}Re: Noob basic scripting issue, playing sound "error"
Welcome to the gang Paul, and listen to these guys. They are damn good! 
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: Noob basic scripting issue, playing sound "error"
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.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: Noob basic scripting issue, playing sound "error"
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.
"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
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!
- SpiderFighter
- Posts: 789
- Joined: Thu Apr 12, 2012 4:15 pm
Re: Noob basic scripting issue, playing sound "error"
No worries, JW; I figured it wasn't in the scope of your tutorial.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.
@Neikun: Good point!
Re: Noob basic scripting issue, playing sound "error"
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
Thanks again, I'm sure you will see more questions from me from time to time...
-Paul
