Frictional Games Forum (read-only)
Hpl 2 help - 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: Hpl 2 help (/thread-20872.html)

Pages: 1 2


Hpl 2 help - s2skafte - 03-23-2013

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

}


RE: Hpl 2 help - plutomaniac - 03-23-2013

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 asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""unlock_Lockeddoor_1"asEntity0false);
    
RemoveItem(asItem);
}

void hello2(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""unlock_Lockeddoor_2"asEntity0false);
    
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).


RE: Hpl 2 help - s2skafte - 03-23-2013

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


RE: Hpl 2 help - PutraenusAlivius - 03-23-2013

Full script please.


RE: Hpl 2 help - NaxEla - 03-23-2013

(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"true1);
}

void Collideroomtwo(string &in asParentstring &in asChildint alState)
{
    
SetSwingDoorClosed("Door_2"truetrue);


edit: fixed a mistake with my script
edit2: fixed another mistake


RE: Hpl 2 help - s2skafte - 03-24-2013

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


RE: Hpl 2 help - PutraenusAlivius - 03-24-2013

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


RE: Hpl 2 help - s2skafte - 03-25-2013

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


RE: Hpl 2 help - Your Computer - 03-25-2013

SetSwingDoorClosed is missing a closing quotation in Collideroomtwo.


RE: Hpl 2 help - NaxEla - 03-25-2013

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 Undecided