Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help needed! I can't find error in script.
Author Message
Tozken Offline
Junior Member

Posts: 3
Joined: Feb 2012
Reputation: 0
Post: #1
Help needed! I can't find error in script.
Okay, so I'm kinda new to this so bear with me Tongue
I've encountered a problem that makes me unable to enter the map, but I can't seem to find the problem in the script. It says that a ';' is expected in row 29.

Here's my script:

void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
}
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, false);
if(GetEntitiesCollide("Player", "ScriptArea_2"))
{
AddTimer("", 2, "AOESanityDmg");
}
}

What I want AOESanityDmg to do is if the player is located inside ScriptArea_2 he should be damaged with 5 sanity dmg every 2 seconds... I don't think that it is working but it seems like there's something else that is wrong with the script, because I removed some script before so that I didn't have 29 rows of script, but the error still remained... Anyone know how to fix it? Smile

Thx in advance
Sry for English
(This post was last modified: 02-26-2012 06:28 PM by Tozken.)
02-26-2012 02:20 PM
Find all posts by this user Quote this message in a reply
Tozken Offline
Junior Member

Posts: 3
Joined: Feb 2012
Reputation: 0
Post: #2
RE: Help needed! I can't find error in script.
Bump! Really need help with this. I can't continue until I solve it :/
02-26-2012 06:31 PM
Find all posts by this user Quote this message in a reply
Alento Offline
Member

Posts: 64
Joined: Jan 2012
Reputation: 0
Post: #3
RE: Help needed! I can't find error in script.
(02-26-2012 02:20 PM)Tozken Wrote:  Okay, so I'm kinda new to this so bear with me Tongue
I've encountered a problem that makes me unable to enter the map, but I can't seem to find the problem in the script. It says that a ';' is expected in row 29.

Here's my script:

void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
}
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, false);
if(GetEntitiesCollide("Player", "ScriptArea_2"))
{
AddTimer("", 2, "AOESanityDmg");
}
}

What I want AOESanityDmg to do is if the player is located inside ScriptArea_2 he should be damaged with 5 sanity dmg every 2 seconds... I don't think that it is working but it seems like there's something else that is wrong with the script, because I removed some script before so that I didn't have 29 rows of script, but the error still remained... Anyone know how to fix it? Smile

Thx in advance
Sry for English
Hey man!

I'm also new at this, but I know you shouldn't have more that TWO '}' in void OnStart.

Like this

void OnStart()

{
AddEntityCollideCallback....
.......
}

Hope that helps you some? Smile
(02-26-2012 06:31 PM)Tozken Wrote:  Bump! Really need help with this. I can't continue until I solve it :/
Okey, so.. I tested it out and with this following script, everything should do it! Smile


void OnStart()
{
if(ScriptDebugOn())
GiveItemFromFile("lantern", "lantern.ent");
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, true);

}

---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
(This post was last modified: 02-26-2012 07:01 PM by Alento.)
02-26-2012 06:50 PM
Find all posts by this user Quote this message in a reply
Tozken Offline
Junior Member

Posts: 3
Joined: Feb 2012
Reputation: 0
Post: #4
RE: Help needed! I can't find error in script.
Thanks for your help! Unfortunately, it didn't work. It was something with the .map file I think.... I tried creating a new map with the same things and same script and it worked. Thanks again anyway!
(This post was last modified: 02-26-2012 07:50 PM by Tozken.)
02-26-2012 07:50 PM
Find all posts by this user Quote this message in a reply
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #5
RE: Help needed! I can't find error in script.
(02-26-2012 02:20 PM)Tozken Wrote:  Okay, so I'm kinda new to this so bear with me Tongue
I've encountered a problem that makes me unable to enter the map, but I can't seem to find the problem in the script. It says that a ';' is expected in row 29.

Here's my script:

void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
}
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, false);
if(GetEntitiesCollide("Player", "ScriptArea_2"))
{
AddTimer("", 2, "AOESanityDmg");
}
}

