Frictional Games Forum (read-only)
Help needed with .hps scripting - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Help needed with .hps scripting (/thread-8466.html)



Help needed with .hps scripting - planetbomb - 06-05-2011

Ok when I go to test my custom story, I get this message.

FATAL ERROR: Could not load script file
"custom_stories/Escape"/maps/Top_floor-A.hps"!
main (12,2) : ERR : Unexpected end of line


And this the script in the .hps file

////////////////////////////
// Run first time starting map
void OnStart()
{
ddUseItemCallback("", ""doorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, True);
PlaySoundAtEntity("", "unlock_door", "keydoor_1", 0, false);
RemoveItem("doorkey_1");
}



Any help?Huh


RE: Help needed with .hps scripting - Tanshaydar - 06-05-2011

ddUseItemCallback -> AddUseItemCallback
I don't know if AngelScript is case sensitive, but always try to write true instead of True


RE: Help needed with .hps scripting - Apjjm - 06-05-2011

Is that everything in the script file? If it is, then you missed adding in two routines. Also, you missed an "A" on AddUseItemCallback. Try the following:
Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "doorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}

//You missed these:
void OnEnter() {}
void OnLeave() {}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "keydoor_1", 0, false);
RemoveItem("doorkey_1");
}

Hope that helps Smile


RE: Help needed with .hps scripting - planetbomb - 06-05-2011

(06-05-2011, 08:28 PM)Apjjm Wrote: Is that everything in the script file? If it is, then you missed adding in two routines. Also, you missed an "A" on AddUseItemCallback. Try the following:
Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", ""doorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}

//You missed these:
void OnEnter() {}
void OnLeave() {}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "keydoor_1", 0, false);
RemoveItem("doorkey_1");
}

Hope that helps Smile

Well I got rid of those as they were having the same problem, didn't know you needed them.

EDIT: Put them back in and it still won't work.



RE: Help needed with .hps scripting - DannieWest - 06-06-2011

(06-05-2011, 08:17 PM)planetbomb Wrote: Ok when I go to test my custom story, I get this message.

FATAL ERROR: Could not load script file
"custom_stories/Escape"/maps/Top_floor-A.hps"!
main (12,2) : ERR : Unexpected end of line


And this the script in the .hps file

////////////////////////////
// Run first time starting map
void OnStart()
{
ddUseItemCallback("", ""doorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, True);
PlaySoundAtEntity("", "unlock_door", "keydoor_1", 0, false);
RemoveItem("doorkey_1");
}



Any help?Huh


I'm not using the OnEnter and OnLeave ones, script works without them as well, but I suppose they can be good for something, which I haven't learned yet xP
Back to business :p At "AddUseItemCallback" you put 2 "" in front of doorkey_1, that's why it still dun work Smile



RE: Help needed with .hps scripting - planetbomb - 06-06-2011

(06-06-2011, 12:38 AM)DannieWest Wrote:
(06-05-2011, 08:17 PM)planetbomb Wrote: Ok when I go to test my custom story, I get this message.

FATAL ERROR: Could not load script file
"custom_stories/Escape"/maps/Top_floor-A.hps"!
main (12,2) : ERR : Unexpected end of line


And this the script in the .hps file

////////////////////////////
// Run first time starting map
void OnStart()
{
ddUseItemCallback("", ""doorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, True);
PlaySoundAtEntity("", "unlock_door", "keydoor_1", 0, false);
RemoveItem("doorkey_1");
}



Any help?Huh


I'm not using the OnEnter and OnLeave ones, script works without them as well, but I suppose they can be good for something, which I haven't learned yet xP
Back to business :p At "AddUseItemCallback" you put 2 "" in front of doorkey_1, that's why it still dun work Smile

I saw that error as soon as I posted this, but the problem is the "Unexpected end of line"

Thanks anyway



RE: Help needed with .hps scripting - Apjjm - 06-06-2011

Quote:I saw that error as soon as I posted this, but the problem is the "Unexpected end of line"

Thanks anyway
The string not terminating (which is happening because of the two "") will cause that, you know. There really appears to be nothing else after the above fixes.


RE: Help needed with .hps scripting - DannieWest - 06-06-2011

Fail xD Worth a shot xP