Frictional Games Forum (read-only)

Full Version: Script ERROR need help N00B
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Here is my script can you see any errors because the game thinks there is:

void OnStart ()
{
AddUseItemCallback ("", "Corridor Key", "door_1", "UsedkeyOnDoor", true);
}
void UsedKeyOnDoor (string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
playSoundAtEntity("", "unlock_door", "door_1", 0, false,);
RemoveItem("Corridor key");
}

I have done all the extra_english stuff :d
If I understand correctly you have made an extremely easy mistake to correct.

playSoundAtEntity("", "unlock_door", "door_1", 0, false,);

should be: playSoundAtEntity("", "unlock_door", "door_1", 0, false);

You had a comma at the end of "false".

C++ is annoying like that, hope it helps. Big Grin
Did you add:

Spoiler below!

void OnEnter()
{

}

and
Spoiler below!

void OnLeave()
{

}

Thnx guys Big Grin
Now its saying no matching signatures
Now its saying something about it cant find a signature Angry Angry Angry Angry
Please repeat your updated script file so I can see it.
(04-30-2011, 09:22 PM)NylePudding Wrote: [ -> ]If I understand correctly you have made an extremely easy mistake to correct.

playSoundAtEntity("", "unlock_door", "door_1", 0, false,);

should be: playSoundAtEntity("", "unlock_door", "door_1", 0, false);

You had a comma at the end of "false".

C++ is annoying like that, hope it helps. Big Grin

I love C++ it always works nearly perfect for me. Big Grin
Nevermind, I found the problem.

You need to watch your capitalization and punctuation.

This: playSoundAtEntity("", "unlock_door", "door_1", 0, false,);

Is supposed to be this:

PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
Now my door doesn't unlock Huh Angry Huh Angry
it never did Sad
Yes, that's what Nylepudding already told him 1 hour before you did. Smile
Try This;


void OnStart()
{
AddUseItemCallback ("", "Corridor_Key", "door_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor (string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("Corridor_key");
}


And also, go in your editor and rename "Corridor Key" to "Corridor_Key"

I am sure if you do exactly this it will work =)
(04-30-2011, 11:34 PM)Tottel Wrote: [ -> ]Yes, that's what Nylepudding already told him 1 hour before you did. Smile

If you notice, sir, Nye forgot to capitalize the first letter.
Code:
void OnStart()
{
    AddUseItemCallback("", "RoomKey", "RoomDoor", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string&in asEntity)
{
    SetSwingDoorLocked("RoomDoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "RoomDoor", 0, false);
    RemoveItem("RoomKey");
}
This is my code of my test map. It has a UsedKeyOnDoor code. My code is working, so you can compare and see if there are any mistakes.

Smile
Pages: 1 2