Thies is really annoying on my scipt i keep getting an error when i try to run my custom story. the error main (11,2) :unexpected token '{'[/font]
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Lockeddoor_1", "hello", true);
}
void hello(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_1", asEntity, 0, false);
RemoveItem(asItem);
}
{
AddUseItemCallback("", "key_tower_1", "Lockeddoor_2", "hello", true);
}
void hello(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_2", asEntity, 0, false);
RemoveItem(asItem);
}
I guess the code you want is this?
PHP Code:
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Lockeddoor_1", "hello1", true);
AddUseItemCallback("", "key_tower_1", "Lockeddoor_2", "hello2", true);
}
void hello1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_1", asEntity, 0, false);
RemoveItem(asItem);
}
void hello2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_2", asEntity, 0, false);
RemoveItem(asItem);
}
You had two functions with the same name (hello, I changed one to hello1 and the other to hello2) and a misplaced AddUseItemCallback function(it should go under OnStart, just like the first one you used).
OMG!!!! Thank you i have been stumped on this for some time now!!
wonderful i have another problem. i was following a tut on youtube and i did everything right i think but i get this error-unexpected 39,1 end of file. what do i do?
{
void AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", True, 1);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2, true, true);
(03-23-2013, 05:33 AM)s2skafte Wrote: [ -> ]wonderful i have another problem. i was following a tut on youtube and i did everything right i think but i get this error-unexpected 39,1 end of file. what do i do?
{
void AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", True, 1);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2, true, true);
That probably isn't your full script (because it says the error is at line 39), but anyways, make sure that your callback (AddEntityCollideCallback) is inside OnStart(). Also, you need a closing bracket at the end, and make sure that you don't capitalize the T in "true". Like this:
PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", true, 1);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2", true, true);
}
edit: fixed a mistake with my script
edit2: fixed another mistake
uh i still get the same problem unexpected end of file.
full script so far.
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Lockeddoor_1", "hello1", true);
AddUseItemCallback("", "key_tower_1", "Lockeddoor_2", "hello2", true);
}
void hello1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_1", asEntity, 0, false);
RemoveItem(asItem);
}
void hello2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_2", asEntity, 0, false);
RemoveItem(asItem);
}
{
void AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", true, 1);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2, true, true);
}
(03-24-2013, 06:02 AM)s2skafte Wrote: [ -> ]uh i still get the same problem unexpected end of file.
full script so far.
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Lockeddoor_1", "hello1", true);
AddUseItemCallback("", "key_tower_1", "Lockeddoor_2", "hello2", true);
}
void hello1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_1", asEntity, 0, false);
RemoveItem(asItem);
}
void hello2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_2", asEntity, 0, false);
RemoveItem(asItem);
}
{
void AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", true, 1);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2, true, true);
}
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Lockeddoor_1", "hello1", true);
AddUseItemCallback("", "key_tower_1", "Lockeddoor_2", "hello2", true);
AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", true, 1);
}
void hello1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_1", asEntity, 0, false);
RemoveItem(asItem);
}
void hello2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_2", asEntity, 0, false);
RemoveItem(asItem);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2, true, true);
}
---
There was a misplaced AddEntityCollideCallback.
i still get that stupid error unexpected end of file. Thanks for the help guys.
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Lockeddoor_1", "hello1", true);
AddUseItemCallback("", "key_tower_1", "Lockeddoor_2", "hello2", true);
AddEntityCollideCallback("Player", "Script_slam", "Collideroomtwo", true, 1);
}
void hello1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_1", asEntity, 0, false);
RemoveItem(asItem);
}
void hello2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_Lockeddoor_2", asEntity, 0, false);
RemoveItem(asItem);
}
void Collideroomtwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_2, true, true);
}
SetSwingDoorClosed is missing a closing quotation in Collideroomtwo.
Haha, sorry, that was my fault. The script I wrote had the same mistake so I'm guessing you copy+pasted it. I must have been pretty tired when I wrote that