Frictional Games Forum (read-only)
[SCRIPT] expected ")" or "," help please - 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] expected ")" or "," help please (/thread-14845.html)

Pages: 1 2 3


expected ")" or "," help please - Chunckycat12 - 04-16-2012

hi everyone i only started to mod about 3 days ago so bear with me Smile but basically my problem is that whenever i load my amnesia custom map a message appears saying 19,57 expected ")" or "," i have beem trying to do it for hours Angry if anyone sees anything let me know Big Grin


void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScriptArea1", true, 1);
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
}
void UsedKeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}

void CollideScriptArea1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
}

void StartMusic(string &in asParent, string &in asChild int alState)-this is 19,57 btw
{
PlayMusic("01_amb_darkness.ogg", true, 0.8, 2, 1, true);
}


RE: expected ")" or "," help please - MrIcabod123 - 04-16-2012

Try this:


void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScriptArea1", true, 1);
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
}
void UsedKeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}

void CollideScriptArea1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_1", true, true);
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("01_amb_darkness.ogg", true, 0.8, 2, 1, true);
}

You forgot the "," after &in asChild


RE: expected ")" or "," help please - Chunckycat12 - 04-16-2012

Thankyuuuuuuuuuuuu so much its funny how how one little commar can cause so much of a pain in my life
i feel kinda stupid


RE: expected ")" or "," help please - MrIcabod123 - 04-16-2012

(04-16-2012, 08:43 PM)Chunckycat12 Wrote: Thankyuuuuuuuuuuuu so much its funny how how one little commar can cause so much of a pain in my life
i feel kinda stupid
Glad to help Big Grin


RE: expected ")" or "," help please - JenniferOrange - 04-16-2012

HOLD UP. The callback syntax for AddUseItemCallback is supposed to be (string &in asItem, string &in asEntity). You have (string &in item, string &in door), how is it possible it still works?!
-rage face-


RE: expected ")" or "," help please - Chunckycat12 - 04-16-2012

to be honest im not entirely sure i just just followed a youtube tutorial lol


RE: expected ")" or "," help please - MrIcabod123 - 04-16-2012

He must have followed the tutorial from the wiki.

void OnStart()
{
AddUseItemCallback("", "ITEM", "DOOR", "FUNCTION", true);
}

void FUNCTION(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);
}




RE: expected ")" or "," help please - JenniferOrange - 04-16-2012

(04-16-2012, 09:47 PM)MrIcabod123 Wrote: He must have followed the tutorial from the wiki.

void OnStart()
{
AddUseItemCallback("", "ITEM", "DOOR", "FUNCTION", true);
}

void FUNCTION(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);
}
I didn't know it still worked if you did that. I get everything from the Engine Scripts page.





RE: expected ")" or "," help please - Cranky Old Man - 04-16-2012

(04-16-2012, 09:42 PM)JenniferOrange Wrote: HOLD UP. The callback syntax for AddUseItemCallback is supposed to be (string &in asItem, string &in asEntity). You have (string &in item, string &in door), how is it possible it still works?!

-img-

You need to learn scripting, Jennifer. Undecided




RE: expected ")" or "," help please - JetlinerX - 04-16-2012

(04-16-2012, 09:58 PM)Cranky Old Man Wrote: You need to learn scripting, Jennifer. Undecided
No, she was the one who started me on scripting. She knows a lot. Also, dont quote pictures, kinda makes the thread too long.