Frictional Games Forum (read-only)
Need help with a basic script... - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Need help with a basic script... (/thread-7790.html)



Need help with a basic script... - Lambda - 05-03-2011

Hi!

I'm very new to scripting, so i tried a basic map, and i tried using music within, but that went wrong.
I have no real area's in the map for it yet, i just want the selected music track to play, wich doesnt work.

Current code:
Code:
void OnStart()
{  

{
    (PlayMusic("asMusicFile, "07_amb.ogg", abLoop, false, afVolume, "5", afFadeTime, "0", alPrio, "0","));
}

}

void OnEnter()
{

}

void OnLeave()
{

}

Error Message i get when i try to run:
FATAL ERROR: Could not load script file 'maps/main/tutorialmap.hps'!
main (7,31) : Err : Expected ')' or ','

Please, i have no programming/scripting experience at ALL before this, and this is my first attempt to add something to the basic script. So don't hate me if this is an obvious thing.
I've tried multiple things, but it all didn't work.

Thanks,
Lambda


RE: Need help with a basic script... - Roenlond - 05-03-2011

(05-03-2011, 05:35 PM)Lambda Wrote: Hi!

I'm very new to scripting, so i tried a basic map, and i tried using music within, but that went wrong.
I have no real area's in the map for it yet, i just want the selected music track to play, wich doesnt work.

Current code:
Code:
void OnStart()
{  

{
    (PlayMusic("asMusicFile, "07_amb.ogg", abLoop, false, afVolume, "5", afFadeTime, "0", alPrio, "0","));
}

}

void OnEnter()
{

}

void OnLeave()
{

}

Error Message i get when i try to run:
FATAL ERROR: Could not load script file 'maps/main/tutorialmap.hps'!
main (7,31) : Err : Expected ')' or ','

Please, i have no programming/scripting experience at ALL before this, and this is my first attempt to add something to the basic script. So don't hate me if this is an obvious thing.
I've tried multiple things, but it all didn't work.

Thanks,
Lambda

the asMusicFile, abLoop, etc, should not be there. You need to remove those and only leave your own text. Numbers do not need quotes unless it's a string. Since it's an ambience, you probably want it to loop. To do that, change the "false" to "true". The PlayMusic command also doesn't need ".ogg" to function. Good luck Smile

Like so;
Code:
void OnStart()
{
PlayMusic( "07_amb", false, 5.0, 0.0f, 0);
}



RE: Need help with a basic script... - Lambda - 05-03-2011

Thanks, that should help a lot! Smile
____EDIT_____

Hmmm, first i tried that, i failed, i tried the line of yours, failed again, tried removing the f after 0.0(Don't know if that was supposed to be there), but i keep getting the same error(Well, a new one):

FATAL ERROR: Could not load script file 'maps/main/tutorialmap.hps'!
main (4,0): ERR : No matching signatures to 'PlayMusic(String@&const bool, const double, const uint)'

The problem is, due a lack of experience, i don't have a clue what that means.


RE: Need help with a basic script... - Linus Ă…gren - 05-03-2011

PlayMusic("07_amb", false, 5.0f, 0.0f, 0, false);

Forgot the Bool Resume at the end. Also, if you use decimals, you need an f at the end.


RE: Need help with a basic script... - Roenlond - 05-03-2011

(05-03-2011, 06:07 PM)junkfood2121 Wrote: PlayMusic("07_amb", false, 5.0f, 0.0f, 0, false);

Forgot the Bool Resume at the end. Also, if you use decimals, you need an f at the end.

oh my bad, I didn't even consider that there could be missing a whole bool :/ That should fix it, however.


RE: Need help with a basic script... - Lambda - 05-03-2011

Thanks, i hope this works!
And, also thanks for the hint of the f behind decimals, i didn't know 'bout that Smile
__Edit__
Yes, it works!
Thanks a lot guys!