Frictional Games Forum (read-only)
Script Problems - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Script Problems (/thread-20613.html)

Pages: 1 2 3 4 5 6 7 8 9


Script Problems - Coolfromdah00d - 03-04-2013

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()
{

}


RE: Script Problems - darksky - 03-04-2013

PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);


RE: Script Problems - Coolfromdah00d - 03-04-2013

(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...


RE: Script Problems - ExpectedIdentifier - 03-04-2013

You need a bracket at the end of:
void UsedKeyOnDoor(string &in asItem, string &in asEntity


RE: Script Problems - Coolfromdah00d - 03-04-2013

(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


RE: Script Problems - ExpectedIdentifier - 03-04-2013

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.


RE: Script Problems - Coolfromdah00d - 03-04-2013

(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


RE: Script Problems - Coolfromdah00d - 03-05-2013

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);
}


RE: Script Problems - darksky - 03-05-2013

what's the exact error message?


RE: Script Problems - Coolfromdah00d - 03-06-2013

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

unexpected token {