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();
}
(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();
}
(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.
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();
}
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.
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();
}
There are two commas in your AddEntityCollideCallback line.
IDK about scripting that much :/
He means:
AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
is supposed to be:
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScriptArea", true, 1);