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
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#11
RE: Hard to find the errors in the HPS file

(03-05-2012, 12:47 AM)robinnjensen Wrote: Hello, i have been searching through the script areas and i can't seem to find anything, i'm kinda new to this stuff aswell, but i would be great thankfull if any of you guys would like to help me to fix my script ! Smile

here it is
--------------------------------------------------------------------------------------------------
////////////////////////////
//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", "door", 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);




////////////////////////////
//Run when entering map
void OnEnter()
}




////////////////////////////
// Run when leaving map
void OnLeave()
}
--------------------------------------------------------------------------------------
Really thankfull!


---------------------------
FATAL ERROR
---------------------------
FATAL ERROR: Could not load script file 'custom_stories/Robin's Hell/custom_stories/Robin's Hell/maps/Robin's Hell.hps'!
main (24, 16) : ERR : Expected identifier
main (25, 9) : ERR : Expected identifier
main (29, 1) : ERR : Expected ',' or ';'
main (30, 18) : ERR : Expected identifier
main (35, 1) : ERR : Expected ',' or ';'

---------------------------
OK
---------------------------


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);

}


{
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);
}



////////////////////////////
//Run when entering map
void OnEnter()
{
}[align=-webkit-auto]

test that Smile

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 03-05-2012, 04:09 PM by jessehmusic.)
03-05-2012, 04:09 PM
Website Find
Adrianis Offline
Senior Member

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

"{

SetEntityActive("corpse_male_1", true);

AddTimer("Scare", 0.5f, "Scare1");

}"

Your missing the function name here, it aint gonna like that Smile

void Spawn(string &in asEntity)
{


SetEntityActive("corpse_male_1", true);


AddTimer("Scare", 0.5f, "Scare1");


}

03-05-2012, 07:38 PM
Find
robinnjensen Offline
Junior Member

Posts: 5
Threads: 1
Joined: Mar 2012
Reputation: 0
#13
RE: Hard to find the errors in the HPS file

I'll try them out, i'll tell how it went ! Smile
Here is how i editet my script from you guys,


////////////////////////////
//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);
}



////////////////////////////
//Run when entering map
void OnEnter()
{


////////////////////////////
// Run when leaving map
void OnLeave()
}
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);

}


{
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);
}



////////////////////////////
//Run when entering map
void OnEnter()
{


////////////////////////////
// Run when leaving map
void OnLeave()
{
------------------------------------------------










---------------------------
FATAL ERROR
---------------------------
FATAL ERROR: Could not load script file 'custom_stories/Robin's Hell/custom_stories/Robin's Hell/maps/Robin's Hell.hps'!
 main (54, 1) : ERR  : Expected ',' or ';'




---------------------------
OK   
---------------------------



This is so wierd Sad
(This post was last modified: 03-05-2012, 09:08 PM by robinnjensen.)
03-05-2012, 08:48 PM
Find
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




Users browsing this thread: 1 Guest(s)