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 Problems
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#1
Script Problems

Alright so I've just started with my first custom story. I've entered the hps codes I need but everytime I open the custom story to try it says unexpected error main (11,1):err:unexpected token
main (10,15):err:expected identifier

My script file looks like this:


void OnStart ()
{
AddUseItemCallBack("", "GuestRoomKey", "door01", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity"", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}

void OnEnter()
{

}

void OnLeave()
{

}
03-04-2013, 04:10 PM
Find
darksky Offline
Member

Posts: 52
Threads: 8
Joined: Nov 2012
Reputation: 2
#2
RE: Script Problems

PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
03-04-2013, 04:52 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#3
RE: Script Problems

(03-04-2013, 04:52 PM)darksky Wrote: PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);

thank you

(03-04-2013, 05:09 PM)Coolfromdah00d Wrote:
(03-04-2013, 04:52 PM)darksky Wrote: PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);

thank you

Now I just get unexpected end of file...
(This post was last modified: 03-04-2013, 05:11 PM by Coolfromdah00d.)
03-04-2013, 05:09 PM
Find
ExpectedIdentifier Offline
Member

Posts: 234
Threads: 10
Joined: Sep 2012
Reputation: 11
#4
RE: Script Problems

You need a bracket at the end of:
void UsedKeyOnDoor(string &in asItem, string &in asEntity
(This post was last modified: 03-04-2013, 05:17 PM by ExpectedIdentifier.)
03-04-2013, 05:16 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#5
RE: Script Problems

(03-04-2013, 05:16 PM)sonataarctica Wrote: You need a bracket at the end of:
void UsedKeyOnDoor(string &in asItem, string &in asEntity

Yeah I saw that but now I get this instead.

main (3,5) ERR: No matching signatures to
AddUseItemCallBack(string@&,string@&,string@&,string@&, const bool
03-04-2013, 05:49 PM
Find
ExpectedIdentifier Offline
Member

Posts: 234
Threads: 10
Joined: Sep 2012
Reputation: 11
#6
RE: Script Problems

It's because you've written AddUseItemCallback as AddUseItemCallBack. Make the B lowercase and it'll work. And use this page from now on to make sure you get the syntax right:

Engine scripts [Frictional Game Wiki]


You need to understand the basics of how scripting works otherwise you're just going to keep running into these problems. I'd suggest reading some tutorials, there are loads linked on the page I just linked.
(This post was last modified: 03-04-2013, 06:04 PM by ExpectedIdentifier.)
03-04-2013, 06:03 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#7
RE: Script Problems

(03-04-2013, 06:03 PM)sonataarctica Wrote: It's because you've written AddUseItemCallback as AddUseItemCallBack. Make the B lowercase and it'll work. And use this page from now on to make sure you get the syntax right:

Engine scripts [Frictional Game Wiki]


You need to understand the basics of how scripting works otherwise you're just going to keep running into these problems. I'd suggest reading some tutorials, there are loads linked on the page I just linked.

thank you
¨
I'll use that page whenever I get a new problem
03-04-2013, 06:58 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#8
RE: Script Problems

Alright I've got another problem now... I just keep getting the unexpected token error when I try to set up my jumpscare. I need some help here again...

{
SetEntityCallbackFunc("GuestRoomKey", "jump");
}

void jump(string &in asEntity, string &in type)

{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, false);
}
03-05-2013, 08:34 PM
Find
darksky Offline
Member

Posts: 52
Threads: 8
Joined: Nov 2012
Reputation: 2
#9
RE: Script Problems

what's the exact error message?
03-05-2013, 10:19 PM
Find
Coolfromdah00d Offline
Junior Member

Posts: 38
Threads: 5
Joined: Mar 2013
Reputation: 0
#10
RE: Script Problems

(03-05-2013, 10:19 PM)darksky Wrote: what's the exact error message?

unexpected token {
03-06-2013, 03:47 PM
Find




Users browsing this thread: 1 Guest(s)