Manipulating the interface through key presses and events
Moderators: winston, another_commander
Manipulating the interface through key presses and events
Hello Everybody,
My first post/thread has gone so well in under 24 hours, that I have decided to start another one, slightly related, but different enough to warrant a new topic.
My research into the inner workings of Oolite has been minimal in the grand scheme of things, but I want to clarify some of my findings, so anyone willing to help would be greatly appreciated.
First off, are we unable to handle key press events in the javascript engine? I have poured over certain areas of the documentation to no avail, and sadly google is also of little help. Basically, is there a way to trigger a script based simply on a keypress such as hitting the ENTER key. I can understand why this might be difficult and conflict with the key events already in place.
If this is not the case, how are interface manipulating scripts handled. I know that the HyperRadio OXP scripts in a listener for a dance between F7 and F1. Must all listeners be this way, triggered by obscure dance maneuvers over key presses that log global events?
Is it possible to modify the keyconfig plist and construct new events for which your script can listen?
I would like to take a crack at the oolite source code, but my internet connection (being in africa) does not allow such luxury as downloading large (>3 MB) files. Maybe later.
Thoughts?
Cheers!
My first post/thread has gone so well in under 24 hours, that I have decided to start another one, slightly related, but different enough to warrant a new topic.
My research into the inner workings of Oolite has been minimal in the grand scheme of things, but I want to clarify some of my findings, so anyone willing to help would be greatly appreciated.
First off, are we unable to handle key press events in the javascript engine? I have poured over certain areas of the documentation to no avail, and sadly google is also of little help. Basically, is there a way to trigger a script based simply on a keypress such as hitting the ENTER key. I can understand why this might be difficult and conflict with the key events already in place.
If this is not the case, how are interface manipulating scripts handled. I know that the HyperRadio OXP scripts in a listener for a dance between F7 and F1. Must all listeners be this way, triggered by obscure dance maneuvers over key presses that log global events?
Is it possible to modify the keyconfig plist and construct new events for which your script can listen?
I would like to take a crack at the oolite source code, but my internet connection (being in africa) does not allow such luxury as downloading large (>3 MB) files. Maybe later.
Thoughts?
Cheers!
"Any sufficiently advanced technology is indistinguishable from magic." -Arthur C. Clarke's Third Law of Prediction
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Brief answer is that no, we cannot handle keypress events from within Oolite's JavaScript API. I believe the best that can be done is check for some specific keypresses indirectly, using the switch screens events, in a way similar to what you refer to as keyboard dance. I think there could also be some security related concerns if we somehow allow keypress events to be triggered. Anyway, the current SpiderMonkey does not give us this capability.
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Hi, unteer! And first of all welcome to the boards, and of course to this great game!
And let me take this opportunity to extend a special welcome to another East African resident! (I am located roughly 900 km west-north-west from you).
To your question: No, there is currently no way to detect keypresses by script, and AFAIK there are no plans into that direction. (EDIT: a_c beat e to that one.) Only the engine itself can handle keypresses. One reason is that so many of us scripters would like to get our hands on keypress-listening, but who would decide to which new functions the (rare) spare keys would be assigned? And who would sign the "Sorry, your request for a keypress was the 15th, but we have only 14 keys at our disposal."-letters?
Therefore there are only workarounds. One used by some scripts is to create a pylon-mounted special equipment, which, if fired like a missile, causes the script to do what you want. Drawback: Each of this quasi-keypresses costs the player one of his valuable missile pylons.
The other workaround is more elegant: convince the developers to include your functionality into the next release of Oolite itself (has happened before, in case of the Advanced Navigational Array; or with the yaw-keys). Although that ain't easy, of course.
And let me take this opportunity to extend a special welcome to another East African resident! (I am located roughly 900 km west-north-west from you).
To your question: No, there is currently no way to detect keypresses by script, and AFAIK there are no plans into that direction. (EDIT: a_c beat e to that one.) Only the engine itself can handle keypresses. One reason is that so many of us scripters would like to get our hands on keypress-listening, but who would decide to which new functions the (rare) spare keys would be assigned? And who would sign the "Sorry, your request for a keypress was the 15th, but we have only 14 keys at our disposal."-letters?
Therefore there are only workarounds. One used by some scripts is to create a pylon-mounted special equipment, which, if fired like a missile, causes the script to do what you want. Drawback: Each of this quasi-keypresses costs the player one of his valuable missile pylons.
The other workaround is more elegant: convince the developers to include your functionality into the next release of Oolite itself (has happened before, in case of the Advanced Navigational Array; or with the yaw-keys). Although that ain't easy, of course.
thanks everyone again for being so helpful. I have been pleasantly suprised by the friendliness of the folks on these boards and in the cOomunity. I just won't mention operating systems here because that seems to evoke ire in even the best of us on the web, no matter the circumstances.
So Oolite runs Spidermonkey eh? A complete version of it or modularized? Duly noted
On the note of the missiles, and sorry that this is a total newb question, but can you select which missile to fire? I am not completely opposed to this method, but in general i don't think my system is going to work anyways if there is zero way to intercept key presses.
So Oolite runs Spidermonkey eh? A complete version of it or modularized? Duly noted
On the note of the missiles, and sorry that this is a total newb question, but can you select which missile to fire? I am not completely opposed to this method, but in general i don't think my system is going to work anyways if there is zero way to intercept key presses.
"Any sufficiently advanced technology is indistinguishable from magic." -Arthur C. Clarke's Third Law of Prediction
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Yes, if you have bought the Multi Targeting System (vanilla Oolite equipment item).unteer wrote:On the note of the missiles, and sorry that this is a total newb question, but can you select which missile to fire?
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
- Diziet Sma
- ---- E L I T E ----
- Posts: 6312
- Joined: Mon Apr 06, 2009 12:20 pm
- Location: Aboard the Pitviper S.E. "Blackwidow"
Hi unteer, and welcome to the boards! So far as operating systems go, we have Macintosh, WinPC and Linux users all happily co-existing and, surprising as it may seem, actively co-operating and assisting each other.. so feel free to mention OS if you see fit...unteer wrote:I just won't mention operating systems here because that seems to evoke ire in even the best of us on the web, no matter the circumstances.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
- Disembodied
- Jedi Spam Assassin
- Posts: 6885
- Joined: Thu Jul 12, 2007 10:54 pm
- Location: Carter's Snort
Yes, it's the Commodore 64 – ZX Spectrum feuds you've got to watch out for!Diziet Sma wrote:So far as operating systems go, we have Macintosh, WinPC and Linux users all happily co-existing and, surprising as it may seem, actively co-operating and assisting each other.. so feel free to mention OS if you see fit...
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
Quite the contrary here - Oolite started on a Mac and was ported to Linux and PC - lots of people discover quirks in Oolite caused by one OS/Platform but not found in the others (tricky for one OS oxp developers) and different OS users usually dive in to beta test for OXP creators.unteer wrote:thanks everyone again for being so helpful. I have been pleasantly suprised by the friendliness of the folks on these boards and in the cOomunity. I just won't mention operating systems here because that seems to evoke ire in even the best of us on the web, no matter the circumstances.
So Oolite runs Spidermonkey eh? A complete version of it or modularized? Duly noted
On the note of the missiles, and sorry that this is a total newb question, but can you select which missile to fire? I am not completely opposed to this method, but in general i don't think my system is going to work anyways if there is zero way to intercept key presses.
Me, I run Oolite on XP, Vista, Ubuntu (Gutsy and Jaunty) - in my 3 years on the board (ok, I had a year off in the middle!) I've never seen any flaming concerning OS or platform and even the vaguest of trolling is done in jest or is very quickly squished.
So fear not, the only things that get BBQ'd here are trumbles and spammers.
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
- Diziet Sma
- ---- E L I T E ----
- Posts: 6312
- Joined: Mon Apr 06, 2009 12:20 pm
- Location: Aboard the Pitviper S.E. "Blackwidow"
Not to mention the "BBC: the original and the best" proponents!Disembodied wrote:Yes, it's the Commodore 64 – ZX Spectrum feuds you've got to watch out for!Diziet Sma wrote:So far as operating systems go, we have Macintosh, WinPC and Linux users all happily co-existing and, surprising as it may seem, actively co-operating and assisting each other.. so feel free to mention OS if you see fit...
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
<OT>
PS: My only regret is never to have driven a C5!
PPS: Normal transmissions will be resumed shortly.
</OT>
Speccy forever!!!one!!!1one!!!Disembodied wrote:Yes, it's the Commodore 64 – ZX Spectrum feuds you've got to watch out for!
PS: My only regret is never to have driven a C5!
PPS: Normal transmissions will be resumed shortly.
</OT>
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Even with out that pressing 'Y' allows you to cyle through missles in order to choose which will be fired next.Commander McLane wrote:Yes, if you have bought the Multi Targeting System (vanilla Oolite equipment item).unteer wrote:On the note of the missiles, and sorry that this is a total newb question, but can you select which missile to fire?