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
Unexpected end of file help
killerblade Offline
Junior Member

Posts: 4
Threads: 1
Joined: Mar 2013
Reputation: 0
#1
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#2
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
Find
killerblade Offline
Junior Member

Posts: 4
Threads: 1
Joined: Mar 2013
Reputation: 0
#3
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#4
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
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#5
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.

[Image: 23778.png]
(This post was last modified: 03-15-2013, 01:55 PM by ingedoom.)
03-15-2013, 01:54 PM
Website Find
killerblade Offline
Junior Member

Posts: 4
Threads: 1
Joined: Mar 2013
Reputation: 0
#6
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
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#7
RE: Unexpected end of file help

(03-15-2013, 08:57 PM)killerblade Wrote:
PHP Code: (Select All)
if(asTimer == "1")
{
 
SetPlayerActive(true);
    }
    else if(
asTimer == "2")
{
 
SetPlayerActive(false);
    }
    else if(
asTimer == "3")
{
ChangeMap("Mohammadsmap.map""flashingreturn""""");
StartPlayerLookAt("LookatReturn"12.0f"");


I'm quite sure you don't have to put "" around your integers. Just remove those.

PHP Code: (Select All)
if(asTimer == 1)
{
 
SetPlayerActive(true);
    }
    else if(
asTimer == 2)
{
 
SetPlayerActive(false);
    }
    else if(
asTimer == 3)
{
ChangeMap("Mohammadsmap.map""flashingreturn""""");
StartPlayerLookAt("LookatReturn"12.0f"");


"" is only for string values. Strings are text like: "grunt_1"

I think you will find this article helpful.

[Image: 23778.png]
(This post was last modified: 03-15-2013, 09:37 PM by ingedoom.)
03-15-2013, 09:30 PM
Website Find
killerblade Offline
Junior Member

Posts: 4
Threads: 1
Joined: Mar 2013
Reputation: 0
#8
RE: Unexpected end of file help

(03-15-2013, 09:30 PM)ingedoom Wrote:
(03-15-2013, 08:57 PM)killerblade Wrote:
PHP Code: (Select All)
if(asTimer == "1")
{
 
SetPlayerActive(true);
    }
    else if(
asTimer == "2")
{
 
SetPlayerActive(false);
    }
    else if(
asTimer == "3")
{
ChangeMap("Mohammadsmap.map""flashingreturn""""");
StartPlayerLookAt("LookatReturn"12.0f"");


I'm quite sure you don't have to put "" around your integers. Just remove those.

PHP Code: (Select All)
if(asTimer == 1)
{
 
SetPlayerActive(true);
    }
    else if(
asTimer == 2)
{
 
SetPlayerActive(false);
    }
    else if(
asTimer == 3)
{
ChangeMap("Mohammadsmap.map""flashingreturn""""");
StartPlayerLookAt("LookatReturn"12.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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#9
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
Find
ingedoom Offline
Member

Posts: 120
Threads: 12
Joined: Feb 2012
Reputation: 0
#10
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

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

PHP Code: (Select All)
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"12.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

[Image: 23778.png]
03-15-2013, 11:16 PM
Website Find




Users browsing this thread: 1 Guest(s)