s2skafte
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2013
Reputation:
0
|
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 |
|
plutomaniac
Super Moderator
Posts: 6,368
Threads: 45
Joined: May 2011
Reputation:
183
|
RE: Hpl 2 help
I guess the code you want is this?
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).
(This post was last modified: 03-23-2013, 03:37 AM by plutomaniac.)
|
|
03-23-2013, 02:29 AM |
|
s2skafte
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2013
Reputation:
0
|
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 |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: Hpl 2 help
Full script please.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-23-2013, 06:49 AM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
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:
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
(This post was last modified: 03-25-2013, 05:33 AM by NaxEla.)
|
|
03-23-2013, 07:40 AM |
|
s2skafte
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2013
Reputation:
0
|
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 |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
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 |
|
s2skafte
Junior Member
Posts: 7
Threads: 2
Joined: Mar 2013
Reputation:
0
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Hpl 2 help
SetSwingDoorClosed is missing a closing quotation in Collideroomtwo.
|
|
03-25-2013, 01:53 AM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
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
|
|
03-25-2013, 05:35 AM |
|
|