Frictional Games Forum (read-only)

Full Version: Several Script Questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright, I've got two questions that I'd like to ask, and they're not exactly your "usual" sort of questions.

1. Is it possible to use key-bindings in Amnesia? Like say you wanted a script to run when you pressed "R", is it possible?

2. Is there anyway to put a script in some sort of file, or place where it will be functioning, or checking for when to function in the entire custom story? A bit like how inventory.hps will be keeping check on your inventory the whole game.
I believe these kinds of things can be executed if a full conversion mod is made, but I don't know how :S
(07-23-2012, 07:30 PM)Kreekakon Wrote: [ -> ]1. Is it possible to use key-bindings in Amnesia? Like say you wanted a script to run when you pressed "R", is it possible?
Not really. But there are some hacks you can use. You can sacrifice movement / jumping / crouching / lantern for trapping key presses, as well as interaction in certain situations. I've also heard that in dev-mode the "h" key hurts you, and you could abuse this too.

(07-23-2012, 07:30 PM)Kreekakon Wrote: [ -> ]2. Is there anyway to put a script in some sort of file, or place where it will be functioning, or checking for when to function in the entire custom story? A bit like how inventory.hps will be keeping check on your inventory the whole game.
You could try putting the script in a custom inventory.hps or global.hps file under certain restrictions (I haven't really played about with this, so some experimentation here is a good bet). Failing that, make use of a pre-processor and just stick includes at the start of you script file.
(07-23-2012, 10:27 PM)Apjjm Wrote: [ -> ]Not really. But there are some hacks you can use. You can sacrifice movement / jumping / crouching / lantern for trapping key presses, as well as interaction in certain situations. I've also heard that in dev-mode the "h" key hurts you, and you could abuse this too.
Well, I tried H like you said, and it does hurt you as well as lowering your sanity. But still, how could I abuse this? Aren't the functions of the keys locked inside the engine's source code?
(07-23-2012, 10:32 PM)Kreekakon Wrote: [ -> ]
(07-23-2012, 10:27 PM)Apjjm Wrote: [ -> ]Not really. But there are some hacks you can use. You can sacrifice movement / jumping / crouching / lantern for trapping key presses, as well as interaction in certain situations. I've also heard that in dev-mode the "h" key hurts you, and you could abuse this too.
Well, I tried H like you said, and it does hurt you as well as lowering your sanity. But still, how could I abuse this? Aren't the functions of the keys locked inside the engine's source code?

Sadly, yes. You could have a timer trigging quickly (every 1/60th of a second) which checks for sanity and health damage of the amount the "H" key deals - you can then just restore the health and sanity and fire whatever event you wanted to fire (It is unlikely that some combination of events deals both health and sanity damage similar to the H key could occur). Hacks like this really depend on what you are trying to achieve though.
(07-23-2012, 10:42 PM)Apjjm Wrote: [ -> ]Sadly, yes. You could have a timer trigging quickly (every 1/60th of a second) which checks for sanity and health damage of the amount the "H" key deals - you can then just restore the health and sanity and fire whatever event you wanted to fire (It is unlikely that some combination of events deals both health and sanity damage similar to the H key could occur). Hacks like this really depend on what you are trying to achieve though.
I don't think that would really work out, as the effects of sanity, and health damage caused by H are very visually noticeable, which would be very weird in almost all cases.

I think I might actually be better off with the back up plan I came up with: which is double-clicking F.

EDIT: This also brings up another question that's been bugging me ever since I started scripting. Is there any more efficient way/function BESIDES super fast timer checks that can constantly be checking for occurrences that can change in the map at any given time?
(07-23-2012, 10:48 PM)Kreekakon Wrote: [ -> ]EDIT: This also brings up another question that's been bugging me ever since I started scripting. Is there any more efficient way/function BESIDES super fast timer checks that can constantly be checking for occurrences that can change in the map at any given time?

As mentioned, it depends on what you're trying to do. Many things are handled by callbacks anyway, so calling a generic function at the end of these callbacks is one method you can take. If you're trying to manage player attributes, then a timer is useful.

Of course, you can always wait for HPL3 to come out.