Intercepting user key presses

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Intercepting user key presses

Post by Kaks »

I believe the energy bomb - the player-only super weapon - is not going to be actively supported in versions after 1.76, as already mentioned quite a few times IIRC, but for other player actions I believe there's an event that js can react to. All NPCs events, again IIRC, are also available for scripts to interact with. If there are events we missed, do please tell us.

And yes, having 10 or more primable items on board is quite unwieldly.
There was some thought of limiting the amount of primable equipment on a per-ship basis, analogous to the way missile slots work, including a 'sell all primable equipment' option when in the F3 screen. It's an option we might revisit... :)

Anyway, one thing that is very likely to happen in trunk is the addition of a new HUD 'dial' to specifically display the primed equipment name, rather than relying on the player remembering which equipment was primed while in the middle of a fight.


Finally, each piece of equipment is a customisation to your ship, and I believe the order you bought your custom equipment influences the order your equimpent is shown to you. Each ship gets extra individuality this way, which is - in my opinion - a fairly good thing.
Mind you, if what you're saying is that the order of primable equipment changes randomly from savegame to savegame then that would be a bug, and we'll try and investigate what's going on there.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Intercepting user key presses

Post by Switeck »

The energy bomb needs to stay in strict mode if nothing else. :P

I don't believe the order is changing from reload to reload, but I'm not sure the order follows the order I bought the equipment in. :(
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Re: Intercepting user key presses

Post by Cmdr. Maegil »

Other reasons for wanting to intercept key presses could be for instance to:

-answer to queries or comply with an order to power down the weapons;

-if the player is already injecting away but the throttle increase or the jump drive are still being pressed, the engine could be forced into overload - increasing the speed, but putting the engine and the whole ship at severe risk of imminent damage or destruction;

-or even to fire simultaneously the main weapon and additional scripted laser subentities - a true multi laser.

These are just some quick thoughts, I'm certain the fertile minds that abound in this August forum can come up with many more.
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Re: Intercepting user key presses

Post by DaddyHoggy »

Kaks wrote:
I believe the energy bomb - the player-only super weapon - is not going to be actively supported in versions after 1.76, as already mentioned quite a few times IIRC, but for other player actions I believe there's an event that js can react to. All NPCs events, again IIRC, are also available for scripts to interact with. If there are events we missed, do please tell us.

And yes, having 10 or more primable items on board is quite unwieldly.
There was some thought of limiting the amount of primable equipment on a per-ship basis, analogous to the way missile slots work, including a 'sell all primable equipment' option when in the F3 screen. It's an option we might revisit... :)

Anyway, one thing that is very likely to happen in trunk is the addition of a new HUD 'dial' to specifically display the primed equipment name, rather than relying on the player remembering which equipment was primed while in the middle of a fight.


Finally, each piece of equipment is a customisation to your ship, and I believe the order you bought your custom equipment influences the order your equimpent is shown to you. Each ship gets extra individuality this way, which is - in my opinion - a fairly good thing.
Mind you, if what you're saying is that the order of primable equipment changes randomly from savegame to savegame then that would be a bug, and we'll try and investigate what's going on there.
Could a "list" be saved in the save file - so you go to a Primeable-equipment sub-screen (somewhere!) arrange your equipment (like a BIOS bootlist) and then this is saved to the save file, so next time your equipment is always in the order you want it?
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Intercepting user key presses

Post by Kaks »

One at a time, please! :D

@Switeck: OXPs don't work in strict mode, so there's no need for oxps to react to strict mode only stuff.

@Cmdr. Maegil:

- I thought there already was an event triggered by securing/unsecuring weapons, but maybe not. And I thought you can already tell when the injector key is pressed, I seem to (mis-?)remember BGS doing something in that regard...

And hopefully the fertile minds abounding in this august forum will also come up with innovative ways to solve as-yet-unspecified issues! The js api being relatively new, only a handful of (amazing, IMO) OXPs do more than just scratch the surface of what's actually possible, and - in any case - there's nothing to stop people from contributing to trunk - that's how I became a developer! ;)

@Daddy Hoggy: sure, that's already what's happening inside the save file, and you can use a text editor to swap things 'round, unless I'm very, very much mistaken.
A rearrange primable equipment and/or missiles sub screen is yet to be written, and might not see the light of day with the present GUI code, but maybe someone less timid than me will provide the code for such a thing...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Re: Intercepting user key presses

Post by Cmdr. Maegil »

Kaks wrote:
I thought there already was an event triggered by securing/unsecuring weapons, but maybe not. And I thought you can already tell when the injector key is pressed, I seem to (mis-?)remember BGS doing something in that regard...
My point is that a lot of options would open if the controls themselves could be used as input for JS. I believed these ideas impracticable for lack of handlers, but as I said, these are just loose ideas for anyone who likes them to work upon when, or if ever, they become possible.

In the example above, the origin was in HPA2 when Norman Mosser jury-rigged the Azure Sunset's jump drive to force jump even under mass lock - causing a "spacequake" that wiped out the pursuing Federal fleet and nearly destroyed his own ship, but allowed him to escape.
Gamewise, this could translate as the possibility to intentionally force a mass-lock release by simultaneously activating the injectors, the jump drive and trying to accelerate - predictably resulting in damage to the drive, and whatever additional mayhem the OXPer might devise.
The js api being relatively new, only a handful of (amazing, IMO) OXPs do more than just scratch the surface of what's actually possible, and
JS is still new, but it's also what permits OXPs to go further both in imagination and immersion... It's indeed a precious tool!
And hopefully the fertile minds abounding in this august forum will also come up with innovative ways to solve as-yet-unspecified issues! (...) in any case - there's nothing to stop people from contributing to trunk - that's how I became a developer! ;)
There is one thing, and an important one - the knowledge. I wish I could help, and undoubtedly so do many others, but you know what they say about teaching new tricks to old dogs; to boot, programming is often too hard a trick...
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Intercepting user key presses

