killerblade
Junior Member
Posts: 4
Threads: 1
Joined: Mar 2013
Reputation:
0
Unexpected end of file help
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);
}
03-15-2013, 10:26 AM
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
RE: Unexpected end of file help
AddEnemyPatrolNode("firstgrunt" , "firstnode", 1, "");
You missed a "
In the future, if you could say what error came up, it would be really helpful
(This post was last modified: 03-15-2013, 10:36 AM by Adrianis .)
03-15-2013, 10:36 AM
killerblade
Junior Member
Posts: 4
Threads: 1
Joined: Mar 2013
Reputation:
0
RE: Unexpected end of file help
(03-15-2013, 10:36 AM) Adrianis Wrote: AddEnemyPatrolNode("firstgrunt" , "firstnode", 1, "");
You missed a "
In the future, if you could say what error came up, it would be really helpful
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)'
03-15-2013, 11:31 AM
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
RE: Unexpected end of file help
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)
(This post was last modified: 03-15-2013, 12:27 PM by Adrianis .)
03-15-2013, 12:25 PM
ingedoom
Member
Posts: 120
Threads: 12
Joined: Feb 2012
Reputation:
0
RE: Unexpected end of file help
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.
(This post was last modified: 03-15-2013, 01:55 PM by ingedoom .)
03-15-2013, 01:54 PM
killerblade
Junior Member
Posts: 4
Threads: 1
Joined: Mar 2013
Reputation:
0
RE: Unexpected end of file help
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, "");
}
03-15-2013, 08:57 PM
ingedoom
Member
Posts: 120
Threads: 12
Joined: Feb 2012
Reputation:
0
RE: Unexpected end of file help
(03-15-2013, 08:57 PM) killerblade Wrote: if( asTimer == "1" ) { SetPlayerActive ( true ); } else if( asTimer == "2" ) { SetPlayerActive ( false ); } else if( asTimer == "3" ) { ChangeMap ( "Mohammadsmap.map" , "flashingreturn" , "" , "" ); StartPlayerLookAt ( "LookatReturn" , 1 , 2.0f , "" ); }
I'm quite sure you don't have to put "" around your integers. Just remove those.
if( asTimer == 1 ) { SetPlayerActive ( true ); } else if( asTimer == 2 ) { SetPlayerActive ( false ); } else if( asTimer == 3 ) { ChangeMap ( "Mohammadsmap.map" , "flashingreturn" , "" , "" ); StartPlayerLookAt ( "LookatReturn" , 1 , 2.0f , "" ); }
"" is only for string values. Strings are text like: "grunt_1"
I think you will find
this article helpful.
(This post was last modified: 03-15-2013, 09:37 PM by ingedoom .)
03-15-2013, 09:30 PM
killerblade
Junior Member
Posts: 4
Threads: 1
Joined: Mar 2013
Reputation:
0
RE: Unexpected end of file help
(03-15-2013, 09:30 PM) ingedoom Wrote: (03-15-2013, 08:57 PM) killerblade Wrote: if( asTimer == "1" ) { SetPlayerActive ( true ); } else if( asTimer == "2" ) { SetPlayerActive ( false ); } else if( asTimer == "3" ) { ChangeMap ( "Mohammadsmap.map" , "flashingreturn" , "" , "" ); StartPlayerLookAt ( "LookatReturn" , 1 , 2.0f , "" ); }
I'm quite sure you don't have to put "" around your integers. Just remove those.
if( asTimer == 1 ) { SetPlayerActive ( true ); } else if( asTimer == 2 ) { SetPlayerActive ( false ); } else if( asTimer == 3 ) { ChangeMap ( "Mohammadsmap.map" , "flashingreturn" , "" , "" ); StartPlayerLookAt ( "LookatReturn" , 1 , 2.0f , "" ); }
"" is only for string values. Strings are text like: "grunt_1"
I think you will find this article helpful.that didnt fix and the article didnt help....
03-15-2013, 10:49 PM
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
RE: Unexpected end of file help
'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
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, "");
}
Did you intend the if...else statements to be part of 'void Flashingkeh(string &in asTimer)' ?
Also,
AddTimer("1", 5, "flashingreturn");
AddTimer("2", 2, "Playerdisablemove");
AddTimer("3", 15, "Flashingkeh");
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/tut...ncedtimers
(This post was last modified: 03-15-2013, 11:16 PM by Adrianis .)
03-15-2013, 11:08 PM
ingedoom
Member
Posts: 120
Threads: 12
Joined: Feb 2012
Reputation:
0
RE: Unexpected end of file help
(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
void OnStart () //function { if( condition ) { Things to if the condition is met } }
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!
AddTimer ( "1" , 5 , "flashingreturn" ); AddTimer ( "2" , 2 , "Playerdisablemove" ); AddTimer ( "3" , 15 , "Flashingkeh" ); } void Playerdisablemove ( string & in asTimer ) //This function executes { SetPlayerActive ( false ); } void Flashingreturn ( string & in asTimer ) //This function executes { SetPlayerActive ( true ); } void Flashingkeh ( string & in asTimer ) //This function executes { ChangeMap ( "Mohammadsmap.map" , "flashingreturn" , "" , "" ); StartPlayerLookAt ( "LookatReturn" , 1 , 2.0f , "" ); }
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
03-15-2013, 11:16 PM