Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script error (Again)
Venom Fox Offline
Junior Member

Posts: 32
Threads: 9
Joined: Mar 2016
Reputation: 0
#1
Script error (Again)

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.
(This post was last modified: 07-08-2016, 11:52 AM by Venom Fox.)
07-08-2016, 11:48 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Script error (Again)

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. Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
07-08-2016, 01:36 PM
Find
Venom Fox Offline
Junior Member

Posts: 32
Threads: 9
Joined: Mar 2016
Reputation: 0
#3
RE: Script error (Again)

(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. Smile

Right, thank you Big Grin

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?
(This post was last modified: 07-08-2016, 02:43 PM by Venom Fox.)
07-08-2016, 02:40 PM
Find
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#4
RE: Script error (Again)

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);
(This post was last modified: 07-08-2016, 04:37 PM by Hypercube.)
07-08-2016, 04:28 PM
Find
Venom Fox Offline
Junior Member

Posts: 32
Threads: 9
Joined: Mar 2016
Reputation: 0
#5
RE: Script error (Again)

(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.

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);

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.
(This post was last modified: 07-08-2016, 04:43 PM by Venom Fox.)
07-08-2016, 04:42 PM
Find
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#6
RE: Script error (Again)

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.
07-08-2016, 04:59 PM
Find
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#7
RE: Script error (Again)

(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.

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);

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.

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?
(This post was last modified: 07-08-2016, 05:24 PM by Abion47.)
07-08-2016, 05:20 PM
Find
Venom Fox Offline
Junior Member

Posts: 32
Threads: 9
Joined: Mar 2016
Reputation: 0
#8
RE: Script error (Again)

(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
07-08-2016, 05:27 PM
Find
Hypercube Offline
Member

Posts: 124
Threads: 20
Joined: Sep 2015
Reputation: 1
#9
RE: Script error (Again)

(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
07-08-2016, 05:29 PM
Find
Venom Fox Offline
Junior Member

Posts: 32
Threads: 9
Joined: Mar 2016
Reputation: 0
#10
RE: Script error (Again)

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?
(This post was last modified: 07-08-2016, 05:36 PM by Venom Fox.)
07-08-2016, 05:33 PM
Find




Users browsing this thread: 3 Guest(s)