Post by Svengali »

Kaks wrote:
And yes, having 10 or more primable items on board is quite unwieldly.
There was some thought of limiting the amount of primable equipment on a per-ship basis, analogous to the way missile slots work, including a 'sell all primable equipment' option when in the F3 screen. It's an option we might revisit... :)
I'd guess a multi-EQ script could help too, similiar to the CCL_Comms script, and would shorten the list. Could be splitted into categories, etc... for faster access. It only needs someone to write it .-)
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2457
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Intercepting user key presses

Post by Wildeblood »

Kaks wrote:
@Daddy Hoggy: sure, that's already what's happening inside the save file, and you can use a text editor to swap things 'round, unless I'm very, very much mistaken.
You're very, very much mistaken. There's no separate list of prime-able equipment in a save-game file*, only the main list of equipment keys, which are always sorted into alphabetical order. Prime-able equipment appears listed in the order it is purchased/awarded, but when re-loading a saved game that order must be lost. That sucks, man.

* Unless it's hidden among the trumbles, or something.

Addendum: Just tried it to make sure, using a save-game with about 15 prime-able items where I know what order they were in yesterday. They come up in a scrambled, random order when re-loading a saved game.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Intercepting user key presses

Post by Switeck »

Kaks wrote:
@Switeck: OXPs don't work in strict mode, so there's no need for oxps to react to strict mode only stuff.
It seems a shame to convert the energy bomb from its own special key to using the same activation key as all other primable equipment. And this is what will happen (it will be made into an OXP) if it's totally removed. If it's just set to strict mode only, an OXP can undo that as far as I know...and my point still stands. :lol:

But besides that very marginal example that I came up with at the spur of the moment and now dominates my responses, a lot of options would open if the controls themselves could be used as input for JS. CCL is really marginal for entering "keycodes" (security passes, passwords, etc) or a calculator-like function OXP.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Intercepting user key presses

