Frictional Games Forum (read-only)
(script) help me 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) help me please (/thread-13574.html)



(script) help me please - eddyed123 - 02-25-2012

i am very new to scripting and i cant see what i have done wrong. im trying to make a door slam behind me and the game keeps crashing. it says "unexpected token "{" ". If anyone can help i would be very grateful.

void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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

{
AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");
}

void StopLook(string &in asTimer)
{

void StopPlayerLookAt();
}


RE: (script) help me please - SilentStriker - 02-25-2012

(02-25-2012, 03:23 PM)eddyed123 Wrote: i am very new to scripting and i cant see what i have done wrong. im trying to make a door slam behind me and the game keeps crashing. it says "unexpected token "{" ". If anyone can help i would be very grateful.

void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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

{
AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");
}

void StopLook(string &in asTimer)
{

void StopPlayerLookAt();
}
It should look like this


void OnStart()
{

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

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

AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");

}

void StopLook(string &in asTimer)
{
void StopPlayerLookAt();
}






RE: (script) help me please - Obliviator27 - 02-25-2012

(02-25-2012, 03:39 PM)SilentStriker Wrote:
(02-25-2012, 03:23 PM)eddyed123 Wrote: i am very new to scripting and i cant see what i have done wrong. im trying to make a door slam behind me and the game keeps crashing. it says "unexpected token "{" ". If anyone can help i would be very grateful.

void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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

{
AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");
}

void StopLook(string &in asTimer)
{

void StopPlayerLookAt();
}
It should look like this


void OnStart()
{

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

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

AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");

}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}
Fix'd.




RE: (script) help me please - eddyed123 - 02-25-2012

it says now
"expected expression value"

------------------------------------

void OnStart()
{

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

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

AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");

}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}


RE: (script) help me please - Obliviator27 - 02-25-2012

void OnStart()
{

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

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

AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");

}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}


Use this.



RE: (script) help me please - eddyed123 - 02-25-2012

i don't know if I'm doing something wrong but here is all of my scripts

-----------------------------------------------------------------------------------------------------------


////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "closetkey_1", "closet", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("closet", false, true);
PlaySoundAtEntity("", "unlock_door", "closet", 0, false);
RemoveItem("closetkey_1");

}

void OnStart()
{

if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

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

AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
}

void CollideScriptArea(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
StartPlayerLookAt("Door_2", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");

}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
}


RE: (script) help me please - Obliviator27 - 02-25-2012

There are two commas in your AddEntityCollideCallback line.



RE: (script) help me please - Froggit - 02-25-2012

IDK about scripting that much :/


RE: (script) help me please - flamez3 - 02-26-2012

He means:

AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);


is supposed to be:

AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScriptArea", true, 1);