Frictional Games Forum (read-only)
[SCRIPT] NEED HELP WITH 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] NEED HELP WITH SCRIPT (/thread-13572.html)

Pages: 1 2


NEED HELP WITH SCRIPT - stinset2 - 02-25-2012

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:



RE: NEED HELP WITH SCRIPT - SilentStriker - 02-25-2012

(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);




RE: NEED HELP WITH SCRIPT - stinset2 - 02-25-2012

(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





RE: NEED HELP WITH SCRIPT - SilentStriker - 02-25-2012

Could you post all the errors?



RE: NEED HELP WITH SCRIPT - stinset2 - 02-25-2012

(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 ','




RE: NEED HELP WITH SCRIPT - SilentStriker - 02-25-2012

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

I guess just check so everything is named right



RE: NEED HELP WITH SCRIPT - Your Computer - 02-25-2012

He used commas instead of periods for float values.


RE: NEED HELP WITH SCRIPT - SilentStriker - 02-25-2012

oh yea on the timers



RE: NEED HELP WITH SCRIPT - stinset2 - 02-25-2012

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


RE: NEED HELP WITH SCRIPT - flamez3 - 02-26-2012

Post script again please.