Page 1 of 2
Scriptable pause?
Posted: Sun Jul 16, 2017 7:37 am
by Astrobe
I often play Oolite and a game called "IRL" at the same time. Sometimes IRL has time triggered events, like going to the bathroom or feeding the cat, that require you to put on your Oculus Real for a few minutes.
It's always dangerous to let Oolite run for a few minutes because you don't know what will appear at the edge of the scanner next minute, so you have no choice but pause the game.
The ability to pause the game with a script would be useful in these situations. One could do for instance a script that auto-pauses when the condition turns red, or when you are cleared to dock.
Re: Scriptable pause?
Posted: Mon Oct 23, 2017 6:29 am
by Diziet Sma
I just came across this.. it seems to have faded with no attention paid, despite a considerable number of views.
So for the record, I'm saying this sounds like an excellent idea.. anyone else want to chip in?
Re: Scriptable pause?
Posted: Thu Oct 26, 2017 5:05 pm
by Astrobe
Diziet Sma wrote: ↑Mon Oct 23, 2017 6:29 am
I just came across this.. it seems to have faded with no attention paid, despite a considerable number of views.
Well actually, I believe that crawlers from Google etc. artificially increase that count.
So for the record, I'm saying this sounds like an excellent idea.. anyone else want to chip in?
The feature is still on my TODO list, together with try to do something about the CPU utilization when the game is paused (~20% here).
Re: Scriptable pause?
Posted: Fri Oct 27, 2017 1:22 am
by Diziet Sma
Astrobe wrote: ↑Thu Oct 26, 2017 5:05 pm
Well actually, I believe that crawlers from Google etc. artificially increase that count.
I keep forgetting that on this board, search engine spiders are "registered members".. on most boards they
don't increase the view count.
Re: Scriptable pause?
Posted: Sun Oct 29, 2017 6:56 pm
by hoqllnq
This is in todays nightly.
It is a new Global method
function pauseGame() : Boolean
It does not pause the game on screens that are can normally not be paused by keyboard: mission screens, long range chart, arrival report, save menu. In those cases, the function returns false. Otherwise it pauses the game and returns true.
There is no protection mechanism like timeout or override (should there be?), so it is up to the OXP dev to make sure you don't get in a pause-loop where the script pauses again immediately after the user un-pauses.
Re: Scriptable pause?
Posted: Sun Oct 29, 2017 7:56 pm
by Astrobe
Wow, thanks.
About the protection mechanism, in my humble opinion it's true that a bug in the script could be very annoying, but scripting bugs can ruin the game even with less "imperative" functions anyway.
Re: Scriptable pause?
Posted: Fri Nov 03, 2017 2:31 pm
by Astrobe
Here is a bare-bones script (old OXP format, unzip in AddOns folder).
Buy the "Autopause" equipment (only 1Cr - profits will be shared with Hoqllnq, promised), and if you prime that equipment, the game pauses automatically when condition goes red.
BUT: I've observed keyboard malfunctions after un-pausing. First time it apparently switched to mouse control mode (it might just have been my fat fingers though), the next times the "fire laser" key did not work until I switched views. Tested on PC.
Re: Scriptable pause?
Posted: Sat Nov 04, 2017 10:07 pm
by hoqllnq
Astrobe wrote: ↑Fri Nov 03, 2017 2:31 pm
Have you observed any more of those with the patch I gave you
and have you used it enough to confidently say they are gone?
I have tested in different screens and not found issues.
Thanks.
Re: Scriptable pause?
Posted: Sun Nov 05, 2017 12:16 am
by phkb
Astrobe wrote:Buy the "Autopause" equipment
Kind of breaking the fourth wall here a bit, aren't we? Pausing the game is a meta-command (ie something that the in-game world doesn't understand). But by making it a purchasable item, it's now crossed the boundary between game-world and real-world. Which is a long-winded way of say, I don't think this should be a purchasable item. Although, to be fair, at 1cr it's hardly worth quibbling over, is it? Leave it as it is.
But I really like the concept though! I think this can be a really useful tool for players like me who generally run with the sound off, so don't get audible warnings when red alerts take place. Very handy for when I'm on my way to the sun to scoop some fuel, and I run into an angry mob of pirates courtesy of Space Crowds.
Re: Scriptable pause?
Posted: Sun Nov 05, 2017 4:48 am
by Diziet Sma
phkb wrote: ↑Sun Nov 05, 2017 12:16 am
Astrobe wrote:Buy the "Autopause" equipment
Kind of breaking the fourth wall here a bit, aren't we?
We could always rename it to "Ferris Bueller Equipment", or "Deadpool Device"..
(or maybe just "Save Ferris!")
Re: Scriptable pause?
Posted: Sun Nov 05, 2017 9:35 am
by Astrobe
phkb wrote: ↑Sun Nov 05, 2017 12:16 am
Astrobe wrote:Buy the "Autopause" equipment
Kind of breaking the fourth wall here a bit, aren't we? Pausing the game is a meta-command (ie something that the in-game world doesn't understand). But by making it a purchasable item, it's now crossed the boundary between game-world and real-world. Which is a long-winded way of say, I don't think this should be a purchasable item. Although, to be fair, at 1cr it's hardly worth quibbling over, is it? Leave it as it is.
Well that was just a quirk-and-dirty job. But equipment items are handy because of the mode switch feature, which would let us have different pause criteria.
But I really like the concept though! I think this can be a really useful tool for players like me who generally run with the sound off, so don't get audible warnings when red alerts take place. Very handy for when I'm on my way to the sun to scoop some fuel, and I run into an angry mob of pirates courtesy of Space Crowds.
Someone on IRC called it the "ALT tab" thing (not him but hello, Spalthy876!) so yes, it has more than one uses. The idea of adding mini-games or occupations for when you are masslocked has been discussed several times here; I think this feature partially solves it by letting the player do something else outside of the game - one nice thing about Oolite is that is not too resource-hungry, so you can have other programs running in the background - thus letting us being "productive" while playing. Not the best solution but not a bad one either.
BTW, if someone wants to take over this OXZ, feel free. I have to many things on my todo list already (for instance, I'd like to return to the city lights feature).
Re: Scriptable pause?
Posted: Sun Nov 05, 2017 9:45 am
by Astrobe
hoqllnq wrote: ↑Sat Nov 04, 2017 10:07 pm
Astrobe wrote: ↑Fri Nov 03, 2017 2:31 pm
Have you observed any more of those with the patch I gave you
and have you used it enough to confidently say they are gone?
I have tested in different screens and not found issues.
Thanks.
It triggered several times without issues since. If there's still a bug in there it's probably hiding in an edge case, so it shouldn't be critical. so I think the fix can be submitted to trunk. Let the guinea pigs^H^H beta testers to their job
Re: Scriptable pause?
Posted: Sun Nov 05, 2017 6:18 pm
by hoqllnq
I have two alternative fixes:
https://github.com/jobi-wan/oolite/comm ... 177071ea74
https://github.com/jobi-wan/oolite/comm ... c7e22b19d0
Both do essentially the same thing: They move the pause/resume code form pollFlightControls and pollDockedControls to a place where Global pauseGame can use it too.
The first one moves the pause/resume code to a new method in PlayerEntity(Controls) and adds a PlayerEntity method to call it from outside.
The second one moves pause/resume code to Universe pauseGame/resumeGame. I thought this was going to be cleaner but I ended up needing some new methods to restore the saved state. It may still be nicer to have all the pause/resume in Universe pauseGame/resumeGame.
Re: Scriptable pause?
Posted: Sun Nov 19, 2017 2:34 pm
by Astrobe
I've updated the
auto-pause script/equipment.
Please note that it is now in OXZ format. I can't make it available from the manager yet because I can't require version 1.87 in the manifest.
This version lets you choose between pausing on yellow or red condition with equipment mode key switch 'b'.
Re: Scriptable pause?
Posted: Sun Dec 03, 2017 12:48 pm
by Astrobe
FWIW the version I've uploaded a few weeks ago was borken: switching modes didn't work.
Also, who should I talk to in order to have a 1.87 version tag for the manager?