Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
(script) help me please
Author Message
eddyed123 Offline
Junior Member

Posts: 4
Joined: Feb 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 939
Joined: Jul 2011
Reputation: 39
Post: #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 all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #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 all posts by this user Quote this message in a reply
eddyed123 Offline
Junior Member

Posts: 4
Joined: Feb 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #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 all posts by this user Quote this message in a reply
eddyed123 Offline
Junior Member

Posts: 4
Joined: Feb 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #7
RE: (script) help me please
There are two commas in your AddEntityCollideCallback line.

02-25-2012 04:23 PM
Find all posts by this user Quote this message in a reply
Froggit Offline
Junior Member

Posts: 20
Joined: Feb 2012
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
flamez3 Offline
Posting Freak

Posts: 1,320
Joined: Apr 2011
Reputation: 57
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)