Script error (Again) - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: SOMA (https://www.frictionalgames.com/forum/forum-55.html) +--- Forum: User created content (https://www.frictionalgames.com/forum/forum-79.html) +---- Forum: Technical Support (https://www.frictionalgames.com/forum/forum-80.html) +---- Thread: Script error (Again) (/thread-50843.html) |
Script error (Again) - Venom Fox - 07-08-2016 Due to my technical issues I've been unable to script for the last couple of months, and plus my ignorance about scripting I've met an issue. My mod crashes when I launch it, and it has something to do with this: void Setup() { Player_SetClothing("dressed"); } Anyone who could maybe help me a little? :9 Nevermind, added a #include "helpers/helper_player.hps" in to the script file and now it works. RE: Script error (Again) - Romulator - 07-08-2016 Glad you got the issue solved. I'll keep the thread open in case you have any more scripting issues, since it's better to keep them all in one area if possible to prevent clutter. RE: Script error (Again) - Venom Fox - 07-08-2016 (07-08-2016, 01:36 PM)Romulator Wrote: Glad you got the issue solved. I'll keep the thread open in case you have any more scripting issues, since it's better to keep them all in one area if possible to prevent clutter. Right, thank you About playing music... In my map, there is a triggerarea that is supposed to call a function when the player collides with it. The function is this; bool Trigger_playmusic(const tString &in asParent, const tString &in asChild, int alState) { if (alState != 1) return true; Music_Play("docks.ogg", 1, true, 2); return true; } But it doesn't work, the HPL log tells that could not find method bool Trigger_playmusic... Any ideas about that? RE: Script error (Again) - Hypercube - 07-08-2016 First of all, you don't include the .ogg at the end, I mean, does it matter? I am able to type the file name without it, I am pretty sure it just reads the name. Second of all, the second parameter is a floating point type variable if I am correct, so you can't just leave it as 1 and that's it, you'd have to write it out as 1.0f. Lastly, the fourth parameter is the priority for the music and not just a value, so you cannot write it as a number. An example of what you would put there is eMusicPrio_BgAmb. And as for the error you got, did you type something different for the function in the script file then what you put in the trigger area? Because if it says something different then it won't be able to find method bool Trigger_playmusic(), at least that's what happened to me before. Also be sure to check other people's work to get an idea of how to write out the code, such as a short mod with not the much to its script file you could find the section where it plays music easily and just copy the looks of the code. Here's mine - Music_Play("Immuration", 1.0f, true, eMusicPrio_BgAmb); RE: Script error (Again) - Venom Fox - 07-08-2016 (07-08-2016, 04:28 PM)Hypercube Wrote: First of all, you don't include the .ogg at the end, I mean, does it matter? I am able to type the file name without it, I am pretty sure it just reads the name. Second of all, the second parameter is a floating point type variable if I am correct, so you can't just leave it as 1 and that's it, you'd have to write it out as 1.0f. Lastly, the fourth parameter is the priority for the music and not just a value, so you cannot write it as a number. An example of what you would put there is eMusicPrio_BgAmb. Right so I gave up on the idea that the music is triggered by an area, instead I put it in the void OnEnter like this; void OnEnter() { Music_Play("01_docks", 1.0f, true, eMusicPrio_BgAmb); } But it still won't play, the HPL log says nothing. I even removed the ambient sounds from the map, but that didn't accomplish anything. RE: Script error (Again) - Hypercube - 07-08-2016 So it doesn't seem to be an error with the code, because it works fine for me, and your hpl log says nothing. Did you get the name of the song incorrect? Because that would be an obvious reason. If you haven't already, try testing it in dev mode. Using that quickly shows any important debug messages, such as why this isn't working. Otherwise there might be something interfering with it which I would have no idea of, or the music file just doesn't work. RE: Script error (Again) - Abion47 - 07-08-2016 (07-08-2016, 04:28 PM)Hypercube Wrote: First of all, you don't include the .ogg at the end, I mean, does it matter? I am able to type the file name without it, I am pretty sure it just reads the name. Second of all, the second parameter is a floating point type variable if I am correct, so you can't just leave it as 1 and that's it, you'd have to write it out as 1.0f. Lastly, the fourth parameter is the priority for the music and not just a value, so you cannot write it as a number. An example of what you would put there is eMusicPrio_BgAmb. You don't need to add the file extension, but it's still a good thing to do for organizational purposes. ("music" isn't very descriptive, but "music.ogg" says exactly what the file is). Also, the parameter is a float, but the compiler is smart enough that if you five it an int it will convert it to a float automatically. Your point about the eMusicPrio is correct, though if Venom Fox wants the music to have a priority of 2, then the equivalent enum value is eMusicPrio_MinorEvent. (Of course, eMusicPrio_MinorEvent is meant for just that... minor events. That priority level shouldn't be used on just background music. I'd recommend using eMusicPrio_SceneAmb, since it sounds like you are trying to play this music in a certain area of your map.) (07-08-2016, 04:42 PM)Venom Fox Wrote:(07-08-2016, 04:28 PM)Hypercube Wrote: First of all, you don't include the .ogg at the end, I mean, does it matter? I am able to type the file name without it, I am pretty sure it just reads the name. Second of all, the second parameter is a floating point type variable if I am correct, so you can't just leave it as 1 and that's it, you'd have to write it out as 1.0f. Lastly, the fourth parameter is the priority for the music and not just a value, so you cannot write it as a number. An example of what you would put there is eMusicPrio_BgAmb. The code is fine, but it's weird that the music isn't playing and there are no error messages popping up. Is your music volume turned down in the game settings? RE: Script error (Again) - Venom Fox - 07-08-2016 (07-08-2016, 04:59 PM)Hypercube Wrote: So it doesn't seem to be an error with the code, because it works fine for me, and your hpl log says nothing. Did you get the name of the song incorrect? Because that would be an obvious reason. If you haven't already, try testing it in dev mode. Using that quickly shows any important debug messages, such as why this isn't working. Otherwise there might be something interfering with it which I would have no idea of, or the music file just doesn't work. There are a few errors that show up, at the moment. But I don't think they have that much part in why the music doesn't play. There are errors such as, skipping map specific voice file, not found + failed to stream map + could not open binary file and no resources element found in my english lang file. I'm pretty sure that there isn't anything wrong with the voice file, it's .ogg, it works.. etc. And I haven't gotten the name of the song incorrect :S RE: Script error (Again) - Hypercube - 07-08-2016 (07-08-2016, 05:20 PM)Abion47 Wrote: You don't need to add the file extension, but it's still a good thing to do for organizational purposes. ("music" isn't very descriptive, but "music.ogg" says exactly what the file is). Also, the parameter is a float, but the compiler is smart enough that if you five it an int it will convert it to a float automatically. Your point about the eMusicPrio is correct, though if Venom Fox wants the music to have a priority of 2, then the equivalent enum value is eMusicPrio_MinorEvent. (Of course, eMusicPrio_MinorEvent is meant for just that... minor events. That priority level shouldn't be used on just background music. I'd recommend using eMusicPrio_SceneAmb, since it sounds like you are trying to play this music in a certain area of your map.) I wasn't saying that Venom should use eMusicPrio_BgAmb but it was an example because that's what I had used for the moment. Interesting though, I didn't realize the compiler automatically converted it into a float. I thought I remember it just not working, is it okay to leave it at one or should you include the decimal point? I remember encountering issues with this before RE: Script error (Again) - Venom Fox - 07-08-2016 To be sure that the audio file wasn't.. um.. broken, I used an audio track from Soma's soundtrack. It didn't work either. Also I want to make sure I'm doing it right. I have a folder called music in my folder, which contains the song, and I've added this to the resources.cfg; <Directory Path="/music" AddSubDirs="true"/> So no errors in that regard? |