What I want AOESanityDmg to do is if the player is located inside ScriptArea_2 he should be damaged with 5 sanity dmg every 2 seconds... I don't think that it is working but it seems like there's something else that is wrong with the script, because I removed some script before so that I didn't have 29 rows of script, but the error still remained... Anyone know how to fix it? Smile

Thx in advance
Sry for English
Dude you have this "
AddTimer("", 2, "AOESanityDmg");
}
}"

You should have


{

}

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
02-28-2012 12:45 AM
Visit this user's website Find all posts by this user Quote this message in a reply
flamez3 Offline
Posting Freak

Posts: 1,319
Joined: Apr 2011
Reputation: 57
Post: #6
RE: Help needed! I can't find error in script.
He is using a If statement, he needs the other } there.

02-28-2012 10:36 AM
Find all posts by this user Quote this message in a reply
Alento Offline
Member

Posts: 64
Joined: Jan 2012
Reputation: 0
Post: #7
RE: Help needed! I can't find error in script.
(02-28-2012 10:36 AM)flamez3 Wrote:  He is using a If statement, he needs the other } there.
(Y) yepp

---------Want help with YOUR Custom Story? ---------
http://www.frictionalgames.com/forum/user-19049.html
02-28-2012 10:40 AM
Find all posts by this user Quote this message in a reply
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #8
RE: Help needed! I can't find error in script.
(02-26-2012 02:20 PM)Tozken Wrote:  Okay, so I'm kinda new to this so bear with me Tongue
I've encountered a problem that makes me unable to enter the map, but I can't seem to find the problem in the script. It says that a ';' is expected in row 29.

Here's my script:

void OnStart()
{
if(ScriptDebugOn())
}
GiveItemFromFile("lantern", "lantern.ent");
{
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, false);
if(GetEntitiesCollide("Player", "ScriptArea_2"))
{
AddTimer("", 2, "AOESanityDmg");
}


What I want AOESanityDmg to do is if the player is located inside ScriptArea_2 he should be damaged with 5 sanity dmg every 2 seconds... I don't think that it is working but it seems like there's something else that is wrong with the script, because I removed some script before so that I didn't have 29 rows of script, but the error still remained... Anyone know how to fix it? Smile

Thx in advance
Sry for English
this might work.
void OnStart()
{
if(ScriptDebugOn())
}
GiveItemFromFile("lantern", "lantern.ent");
{
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, false);
if(GetEntitiesCollide("Player", "ScriptArea_2"))
}
AddTimer("", 2, "AOESanityDmg");
{

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 02-28-2012 12:48 PM by jessehmusic.)
02-28-2012 12:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Asphex Offline
Junior Member

Posts: 26
Joined: Feb 2012
Reputation: 2
Post: #9
RE: Help needed! I can't find error in script.
I think that the timer at the end of the script is ignored, because a new "part" isn't started like so:

Spoiler below!
void OnStart()
{
if(ScriptDebugOn())
}
GiveItemFromFile("lantern", "lantern.ent");
{
PlaySoundAtEntity("RockRumble", "general_rock_rumble.snt", "Player", 0, false);
StartScreenShake(0.05f, 1, 0.4, 0.6);
AddTimer("", 1, "StopRockRumble");
SetPlayerCrouching(true);
AddEntityCollideCallback("Player", "ScriptArea_1", "Message1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "AOESanityDmg", false, 1);
}

void StopRockRumble(string &in asTimer)
{
StopSound("RockRumble", 1);
}

void Message1(string &in asParent, string &in asChild, int alState)
{
SetMessage("Messages", "Popup3", 0);
}

void AOESanityDmg(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(5, false);
if(GetEntitiesCollide("Player", "ScriptArea_2"))
}
{
AddTimer("", 2, "AOESanityDmg");
}

I'm new to scripting, but wanted to add my 2 cents. Maybe I'll learn something from this thread Smile

My stories: The Haunted Stairwell v1.0
02-28-2012 01:59 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)