Post by Thargoid »

One thought, you could just check if the player is equipped with it via a timer, and then act accordingly if the status changes from yes to no (ie it's been used). Need to be a little careful though as I think some OXPs remove it (Random Hits or Assassins I think, and perhaps others).

Also as a total flier (as I'm not near a machine with the game installed to check) - does using the energy bomb (or any other piece of equipment which is a single-shot, like the galactic hyperdrive) trigger an equipmentDamaged or more likely an equipmentDestroyed event when activated? And if not, should it (probably destroyed)?
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Intercepting user key presses

Post by Svengali »

Switeck wrote:
CCL is really marginal for entering "keycodes" (security passes, passwords, etc) or a calculator-like function OXP.
CCL contains a ([EliteWiki] documented) keyboard since the first released version (used in OXPConfig, Vector and Cabal_Common_MaterialsFinder).
As it is using a model it is limited to player.ship.docked. And mouse support is also not available, but already requested.
User avatar
DaddyHoggy
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 8515
Joined: Tue Dec 05, 2006 9:43 pm
Location: Newbury, UK
Contact:

Re: Intercepting user key presses

Post by DaddyHoggy »

Switeck wrote:
It seems a shame to convert the energy bomb from its own special key to using the same activation key as all other primable equipment. And this is what will happen (it will be made into an OXP) if it's totally removed. If it's just set to strict mode only, an OXP can undo that as far as I know...and my point still stands. :lol:
OXPs don't/can't run in strict mode - or have I misunderstood the statement.

(PS it's been a long time since I played in strict mode - so if my above statement is true - I'm presuming cool visual stuff - like the Griff's ships wouldn't work either?)
Selezen wrote:
Apparently I was having a DaddyHoggy moment.
Oolite Life is now revealed here
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Intercepting user key presses

Post by Switeck »

I don't mean running the game in strict mode.

I meant the coding in equipment.plist:

Code: Select all

strict_mode_only = true;
An OXP can change that to false so that equipment will be available NOT in strict mode.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: Intercepting user key presses

Post by Kaks »

Switeck wrote:
It seems a shame to convert the energy bomb from its own special key to using the same activation key as all other primable equipment. And this is what will happen (it will be made into an OXP) if it's totally removed. If it's just set to strict mode only, an OXP can undo that as far as I know...and my point still stands. :lol:

But besides that very marginal example that I came up with at the spur of the moment and now dominates my responses, a lot of options would open if the controls themselves could be used as input for JS. CCL is really marginal for entering "keycodes" (security passes, passwords, etc) or a calculator-like function OXP.
Be as it may, in the future we're not expecting the energy bomb in unrestricted mode, so we're not going out of our way just to support oxp interactions with it.

Back to js and key presses: it seems you're asking for a sensible way of allowing all oxps access to all the keys, and somehow avoid conflicts between all oxps wanting to react in different and possibly conflicting ways to - say - pressing the letter w. That's a lot easier said than done, but if anyone wants to code such a thing, please do! In other words, you're more than welcome to submit such a patch! :)

@Wildeblood: does the scrambled order change every time you load the savegame, or is the scrambled order the same scrambled order every time? I believe Switeck said that for him the scrambled order is consistent per savegame, but different savegames result in different scrambled orders... :)

@Thargoid: galactic jumps can easily be detected via js already, so that problem's already solved! :)

@Svengali: indeed, and that's in the rapidly growing 1.77 TODO list already! ;)

@DH: that's right. Strict mode - no BGS or Griff ships, no buying other ships, no contracts & passengers, no a bunch of other stuff! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Intercepting user key presses

Post by Thargoid »

Kaks wrote:
@Thargoid: galactic jumps can easily be detected via js already, so that problem's already solved! :)
I know, but it was the only other single-use item I could think of offhand. And if such situations triggered the equipmentDestroyed event, then it should apply for all such.
Post Reply