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


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Hard to find the errors in the HPS file
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#14
RE: Hard to find the errors in the HPS file

void OnEnter()
{

Your missing another '}'. Again, look at the line referenced in the error (in this case, line 54) and check over what you've written to make sure its all correct. You know that every function requires void functionname(conditions) followed by { and ended with }, so check over each function making sure they all have these present.

Since this is all posted, and I have to manually count 54 lines down your script, its hard to tell what the problem is. You also appear to have everything in your script doubled up, unless that is just a posting mistake, you need to just have one copy of everything in the script file.

One other thing, you don't need to have the OnEnter() or OnLeave() function in the script to run the map if your not using them. On each of your posts, they have been missing one or other of the required '{' and '}', so I recommend you remove them completely untill you need to use them.

////////////////////////////
//run when entering map
void OnStart()
{
AddUseItemCallback("", "key_study_1", "Freedom", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Freedom", false, true);
PlaySoundAtEntity("", "unlock_door", "Freedom ", 0, false);
RemoveItem("key_study_1");
}


void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
SetEntityPlayerInteractCallback("cabinetmetal", "Spawn", true);
}

void Spawn(string &in asEntity)
{
SetEntityActive("corpse_male_1", true);
AddTimer("Scare", 0.5f, "Scare1");
}

void scare1(string &in asTimer)
{
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "react_scare.snt", "Player", 0, false);
}

The above should be everything you need, and should (hopefully!) not produce an error. If it does not error, but does not work, then there may be a problem with your logic and you should rethink how you are using these functions
.

Keep your script writing in the following format,

void functioname(condition)
{
function activity;
}

This easily allows you to see which functions are missing the required syntax aka the '()', the '{}' and the ';' for the parts within the function. You are obviously writing in this way already, but you are not taking advantage of the reasons for writing in this way.

If you do not already, use a program called Notepad++ for your script writing. This does a variety of useful things to help make syntax issues obvious, most useful for you will be the fact that it numbers each line, so when an error like the one above pops up saying there is an issue at line 54, you can go straight to that line and identify the issue far quicker, since you know exactly which line is causing the issue.

Follow this tutorial to get Notepad++ set up correctly for use with HPL scripting.
'
http://www.youtube.com/watch?v=1x3mTmvbSmc'
03-06-2012, 04:20 PM
Find


Messages In This Thread
RE: Hard to find the errors in the HPS file - by Adrianis - 03-06-2012, 04:20 PM



Users browsing this thread: 1 Guest(s)