Scripting requests

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

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: Scripting requests

Post by Cody »

It was only a flippant response, is all... ignore.
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
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Scripting requests

Post by Capt. Murphy »

Hi,

Requesting station.hasShipyard : Boolean (read/write) (read only for mainStations) to give the result of shipdata key has_shipyard.

Thanks.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
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: Scripting requests

Post by Commander McLane »

Capt. Murphy wrote:
Hi,

Requesting station.hasShipyard : Boolean (read/write) (read only for mainStations) to give the result of shipdata key has_shipyard.
I think read only should be fine for all stations.

All stations in my OXPs either deliberately have a shipyard, or they deliberately don't. I see no reason why this should be changed after the fact.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: Scripting requests

Post by another_commander »

I think I agree with McLane on this one. hasShipyard added as read-only property to the OOJSStation class on r4980.
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: Scripting requests

Post by Capt. Murphy »

Thanks,

The reason for read/write is because it can be a fuzzy boolean in shipdata.plist, and I was after a way of ensuring that if an OXP station in a particular system had a shipyard on a visit to that system/station, on a return visit the OXP station would still have a shipyard. I can work around it though if you really think it's a bad idea to make it read/write.
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Scripting requests

Post by Switeck »

Maybe a mission/campaign forces you to use a certain ship? You can't exactly sell it if there's no shipyard. :lol:
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Switeck wrote:
Maybe a mission/campaign forces you to use a certain ship? You can't exactly sell it if there's no shipyard. :lol:
Easier there would be to use guiScreenChanged and mission.runScreen to cancel the shipyard screen.
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: Scripting requests

Post by Commander McLane »

Capt. Murphy wrote:
The reason for read/write is because it can be a fuzzy boolean in shipdata.plist, and I was after a way of ensuring that if an OXP station in a particular system had a shipyard on a visit to that system/station, on a return visit the OXP station would still have a shipyard. I can work around it though if you really think it's a bad idea to make it read/write.
That's a reason I can understand. Consistency is a worthwhile goal. It would be interesting to know, though, how many OXP stations are actually making use of a fuzzy boolean in the first place.

I have to admit that I wasn't aware of the possibility of fuzzy booleans for has_shipyard when I responded rather instinctively. I had in mind that a certain station either would or wouldn't have a shipyard for good reasons. At the same time I am wary of a new generation of OXP-creators and a tendency to use every provided scripting ability for quick-and-dirty cheat OXPs under the flag of "if it can be done, it cannot be wrong". A development which—for me, at least—tends to make Oolite less and less attractive. Thus I'm not overly keen on making everything writeable.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: Scripting requests

Post by Svengali »

Switeck wrote:
Maybe a mission/campaign forces you to use a certain ship? You can't exactly sell it if there's no shipyard. :lol:
Heh .-) I'd think it's a bug in the offering OXP then .-)

If a station is designed to have no shipyard it shouldn't be possible to force it via script to have one, so I'm with CMcL.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Scripting requests

Post by Switeck »

Ah, I was looking for removal of the offending shipyard...not ADDING one where there shouldn't be.

cim's suggestion of: "Easier there would be to use guiScreenChanged and mission.runScreen to cancel the shipyard screen."
...works just as well, which is very similar to what is done in Galactic_Misjump_0.3.zip to prevent the player from seeing the Short range chart.

However making a readable variable (to scripts) as to whether a station HAS a shipyard seems handy. Hardly a potential exploit that way.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Wildeblood wrote:
Can we have the player ship cross-hairs dictionary/file changeable, the same way the HUD file is, please? Currently, to alter the cross-hairs on the fly, one has to embed the cross-hairs dictionary in a HUD file and switch the whole HUD file. It's easily done, but can cause a rapid proliferation of HUD files.
This should be working as of the current nightly build (r5016). Let me know if you have any problems with it.

Crosshair definitions go in a file in Config with the same format as the built-in crosshairs.plist and an arbitrary (should-be-unique) name.
To apply a crosshair definition file to a HUD:
- give the HUD a "crosshair_file" parameter with the filename.
- set player.ship.crosshairs to the filename by script

HUD plists can have both "crosshair_file" and "crosshairs" keys: if so, the "crosshair_file" key takes precedence.

If you change player.ship.hud, then player.ship.crosshairs will be reset to the new HUD's default.

If the HUD default crosshair is in place and not generated through "crosshair_file", then player.ship.crosshairs will be null. Setting player.ship.crosshairs to be null will revert the HUD to its default crosshairs (however they were specified).
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: Scripting requests

Post by Wildeblood »

Thanks cim.

I just compiled r5016 from source and it doesn't have the version number display in the top-right of the screen, is that to be expected?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6682
Joined: Wed Feb 28, 2007 7:54 am

Re: Scripting requests

Post by another_commander »

Wildeblood wrote:
I just compiled r5016 from source and it doesn't have the version number display in the top-right of the screen, is that to be expected?
It is normal. In order to have the watermark text as it appears on the nightlies, you must compile using make release-snapshot
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Wildeblood wrote:
I just compiled r5016 from source and it doesn't have the version number display in the top-right of the screen, is that to be expected?
That will only appear if SNAPSHOT_BUILD was set as a build option. The "release-snapshot" build target (and equivalents for deps and debian package) set it, the others don't.
User avatar
CommonSenseOTB
---- E L I T E ----
---- E L I T E ----
Posts: 1397
Joined: Wed May 04, 2011 10:42 am
Location: Saskatchewan, Canada

Re: Scripting requests

Post by CommonSenseOTB »

cim wrote:
Wildeblood wrote:
Can we have the player ship cross-hairs dictionary/file changeable, the same way the HUD file is, please? Currently, to alter the cross-hairs on the fly, one has to embed the cross-hairs dictionary in a HUD file and switch the whole HUD file. It's easily done, but can cause a rapid proliferation of HUD files.
This should be working as of the current nightly build (r5016). Let me know if you have any problems with it.

Crosshair definitions go in a file in Config with the same format as the built-in crosshairs.plist and an arbitrary (should-be-unique) name.
To apply a crosshair definition file to a HUD:
- give the HUD a "crosshair_file" parameter with the filename.
- set player.ship.crosshairs to the filename by script

HUD plists can have both "crosshair_file" and "crosshairs" keys: if so, the "crosshair_file" key takes precedence.

If you change player.ship.hud, then player.ship.crosshairs will be reset to the new HUD's default.

If the HUD default crosshair is in place and not generated through "crosshair_file", then player.ship.crosshairs will be null. Setting player.ship.crosshairs to be null will revert the HUD to its default crosshairs (however they were specified).
:D Very nice cim. So with this I can switch crosshairs on the current hud just by referring to a unique named .plist file in Config. That should be very useful. Updating to latest trunk now. :D
Take an idea from one person and twist or modify it in a different way as a return suggestion so another person can see a part of it that can apply to the oxp they are working on.


CommonSense 'Outside-the-Box' Design Studios Ltd.
WIKI+OXPs
Post Reply