eddyed123
Junior Member
Posts: 4
Threads: 2
Joined: Feb 2012
Reputation:
0
|
(script) help me please
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 |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
RE: (script) help me please
(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();
}
(This post was last modified: 02-25-2012, 03:39 PM by SilentStriker.)
|
|
02-25-2012, 03:39 PM |
|
Obliviator27
Posting Freak
Posts: 792
Threads: 10
Joined: Jul 2011
Reputation:
66
|
RE: (script) help me please
(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.
|
|
02-25-2012, 03:48 PM |
|
eddyed123
Junior Member
Posts: 4
Threads: 2
Joined: Feb 2012
Reputation:
0
|
RE: (script) help me please
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();
}
(This post was last modified: 02-25-2012, 03:52 PM by eddyed123.)
|
|
02-25-2012, 03:50 PM |
|
Obliviator27
Posting Freak
Posts: 792
Threads: 10
Joined: Jul 2011
Reputation:
66
|
RE: (script) help me please
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.
|
|
02-25-2012, 03:52 PM |
|
eddyed123
Junior Member
Posts: 4
Threads: 2
Joined: Feb 2012
Reputation:
0
|
RE: (script) help me please
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();
}
|
|
02-25-2012, 04:00 PM |
|
Obliviator27
Posting Freak
Posts: 792
Threads: 10
Joined: Jul 2011
Reputation:
66
|
RE: (script) help me please
There are two commas in your AddEntityCollideCallback line.
|
|
02-25-2012, 04:23 PM |
|
Froggit
Junior Member
Posts: 20
Threads: 4
Joined: Feb 2012
Reputation:
0
|
RE: (script) help me please
IDK about scripting that much :/
(This post was last modified: 02-25-2012, 04:40 PM by Froggit.)
|
|
02-25-2012, 04:38 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: (script) help me please
He means:
AddEntityCollideCallback("Player", , "ScriptArea_1", "CollideScriptArea", true, 1);
is supposed to be:
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideScriptArea", true, 1);
|
|
02-26-2012, 10:27 AM |
|
|