Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Save Any Where OXP Version 3.2 [RELEASE]

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Frame wrote:
is this not one of thargoids oxps doing this.
Nope, not guilty yerhonna...

I was going to do it in traffic control, but never did in the end as it didn't fit the tone in the end when the feature was implemented.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Eric Walch wrote:

One other strange thing: When I launch from a F8 screen, the F8 screen is still present on re-docking. When I launch from a F6 screen I re-dock in the F6 screen, but with no stars on it. Pressing F6 brings the stars back. On docking I should always get the F5 screen, so somehow I think you force a re-dock before oolite has registered the launch completely. It might be worth to try docking at a timer at a very short delay giving oolite time to complete all sequences.

....

When you have time to look at the code, you might look at the new ways of adding ships. With the new methods addShips, your code receives a reference back to the added ships, so you can avoid some of the search to just spawned stations. It also saves the check to see if you found the right station. :wink:
Thanks for your efforts, I'll add in a timer instead of doing the actual straight away docking..

in regard to the reference, i tested that back in pree 1.74 days, however no reference.. So thats in now.. cool, will change that..

Cheers Frame...
Bounty Scanner
Number 935
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I found the problem. It seems an Oolite bug and has nothing to do with your oxp. I don't know why it happens to me and not with you. When I run in the console:

Code: Select all

mission.runScreen({titleKey:"Frame_save_oxp_title", model:"pirate"})
Nothing happens but in the log I get:

Code: Select all

[system] Exception raised during posting of notification.  Ignored.  exception: '*** -[NSPlaceholderMutableString initWithString:]: nil argument'  invoked observer method: '*** -[NSTextField textDidEndEditing:]'  observer: 0x21889cd0  notification name: 'NSTextDidEndEditingNotification'
This results in aborting any further code execution. The problem is in titleKey:"Frame_save_oxp_title" When I use title:"Frame_save_oxp_title" instead, everything works.
But others might encounter similar problems so I advise to use "title" instead of "titleKey" until this bug is solved.
I get the bug already when on the main station with a Jameson, so it might any oxp using titleKey.

EDIT: It is not an Oolite bug. Your title does not exist. Or better the missionText.plist has an syntax error resulting in not loading the plist at all. It is just Oolite not anticipating gracefully on this missing key. In your code is a semicolon missing after:

Code: Select all

 "SAVE ANYWHERE OXP"
After adding the semicolon to the plist, I ended up in the seedy bar. I assume my problem will happen on any mac as any mac refuses to load incorrect plists. And still 5000 credits fines for unauthorised docking, even with your new lines added.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Eric Walch wrote:
I found the problem. It seems an Oolite bug and has nothing to do with your oxp. I don't know why it happens to me and not with you. When I run in the console:

Code: Select all

mission.runScreen({titleKey:"Frame_save_oxp_title", model:"pirate"})
Nothing happens but in the log I get:

Code: Select all

[system] Exception raised during posting of notification.  Ignored.  exception: '*** -[NSPlaceholderMutableString initWithString:]: nil argument'  invoked observer method: '*** -[NSTextField textDidEndEditing:]'  observer: 0x21889cd0  notification name: 'NSTextDidEndEditingNotification'
This results in aborting any further code execution. The problem is in titleKey:"Frame_save_oxp_title" When I use title:"Frame_save_oxp_title" instead, everything works.
But others might encounter similar problems so I advise to use "title" instead of "titleKey" until this bug is solved.
That is something i noticed, but I thought it was rather cosmetic, and had not looked into it.. However, it affects another OXP in the works... so titleKey is broken..

title does not work the same way though, I have to enter the exact text that will be shown on the mission screen into the field between the exclamation marks.

again thanks for your efforts :-)
Bounty Scanner
Number 935
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

Post by Kaks »

To be precise, the whole of titleKey isn't quite broken: it's the bit that keeps an eye for possible oxp mistakes that's broken! :P

As long as you enter the correct key, and you plist is actually readable, titleKey does work in 1.74.x.

In this particular case you fed it wrong data, and it spewed gobbledigook. After fixing it, if you feed it the same wrong data it still won't work! :)
However, it will give you a more readable error message! :D
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Frame wrote:
Edit Like this

Code: Select all

this.dockplayer = function()
{
	this.stationfortimer.saveAnywhereLandingClearence = this.stationfortimer.requiresDockingClearance
	this.stationfortimer.dockPlayer()
	this.stationfortimer.requiresDockingClearance = this.stationfortimer.saveAnywhereLandingClearence
}
It was not working, but after a second look I noticed you missed the essential part:

Code: Select all

this.dockplayer = function()
{
	this.stationfortimer.saveAnywhereLandingClearence = this.stationfortimer.requiresDockingClearance
	this.stationfortimer.requiresDockingClearance = false;
	this.stationfortimer.dockPlayer()
	this.stationfortimer.requiresDockingClearance = this.stationfortimer.saveAnywhereLandingClearence
}
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Kaks wrote:
To be precise, the whole of titleKey isn't quite broken: it's the bit that keeps an eye for possible oxp mistakes that's broken! :P

As long as you enter the correct key, and you plist is actually readable, titleKey does work in 1.74.x.

