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
Script Help Error with scripts
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#1
Error with scripts

Hi. I've got an error with a script:
main (10,1) Unexpected token '{'
main (15,16) Expected identifier
main (16,1) Unexpected token '}'

My .hps file:

void OnStart()
{
SetSanityDrainDisabled(true);

GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i< 25;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

{
AddEntityCollideCallback("Player", "12_girl_scream", "GirlScream", true, 1);
AddEntityCollideCallback("Player", "message1", "Message1", true, 1);
AddEntityCollideCallback("Player", "message2", "Message2", true, 1);
}
PlaySoundAtArea("12_girl_scream", "12_girl_scream.snt", "GirlScream01", 0, false);
}
void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Wiadomosc1", 10);
}

void Message2(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Wiadomosc2", 10);
}

void OnEnter()
{
PlayMusic("07_amb", true, 1.0f, 4.0f, 1, true);

}
What i've must do?
01-15-2015, 01:53 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: Error with scripts

Do like this;

PHP Code: (Select All)
void OnStart()
 { 
 
SetSanityDrainDisabled(true);

 
GiveItemFromFile("lantern""lantern.ent");

 for(
int i=0;i25;i++) GiveItemFromFile("tinderbox_"+i"tinderbox.ent");

 
AddEntityCollideCallback("Player""12_girl_scream""GirlScream"true1);
 
AddEntityCollideCallback("Player""message1""Message1"true1);
 
AddEntityCollideCallback("Player""message2""Message2"true1);


 }

void GirlScream(string &in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("12_girl_scream""12_girl_scream.snt""GirlScream01"1.0ftrue);
}


 
void Message1(string &in asChildstring &in asParentint alState)
 {
 
SetMessage("Messages""Wiadomosc1"10); 
 }

 
void Message2(string &in asChildstring &in asParentint alState)
 {
 
SetMessage("Messages""Wiadomosc2"10); 
 }

 
void OnEnter()
 {
 
PlayMusic("07_amb"true1.0f4.0f1true);

 } 

Quote:That should do the trick, IF you intended to do it like i do now though.
IF not, we are here to help you out.
---
Here are some things you miswrote;
You were having some {}
Where they should NOT be there.
And:
{// Wrong
AddEntityCollideCallback("Player", "12_girl_scream", "GirlScream", true, 1); //put this in OnSTART
AddEntityCollideCallback("Player", "message1", "Message1", true, 1); //put this in OnSTART
AddEntityCollideCallback("Player", "message2", "Message2", true, 1); //put this in OnSTART
}//Wrong
PlaySoundAtArea("12_girl_scream", "12_girl_scream.snt", "GirlScream01", 0, false); <<<- Use PlaySoundAtEntity in stead.
}
IF you are making a function\script, try with void
(This post was last modified: 01-15-2015, 02:29 PM by DnALANGE.)
01-15-2015, 02:18 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
RE: Error with scripts

From Julius Caesar's bot, log compiled.

Spoiler below!

ERRORS FOUND: 2
MISTAKES: NO CALLBACK FUNCTION
INCORRECT SYNTAX
FIXING: CORRECT FUNCTION PLACEMENT
CORRECTING SYNTAX

RUN: GENERATE CORRECTION

GENERATING CORRECTION....
WORKING...

PHP Code: (Select All)
void OnStart()
{
SetSanityDrainDisabled(true);
GiveItemFromFile("lantern""lantern.ent");
for(
int i=0;i25;i++) GiveItemFromFile("tinderbox_"+i"tinderbox.ent");
AddEntityCollideCallback("Player""12_girl_scream""GirlScream"true1);
AddEntityCollideCallback("Player""message1""Message1"true1);
AddEntityCollideCallback("Player""message2""Message2"true1);
}

void GirlScream(string &in asParentstring &in asChildint alState)
{
PlaySoundAtEntity("12_girl_scream""12_girl_scream.snt""GirlScream01"0false);
}

void Message1(string &in asChildstring &in asParentint alState)
{
SetMessage("Messages""Wiadomosc1"10);
}

void Message2(string &in asChildstring &in asParentint alState)
{
SetMessage("Messages""Wiadomosc2"10);
}

void OnEnter()
{
PlayMusic("07_amb"true1.0f4.0f1true);


SUCCESSFUL. CORRECTION GENERATED.

---END---


"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 01-16-2015, 02:58 PM by PutraenusAlivius.)
01-16-2015, 02:58 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#4
RE: Error with scripts

??? what went wrong with my script?
didnt check mine tho.
just pointed out things what could have been wrong..
01-16-2015, 03:06 PM
Find




Users browsing this thread: 1 Guest(s)