Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(script) help me please
eddyed123 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Feb 2012
Reputation: 0
#1
Sad  (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
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
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
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#3
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
Find
eddyed123 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Feb 2012
Reputation: 0
#4
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
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#5
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
Find
eddyed123 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Feb 2012
Reputation: 0
#6
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
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#7
RE: (script) help me please

There are two commas in your AddEntityCollideCallback line.

02-25-2012, 04:23 PM
Find
Froggit Offline
Junior Member

Posts: 20
Threads: 4
Joined: Feb 2012
Reputation: 0
#8
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
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#9
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
Find




Users browsing this thread: 1 Guest(s)