Unexpected end of file 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: Unexpected end of file help (/thread-20755.html) Pages:
1
2
|
Unexpected end of file help - killerblade - 03-15-2013 guys please i really need help on this one , it says error on my hps line 15 , 1 , here's my hps void OnStart() { AddEntityCollideCallback("Player", "thescript", "Collidethescript", true, 1); AddEntityCollideCallback("firstgrunt", "secondnode", "Collidesecondnode", true, 1); } void Collidethescript(string &in asParent, string &in asChild, int alState) { SetEntityactive("firstgrunt", true); AddEnemyPatrolNode("firstgrunt, "firstnode", 1, ""); } void Collidesecondscript(string &in asParent, string &in asChild, int alState) { SetEntityactive("firstgrunt", false); } RE: Unexpected end of file help - Adrianis - 03-15-2013 AddEnemyPatrolNode("firstgrunt", "firstnode", 1, ""); You missed a " In the future, if you could say what error came up, it would be really helpful RE: Unexpected end of file help - killerblade - 03-15-2013 (03-15-2013, 10:36 AM)Adrianis Wrote: AddEnemyPatrolNode("firstgrunt", "firstnode", 1, ""); i put the " , now it gave me another error , Main (8, 1):Err: no matching signature SetEntityactive(string@$,const bool)' main (13,1):ERR: No matching signatures to SetENTITYactive(string@&,const bool)' RE: Unexpected end of file help - Adrianis - 03-15-2013 It should be 'SetEntityActive', rather than 'SetEntityactive' Uppercase/lowercase characters matter in HPL scripting Also for future reference, the first of the two numbers in brackets in the error message 'Main (8, 1):Err: refers to the line in which is encountered the error. Line 8 in your script is where the incorrect function call is. That counts for most, but not the 'Unexpected End of File' error - because that one will always name the last line of your script (being the end of the file, of course) RE: Unexpected end of file help - ingedoom - 03-15-2013 I would suggest that you follow this guide. It helps you set up your text editor so that small errors like these become much easier to spot. RE: Unexpected end of file help - killerblade - 03-15-2013 i have a new problem i would appreciate if you guys help , The error is : main (62,1)Unexpected token: if Main (66,6)Unexpected token :Else Main (70,2)Unexpected token :Else , here's my script please help me! void Flashingteleport(string &in asParent, string &in asChild, int alState) { FadeOut(0); FadeIn(20); ChangeMap("Mohammadsmap.map", "flashingteleport", "", ""); StartPlayerLookAt("LookatTeleport", 1, 2.0f, ""); AddTimer("1", 5, "flashingreturn"); AddTimer("2", 2, "Playerdisablemove"); AddTimer("3", 15, "Flashingkeh"); } void Playerdisablemove(string &in asTimer) { SetPlayerActive(false); } void Flashingreturn(string &in asTimer) { SetPlayerActive(true); } void Flashingkeh(string &in asTimer) { ChangeMap("Mohammadsmap.map", "flashingreturn", "", ""); StartPlayerLookAt("LookatReturn", 1, 2.0f, ""); } if(asTimer == "1") { SetPlayerActive(true); } else if(asTimer == "2") { SetPlayerActive(false); } else if(asTimer == "3") { ChangeMap("Mohammadsmap.map", "flashingreturn", "", ""); StartPlayerLookAt("LookatReturn", 1, 2.0f, ""); } RE: Unexpected end of file help - ingedoom - 03-15-2013 (03-15-2013, 08:57 PM)killerblade Wrote: I'm quite sure you don't have to put "" around your integers. Just remove those. PHP Code: if(asTimer == 1) "" is only for string values. Strings are text like: "grunt_1" I think you will find this article helpful. RE: Unexpected end of file help - killerblade - 03-15-2013 (03-15-2013, 09:30 PM)ingedoom Wrote:that didnt fix and the article didnt help....(03-15-2013, 08:57 PM)killerblade Wrote: RE: Unexpected end of file help - Adrianis - 03-15-2013 'asTimer' is the name of the timer you set using AddTimer. Unfortunately, that means you were right to have it as "1" before, since it is a string and not an integer (sorry ingedoom...) In the future you may want to name your timer's something more specific The problem is that your series of 'if..else' statements are outside of a function - they can't be used like that, they must be within a function Here Code: void Flashingkeh(string &in asTimer) Did you intend the if...else statements to be part of 'void Flashingkeh(string &in asTimer)' ? Also, Code: AddTimer("1", 5, "flashingreturn"); Are those the timers that are being checked by the if...else statements? Because all of those timers call different functions, which removes the need to use if...else statements to check which timer is the current one Perhaps you will find this article helpful instead. http://wiki.frictionalgames.com/hpl2/tutorials/script/advancedtimers RE: Unexpected end of file help - ingedoom - 03-15-2013 (03-15-2013, 08:57 PM)killerblade Wrote: that didnt fix and the article didnt help.... Ohhh my bad you did correct with the " " and the names af the timers are 1 2 and 3. The problem is something totally different. You need to have the if statement within a function like PHP Code: void OnStart() //function Another thing is that you use the if statement completely wrong. Just detete it and add new timers and functions like you allready did: Spoiler below!
Eventually add the new timers withing the functions you made =) Delete the if statements. Read the article, it will help you understand how you can use the if statement |