Frictional Games Forum (read-only)

Full Version: Unexpected err {
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Once I go to play my map this comes up!Huh
FATAL ERROR:Could not load script file
'custom_stories/Tutorial/maps/maps1.hps'!
main (14, 1) :ERR :Unexpected token '{'

Heres the map1.hps

////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("escape_room_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
RemoveItem("escape_door_key1");
}
{
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lol_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
RemoveItem("lol_key1");
PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

HELP ME!!! Sad
(07-16-2013, 10:35 AM)mrjoshy12 Wrote: [ -> ]Once I go to play my map this comes up!Huh
FATAL ERROR:Could not load script file
'custom_stories/Tutorial/maps/maps1.hps'!
main (14, 1) :ERR :Unexpected token '{'

Heres the map1.hps

////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("escape_room_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
RemoveItem("escape_door_key1");
}
{
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lol_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
RemoveItem("lol_key1");
PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

HELP ME!!! Sad

PHP Code:
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
     
SetSwingDoorLocked("escape_room_door1"falsetrue);
 
PlaySoundAtEntity("""unlock_door""escape_room_door1"0false);
 
RemoveItem("escape_door_key1");
}
{
      
AddUseItemCallback("""lol_key1""lol_door1""UsedKeyOnDoor2"true);


There's another "{" after the first "}" . There's suppose to be a void thingy before the "{" .
Try this. (Tell me if i missed something, did this from my phone)
Oh and just so you know, one of the Callbacks didn't match the function.
Code:
Void OnStart()
{
    AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("escape_room_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
RemoveItem("escape_door_key1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lol_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
RemoveItem("lol_key1");
PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
Code:
////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
     AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked("escape_room_door1", false, true);
     PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
     RemoveItem("escape_door_key1");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked("lol_door1", false, true);
     PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
     RemoveItem("lol_key1");
     PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

Fixed. The reason why you got an error is because this code
Code:
{
      AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

is not defined in a function.
Dammit No Author! You code to faaaast! Wink
Wow. I left for a minute and there's already 3 replies.
Lol ofc I am

And if that doesn't fix the problem, maybe the adduseitemcallback isn't suppose to be there.
(07-16-2013, 10:53 AM)No Author Wrote: [ -> ]Wow. I left for a minute and there's already 3 replies.

And if that doesn't fix the problem, maybe the adduseitemcallback isn't suppose to be there.

Yeah It's all about the reps man all about em!
Wow. No Author just ninja'd two people. Nice job dude.
wow all these comments, i actually forgot to say i started doing this scripting yesterday,
so yeah i dont actually get what most of you are sayin
The adduseitemcallback script on Lolkey_1 to loldoor_1 doesn't have a void before the "{"
Edit : I meant lol_key1 and lol_door1
Pages: 1 2 3