Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hpl 2 help
s2skafte Offline
Junior Member

Posts: 7
Threads: 2
Joined: Mar 2013
Reputation: 0
#1
Hpl 2 help

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

}
03-23-2013, 02:03 AM
Find Reply
plutomaniac Offline
Super Moderator

Posts: 6,369
Threads: 45
Joined: May 2011
Reputation: 183
#2
RE: Hpl 2 help

I guess the code you want is this?

PHP Code: (Select All)
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).
(This post was last modified: 03-23-2013, 03:37 AM by plutomaniac.)
03-23-2013, 02:29 AM
Find Reply
s2skafte Offline
Junior Member

Posts: 7
Threads: 2
Joined: Mar 2013
Reputation: 0
#3
RE: Hpl 2 help

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);
(This post was last modified: 03-23-2013, 06:26 AM by s2skafte.)
03-23-2013, 05:33 AM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Hpl 2 help

Full script please.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-23-2013, 06:49 AM
Find Reply
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#5
RE: Hpl 2 help

(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: (Select All)
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

In Ruins [WIP]
(This post was last modified: 03-25-2013, 05:33 AM by NaxEla.)
03-23-2013, 07:40 AM
Find Reply
s2skafte Offline
Junior Member

Posts: 7
Threads: 2
Joined: Mar 2013
Reputation: 0
#6
RE: Hpl 2 help

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
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
RE: Hpl 2 help

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

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-24-2013, 06:10 AM
Find Reply
s2skafte Offline
Junior Member

Posts: 7
Threads: 2
Joined: Mar 2013
Reputation: 0
#8
RE: Hpl 2 help

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);
}
03-25-2013, 01:30 AM
Find Reply
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: Hpl 2 help

SetSwingDoorClosed is missing a closing quotation in Collideroomtwo.

Tutorials: From Noob to Pro
03-25-2013, 01:53 AM
Website Find Reply
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#10
RE: Hpl 2 help

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

In Ruins [WIP]
03-25-2013, 05:35 AM
Find Reply




Users browsing this thread: 1 Guest(s)