Frictional Games Forum (read-only)

Full Version: NEED HELP WITH SCRIPT
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I need some help with my script. I get a fatal error message, and it says "main (38,19) : ERR : Expected ')' or ','"
and it looks the same only with some other numbers under it.
here's the whole script:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key 1", "door", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_tower_1", "door2", "UsedKeyOnDoor1", true);
SetEntityCallbackFunc("key_tower_1", "OnPickup");
AddEntityCollideCallback("Player", "sec", "sec", true, 1);
AddEntityCollideCallback("Player", "scary", "scary", true, 1);
AddEntityCollideCallback("table", "tablescript", "tablescript", true, 1);
AddEntityCollideCallback("enemy_suitor_1", "run", "run", true, 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door", 0.0f, false);
RemoveItem("key 1");
}
void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door2", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0.0f, false);
RemoveItem("key_tower_1");
}

void OnPickup(string &in asItem, string &in asEntity)
{
SetEntityActive("character_dog_1",true);
}
void sec(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 20,0f, "running");
AddQuest("quest1","quest1");
}
void scary(string &in asTimer)
{
PlayMusic("horror1.ogg", true, 1, 1, 1, true);
SetEntityActive("deformed_man_1", true;
SetEntityActive("candlestick_floor_red_1", true;
GiveSanityDamage(5.0f, true);
AddTimer("", 2,0f, "scare1");
}
void scare1(string &in asTimer)
{
SetEntityActive("deformed_man_2", true;
SetEntityActive("candlestick_floor_red_2", true;
SetEntityActive("deformed_man_1", false;
SetEntityActive("candlestick_floor_red_1", false;
GiveSanityDamage(5.0f, true);
AddTimer("", 2,0f, "scare2");
}
void scare2(string &in asTimer)
{
SetEntityActive("deformed_man_3", true;
SetEntityActive("candlestick_floor_red_3", true;
SetEntityActive("deformed_man_2", false;
SetEntityActive("candlestick_floor_red_2", false;
GiveSanityDamage(5.0f, true);
AddTimer("", 3,0f, "scare3");
}
void scare3(string &in asTimer)
{
SetEntityActive("deformed_man_3", false;
SetEntityActive("candlestick_floor_red_3", false;
GiveSanityDamage(5.0f, true);
SetEntityActive("servant_grunt_1", true;
ShowEnemyPlayerPosition("servant_grunt_1");
}

void tablescript(string &in asTimer)
{
SetEntityActive("run", true;
}
void run(string &in asTimer)
{
SetEntityActive("enemy_suitor_1", false;
}
void running(string &in asTimer)
{
SetEntityActive("enemy_suitor_1", true;
ShowEnemyPlayerPosition("enemy_suitor_1");
GiveSanityDamage(5.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
What to do?! D:
(02-25-2012, 01:30 PM)stinset2 Wrote: [ -> ]I need some help with my script. I get a fatal error message, and it says "main (38,19) : ERR : Expected ')' or ','"
and it looks the same only with some other numbers under it.
here's the whole script:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key 1", "door", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_tower_1", "door2", "UsedKeyOnDoor1", true);
SetEntityCallbackFunc("key_tower_1", "OnPickup");
AddEntityCollideCallback("Player", "sec", "sec", true, 1);
AddEntityCollideCallback("Player", "scary", "scary", true, 1);
AddEntityCollideCallback("table", "tablescript", "tablescript", true, 1);
AddEntityCollideCallback("enemy_suitor_1", "run", "run", true, 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door", 0.0f, false);
RemoveItem("key 1");
}
void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door2", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0.0f, false);
RemoveItem("key_tower_1");
}

void OnPickup(string &in asItem, string &in asEntity)
{
SetEntityActive("character_dog_1",true);
}
void sec(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 20,0f, "running");
AddQuest("quest1","quest1");
}
void scary(string &in asTimer)
{
PlayMusic("horror1.ogg", true, 1, 1, 1, true);
SetEntityActive("deformed_man_1", true;
SetEntityActive("candlestick_floor_red_1", true;
GiveSanityDamage(5.0f, true);
AddTimer("", 2,0f, "scare1");
}
void scare1(string &in asTimer)
{
SetEntityActive("deformed_man_2", true;
SetEntityActive("candlestick_floor_red_2", true;
SetEntityActive("deformed_man_1", false;
SetEntityActive("candlestick_floor_red_1", false;
GiveSanityDamage(5.0f, true);
AddTimer("", 2,0f, "scare2");
}
void scare2(string &in asTimer)
{
SetEntityActive("deformed_man_3", true;

SetEntityActive("candlestick_floor_red_3", true;
SetEntityActive("deformed_man_2", false;
SetEntityActive("candlestick_floor_red_2", false;
GiveSanityDamage(5.0f, true);
AddTimer("", 3,0f, "scare3");
}
void scare3(string &in asTimer)
{
SetEntityActive("deformed_man_3", false;
SetEntityActive("candlestick_floor_red_3", false;
GiveSanityDamage(5.0f, true);
SetEntityActive("servant_grunt_1", true;
ShowEnemyPlayerPosition("servant_grunt_1");
}

void tablescript(string &in asTimer)
{
SetEntityActive("run", true;
}
void run(string &in asTimer)
{
SetEntityActive("enemy_suitor_1", false;
}
void running(string &in asTimer)
{
SetEntityActive("enemy_suitor_1", true;
ShowEnemyPlayerPosition("enemy_suitor_1");
GiveSanityDamage(5.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
What to do?! D:
found your problem, you forgot the ) on your SetEntityActive("deformed_man_1", true);

(02-25-2012, 01:34 PM)SilentStriker Wrote: [ -> ]
(02-25-2012, 01:30 PM)stinset2 Wrote: [ -> ]
found your problem, you forgot the ) on your SetEntityActive("deformed_man_1", true);
I changed it so it looks like this:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key 1", "door", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_tower_1", "door2", "UsedKeyOnDoor1", true);
SetEntityCallbackFunc("key_tower_1", "OnPickup");
AddEntityCollideCallback("Player", "sec", "sec", true, 1);
AddEntityCollideCallback("Player", "scary", "scary", true, 1);
AddEntityCollideCallback("table", "tablescript", "tablescript", true, 1);
AddEntityCollideCallback("enemy_suitor_1", "run", "run", true, 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door", 0.0f, false);
RemoveItem("key 1");
}
void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door2", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0.0f, false);
RemoveItem("key_tower_1");
}

void OnPickup(string &in asItem, string &in asEntity)
{
SetEntityActive("character_dog_1",true);
}
void sec(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 20,0f, "running");
AddQuest("quest1","quest1");
}
void scary(string &in asTimer)
{
PlayMusic("horror1.ogg", true, 1, 1, 1, true);
SetEntityActive("deformed_man_1", true);
SetEntityActive("candlestick_floor_red_1", true);
GiveSanityDamage(5.0f, true);
AddTimer("", 2,0f, "scare1");
}
void scare1(string &in asTimer)
{
SetEntityActive("deformed_man_2", true);
SetEntityActive("candlestick_floor_red_2", true);
SetEntityActive("deformed_man_1", false);
SetEntityActive("candlestick_floor_red_1", false);
GiveSanityDamage(5.0f, true);
AddTimer("", 2,0f, "scare2");
}
void scare2(string &in asTimer)
{
SetEntityActive("deformed_man_3", true);
SetEntityActive("candlestick_floor_red_3", true);
SetEntityActive("deformed_man_2", false);
SetEntityActive("candlestick_floor_red_2", false);
GiveSanityDamage(5.0f, true);
AddTimer("", 3,0f, "scare3");
}
void scare3(string &in asTimer)
{
SetEntityActive("deformed_man_3", false);
SetEntityActive("candlestick_floor_red_3", false);
GiveSanityDamage(5.0f, true);
SetEntityActive("servant_grunt_1", true);
ShowEnemyPlayerPosition("servant_grunt_1");
}

void tablescript(string &in asTimer)
{
SetEntityActive("run", true);
}
void run(string &in asTimer)
{
SetEntityActive("enemy_suitor_1", false);
}
void running(string &in asTimer)
{
SetEntityActive("enemy_suitor_1", true);
ShowEnemyPlayerPosition("enemy_suitor_1");
GiveSanityDamage(5.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
A lot of the errors dissapered, but there are couple left which says the same as before. I can't see what I need to change Confused


Could you post all the errors?
(02-25-2012, 03:04 PM)SilentStriker Wrote: [ -> ]Could you post all the errors?

yes
FATAL ERROR: Could not load script file 'custom_stories/Division 3/maps/2.hps'!
main (38,26 : ERR : Expected ')' or ','
main (48,16 : ERR : Expected ')' or ','
main (58,16 : ERR : Expected ')' or ','
main (68,16 : ERR : Expected ')' or ','

Hmm strange... can't find any problem...

I guess just check so everything is named right
He used commas instead of periods for float values.
oh yea on the timers
well, I changed the commas to periods, and I was able to start up the map. but the timers didn't work at all Confused
Post script again please.
Pages: 1 2