In this particular case you fed it wrong data, and it spewed gobbledigook. After fixing it, if you feed it the same wrong data it still won't work! :)
However, it will give you a more readable error message! :D
stomps and puffs

Code: Select all

mission.runScreen({	titleKey:"Frame_save_title",messageKey:"Frame_SAVE_brief6"	},null	);
missiontext.plist

Code: Select all

{	
	"Frame_SAVE_brief1" = "---SAVE ANYWHERE OXP MESSAGE\n\nGreetings Commander, you now have to save your game manually and press launch, shortly after launch you will be warped back to the OXP station. This will also happen when you load the saved commander file";
	"Frame_SAVE_brief2" = "---SAVE ANYWHERE OXP MESSAGE\n\nGreetings Commander, you have loaded a OXP save anywhere active commander file, you will shortly, in about 20 seconds be taken to the OXP station where you saved the game";
	"Frame_SAVE_brief3" = "---SAVE ANYWHERE OXP MESSAGE\n\nSorry Commander, you cant save in this system, there is no main stations which is a prerequiste";
	"Frame_SAVE_brief4" = "---SAVE ANYWHERE OXP MESSAGE\n\nGreetings Commander, you have selected to save at this OXP station, you will be transfered shortly to the main station";
	"Frame_SAVE_brief5" = "---SAVE ANYWHERE OXP MESSAGE\n\nSorry Commander, you are not allowed to enter this screen at the moment";
	"Frame_SAVE_brief6" = "---SAVE ANYWHERE OXP MESSAGE\n\nCommander, SAVE ANYWHERE ACTIVE COMMANDERFILE\n Configuring system";
	"Frame_SAVE_brief7" = "---SAVE ANYWHERE OXP MESSAGE\n\nCommander, transferring successful";
	"Frame_SAVE_brief8" = "---SAVE ANYWHERE OXP MESSAGE\n\nSorry Commander, You can not save at this OXP station";
	"Frame_SAVE_brief9" = "---SAVE ANYWHERE OXP MESSAGE\n\nSorry Commander, You have loaded a SAVE ANYWHERE OXP commander file.\nBut the OXP containing the station seems not to be installed or is in a non working state";
	"Frame_save_title" = "SAVE ANYWHERE OXP";
	"Frame_save_title2" = "SAVE ANYWHERE OXP"; 
}
well I cannot get it to work, and I know the missiontext.plist file is being read correctly since it still shows the text from the messageKey in the same mission screen..

Eric Walch: thanks for the tip

Cheers Frame...
Bounty Scanner
Number 935
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

Something annoying/hilarious I discovered on accident...I often buy out OXP station commodities without thought of legality. These almost never affect your legal status at least as far as the OXP stations are concerned.
...BUT if you happen to have them in your ship's cargo, and attempt to use Save Anywhere at those OXP stations, you will probably end up a fugitive even if you didn't save game when you did it. (I'm aware this happens because you're sent to the main station to save the game...and the legality status hit occurs when relaunching from the main station after saving.)

I doubt it's worth preventing, but it's probably worth a note in the documentation. :lol:
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Switeck wrote:
I doubt it's worth preventing, but it's probably worth a note in the documentation. :lol:
No need to put that in the documentation. The oxp should "save & restore" the legal status. (ThargoidWar.oxps also does that when responding to a station attack with illegal goods in your hold, so it is solvable by script.)

Same problem with game time: Every extra launch takes 600 seconds. But there is no way to go back in time. Only advancing in time is possible by adding seconds. So, when on a tight delivery you should not save. But when really tight in time for a delivery, you even should not dock at all but get your fuel by sun-skimming.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Legalities will be sorted, it could be done in two ways

Remove cargo and give it back upon Docking..while I'm unsure with my head out the code on how to-do this, or if it is even possible to do it subtle without the player noticing... this does requires an at least 3 elements long array as a mission variable...

The simplest way would properly be to remove and restore bounty, which would need to be a mission variable.

and I do like simple..

Cheers Frame...
Bounty Scanner
Number 935
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

Frame said, "The simplest way would properly be to remove and restore bounty, which would need to be a mission variable."

Sounds good. Free Trade Zone OXP hits you with a small rating fine (5 point offender) when you leave (or is it when you dock?), so that will be fixed also.
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

Post by Kaks »

Frame wrote:
stomps and puffs
:)

Ok, Ok, I'll have a proper look asap! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Frame wrote:
Remove cargo and give it back upon Docking..while I'm unsure with my head out the code on how to-do this, or if it is even possible to do it subtle without the player noticing... this does requires an at least 3 elements long array as a mission variable...
At the start of the process simply go through the manifest and populate an array with the content of the manifest (so you have an array of numbers corresponding to the cargo content of the hold in sequence) and then clear the manifest.

At the end just reverse the procedure and reset the array. It should be quite simple to code. This is the wiki page you want.

Editted to add - hmm, now I think about it, there could be another little OXP in there ;)
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

Release 3.1
Patch to fix bounty issues and certain internal workings
bounty is now correctly handled

http://www.box.net/shared/l6f4mdqvn9
---------------------------------------------------------
Bounty Scanner
Number 935
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Post by Switeck »

I don't know if it's done...but does SaveAnywhere reset your time to cover all the docking/launching?
Post Reply