Frictional Games Forum (read-only)

Full Version: Script Problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
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()
{

}
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
(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...
You need a bracket at the end of:
void UsedKeyOnDoor(string &in asItem, string &in asEntity
(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
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.
(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
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);
}
what's the exact error message?
(03-05-2013, 10:19 PM)darksky Wrote: [ -> ]what's the exact error message?

unexpected token {
Pages: 1 2 3 4 5 6 7 8 9