Just a thought.......would it be possible to link suitable audio messages to the type of missile as part of a custom sounds type OXP? or within the missile analyser OXP?
Like "Oh, look. Soft top (unHardened Missile) incoming... when are you wanting to ECM?"
or
"Holy Giles!!! Incoming Q-missile!"
Just a thought.......would it be possible to link suitable audio messages to the type of missile as part of a custom sounds type OXP? or within the missile analyser OXP?
When the next release of oolite is out then 100% Yes.
it is allready possible,, but it is in a cheating kind of way, by using some functions that are meant to play music... however, it also means, that any music played will be stopped and that overlapping messages will cutoff each other, since only one track can be played at any one time...
it would prolly work similar to the hyper-radio config file setup...
This is my first oxp to be adapted to Oolite 1.72 The current version is still functional with Oolite 1.72 but writes warnings to the log about changed names.
For this version I added a remove equipment option. Now you can remove the analyser at systems of the same technical level as where you bought it. For this equipment not very useful as you can also just remove the oxp itself when you want the Missile Analyser to disappear. But it is example code how to remove equipment with the new handler in Oolite 1.72
Okay, actually it took me a little more time to figure out that playerBoughtEquipment isn't fired when the equipment costs 0 (would like to get an explanation for that behaviour; is the handler somehow bound to player.credits)?
The bad news is (for the Missile Analyser as well, I'm afraid) that the refund isn't paid. Perhaps the internal routine that decreases player.credits when you buy something, gets in the way of the player.credits += whatever in the script?
Okay, actually it took me a little more time to figure out that playerBoughtEquipment isn't fired when the equipment costs 0 (would like to get an explanation for that behaviour; is the handler somehow bound to player.credits)?
Explanation: If the credits before you buy equipment are equal to the credits after you've bought it (this is effectively how it is written in the code that the equipment you try to buy costs 0 Cr), then Oolite does not do anything (well, it does play the boop.ogg soundfile). The event handler is fired only if your credits amount has changed after the transaction. I think it makes sense this way. This is how Oolite has always treated equipment buying. But it would be very easy to change it so that a zero credit transaction is considered buying and have the handler firing anyway.
It's not true that Oolite doesn't do anything. Specifically, the equipment that costs 0 cr does disappear from the F3-screen and appear one the F5-screen. So the transaction is actually made. Only the handler doesn't fire.
Any idea on the other problem, that the financial transaction within the handler is ignored? Eric's code is like this
It's not true that Oolite doesn't do anything. Specifically, the equipment that costs 0 cr does disappear from the F3-screen and appear one the F5-screen. So the transaction is actually made. Only the handler doesn't fire.
Yes, the transaction appears to be happening, but at the end it is not considered as done. You will note that the boop sound does play. I think you are right, though, after a very quick check, it does look like a bug.
I play with sound off, so I didn't notice. And in the end I left the station with all my equipment and a whole lot of "Sell foo"-equipment items in my inventory.
And for the other issue: Never mind. I found out that the refund is actually paid. It just doesn't appear in the line stating your credits on top of the screen. The costs of the item, however, do appear. (Credits are decremented, but not increased. So you have to switch to another screen before you see the refund on your account.
It would be nice, however, if something could be done to change this. For instance, in the end of the playerBoughtEquipment-routine there could be a command to redraw the current screen, updating all the changes made by the various scripts that use playerBoughtEquipment. Is that doable?
and mine very similar (of course), but the player.credits += 14000 is not executed.
By the way, Eric: The equipment description mentions a refund of 15000, not 14000.
My mistake not to check if credits were actually raised. I just checked if the equipment was added/removed at the right way.
The value was my mistake. I changed it from 14000 to 15000 but forgot to change it at both places.
That it is not working with 0 credits I didn't try. I just ask 20 credits for removal (Is handled by oolite) and award the 14000 cr by script.
I noticed that oolite also asked 20 credits for missile removal and assumed it is not foreseen to have 0 cr equipment.
What I did notice is that when equipment becomes available by the handler it is not shown on the screen. Switching back/for to an other screen solves this.
Last edited by Eric Walch on Thu Nov 06, 2008 11:37 am, edited 1 time in total.
What I did notice is that when equipment becomes available by the handler it is not shown on the screen. Switching back/for to an other screen solves this.
Yes. If you buy a missile analyser, the removal option as added instantly. However, if you buy the removal, the missile analyser is not added until you switch screens. That's true for my equipment-removals as well.
Therefore my question whether it is possible to modify the handler itself in a way that after all scripts are executed, the screen is drawn again (which is more or less how the internal equipment-buying works, I guess). Possible?
What I did notice is that when equipment becomes available by the handler it is not shown on the screen. Switching back/for to an other screen solves this.
Yes. If you buy a missile analyser, the removal option as added instantly. However, if you buy the removal, the missile analyser is not added until you switch screens. That's true for my equipment-removals as well.
Therefore my question whether it is possible to modify the handler itself in a way that after all scripts are executed, the screen is drawn again (which is more or less how the internal equipment-buying works, I guess). Possible?
Maybe it would be better to implement a equivalent function in JS to the legacy setGuiToxyzScreen so the script could use it after doing all other things. This would also be useful for Eric's UPS and for my coming Vector.
Therefore my question whether it is possible to modify the handler itself in a way that after all scripts are executed, the screen is drawn again (which is more or less how the internal equipment-buying works, I guess). Possible?
Yes, it is not updating everything now. But nobody who just has sold something wants to buy it back immediately, so there is no real problem. That the credits are not updated on the same screen is a little more noticeable.
On my bug with the wrong refund: I uploaded a new version 1.1.1 were you do get 15000 credits back as promised in the equipment description. (and not 14000. We poor salesmen. When we try to earn an additional 100 credits, customers immediately notice nowadays.)