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 »

EquipmentDestroyed is a bit of a strange beast. It was intended for equipment destroyed by enemy fire, but no amount of enemy fire will destroy any equipment in unrestricted mode.

I'm not convinced about using that event to flag up a side effect of using equimpent the awy it was intended...

However, there might be some reworking of the way equipment is affected by enemy fire for 1.77! :P
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
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:
@Svengali: indeed, and that's in the rapidly growing 1.77 TODO list already! ;)
I still think that even the current state is pretty cool - the list of features is impressive and OXPs have already soooo much possibilities. We only have to use them and if we can manage to avoid clashes the future is bright .-) So whenever this comes as shiny new feature - I'm pretty sure we'll see some more cool new stuff - Oolite rocks!
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 »

About the only other single-shot item I can think of is the Escape Pod...but it already has a mountain of code tied to its behavior, some of which may not be accessible via .js ...like how long the delay is before docking.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Intercepting user key presses

Post by Wildeblood »

Kaks wrote:
@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... :)
Again, although I thought I was clear, the equipment array in a saved game is always sorted alphabetically, so every saved game that has the same equipment will have it in exactly the same order. I would suggest, without testing, that the order in-game depends on the order the associated scripts are successfully loaded? (AAA Aaron Aardvark's Advanced Weapons.OXP)
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 »

Thank you for the extra clarity! :)

This seems to contradict what Switeck's been reporting, so I'm fairly puzzled as to why Switeck would see different things from you... ;)
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 »

All I said was:
"I'm already fighting with a list of 10-20 primable equipment items in no particular order in my most upgraded ship. Even using CTRL+Shift+N to go backwards through the list only helps a little. Doubly sucks that some of my ships have the equipment in different order."

I guess I didn't study it long enough to determine the order. :lol:
While on the subject, the F5 screen does seem to show equipment "in no particular order" (that I can tell) as well. :P
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Re: Intercepting user key presses

Post by Commander McLane »

Switeck wrote:
While on the subject, the F5 screen does seem to show equipment "in no particular order" (that I can tell) as well. :P
Clearly it shows first the built-in equipment and then OXP equipment, I guess in order of OXP name (which is not necessarily the same as the equipment name).
User avatar
GGShinobi
---- E L I T E ----
---- E L I T E ----
Posts: 291
Joined: Tue Dec 25, 2012 7:20 pm

Re: Intercepting user key presses

Post by GGShinobi »

Kaks wrote:
About ecm, you can use the shipHitByECM event handler to figure out which ship activated said ECM: it's not that simple, and it could be prone to errors: create a global variable with a ecm timestamp & blast remaining as a unique identifier, update that variable as the last line inside the event handler.
I didn't find a description for the shipHitByECM event handler in the wiki, but I tried to use it (I made a few modifications to missile spoof.oxp*), and it works! :)

Is there a reason why it is not mentioned in the wiki?

*my modification remove the "auto firing" of the ecm (now I have to do it myself) andI reduced the chance for some missiles to lose their lock on my ship.

EDIT:
Eric Walch wrote:
No idea were you looked, but it is described here on the ship handlers page. And that seems the first place to look for it. And according to the history. I added it 7 Okt 2011.
:shock: errrm... uuuh.... huh??? :? :?: How come I didn't see that?
:oops: SORRY!!! :oops:
Guess I need some sleep :roll: Too much oolite + to less sleep is not good for my brain and my eyes (so it seems) :lol:

EDIT2:
*BTW, my modifications don't work, at least not how they should. I should have read the full post before messing around with it! The missile spoof now also gets activated if another ship fires an ECM, and even worse, it fires up to 4 times for a single ECM! (because of the 4 pulses). And I already wondered why it uses so much fuel! :lol: So I'm thinking now about doing it how Kaks suggested. Hmm, a "whom" would be nice :roll:

EDIT3:
added a primeable equipment instead and made the oxp configurable via global variable:
  • $autoFire:
  • if set to true, all you have to do is buy the equipment. It will automatically launch the flares if a missile is fired at your ship. No priming nescessary / possible.
  • if set to false, you need to manually launch the flares by priming the equipment via shift-n and activating it with n.
[/size]
Last edited by GGShinobi on Mon Jan 21, 2013 7:57 pm, edited 3 times in total.
忍 knowing that enough is enough, you'll always have enough.

Running Oolite 1.77 on Ubuntu Linux 12.04 LTS
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Intercepting user key presses

Post by Eric Walch »

GGShinobi wrote:
I didn't find a description for the shipHitByECM event handler in the wiki, ....
Is there a reason why it is not mentioned in the wiki?
No idea were you looked, but it is described here on the ship handlers page. And that seems the first place to look for it. And according to the history. I added it 7 Okt 2011.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Intercepting user key presses

Post by Diziet Sma »

Kaks wrote:
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.
Did that idea ever get off the ground?
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
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Intercepting user key presses

Post by Cody »

Diziet Sma wrote:
Kaks wrote:
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.
Did that idea ever get off the ground?
This would be useful, even though I don't have too many primable items of kit - it would need to be compact, though. Icons?
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Intercepting user key presses

Post by Tricky »

El Viejo wrote:
Diziet Sma wrote:
Kaks wrote:
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.
Did that idea ever get off the ground?
This would be useful, even though I don't have too many primable items of kit - it would need to be compact, though. Icons?
Would be very helpful to know if I have a fuel tank primed when I have a ship targetted. A bit useless hitting 'M', "Huh? Why isn't a missile winging it's way to that ship. Oh no, I've just wasted 3LY of a fuel pod." Untarget with 'U', reselect with 'Y', retarget with 'R', find enemy ship and line up in sights... :lol:
Post Reply