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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with a basic script...
Lambda Offline
Junior Member

Posts: 39
Threads: 5
Joined: Mar 2011
Reputation: 0
#1
Need help with a basic script...

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:
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

Khaaaan!
(This post was last modified: 05-03-2011, 05:36 PM by Lambda.)
05-03-2011, 05:35 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#2
RE: Need help with a basic script...

(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:
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;
void OnStart()
{
PlayMusic( "07_amb", false, 5.0, 0.0f, 0);
}
(This post was last modified: 05-03-2011, 05:46 PM by Roenlond.)
05-03-2011, 05:44 PM
Find
Lambda Offline
Junior Member

Posts: 39
Threads: 5
Joined: Mar 2011
Reputation: 0
#3
RE: Need help with a basic script...

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.

Khaaaan!
(This post was last modified: 05-03-2011, 06:01 PM by Lambda.)
05-03-2011, 05:49 PM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#4
RE: Need help with a basic script...

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.

Creator of The Dark Treasure.
(This post was last modified: 05-03-2011, 06:08 PM by Linus Ågren.)
05-03-2011, 06:07 PM
Website Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#5
RE: Need help with a basic script...

(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.
05-03-2011, 06:12 PM
Find
Lambda Offline
Junior Member

Posts: 39
Threads: 5
Joined: Mar 2011
Reputation: 0
#6
RE: Need help with a basic script...

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!

Khaaaan!
(This post was last modified: 05-03-2011, 06:18 PM by Lambda.)
05-03-2011, 06:15 PM
Find




Users browsing this thread: 1 Guest(s)