Oolite Bulletins

For information and discussion about Oolite.
It is currently Fri Dec 15, 2017 9:38 pm

All times are UTC




Post new topic  Reply to topic  [ 56 posts ]  Go to page 1 2 3 4 Next
Author Message
PostPosted: Sat Jul 14, 2012 11:54 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Wed May 20, 2009 6:48 pm
Posts: 603
Location: Somewhere off the top left of Galaxy 1 map
This thread is for discussing best practice in scripting and OXP development in general. The aim is that the results of this discussion get migrated to the [EliteWiki] wiki in a clear and central location so that OXP developers have a single resource for:
  • How to layout scripts and plists for easier reading and debugging.
  • Basic dos and don't.
  • Efficient programming techniques.
  • Applying Oolite specific methods that improve OXPs.
  • Creating compatibility between OXPs.
  • Reusing other OXP resources to prevent remaking the wheel.
Hopefully this thread will be made sticky.

Edit: 21/7/12 added from this post:

Additional topics:
  • Correct packing of the OXP. Including documentation and Change Logs files.
  • Version numbering.
  • Licensing & copyrights.
  • Documentation writing.
  • Wiki entries for OXP.

_________________
Chat and relax with other commanders in the [url=irc://irc.oftc.net/oolite]DS's Seedy Space Bar[/url]. The Coolest Bar in the Eight.

Phantor's OXPs: [EliteWiki] GalCop Rewards and [EliteWiki] Safe Docking


Last edited by PhantorGorth on Sat Jul 21, 2012 12:40 pm, edited 1 time in total.

Top
   
PostPosted: Sat Jul 14, 2012 12:01 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Wed May 20, 2009 6:48 pm
Posts: 603
Location: Somewhere off the top left of Galaxy 1 map
Well the first thing we have is from this post from Ahruman:
Quote:
After browsing through those examples, I don’t see anything they’re consistently doing differently from the built-in scripts other than bad habits:
  • Most of them aren’t using strict mode ("use strict"; at the top of the file). This means slower code and less bug checking.
  • Many scripts fail to make use of spacing, comments and consistent indentation to keep the code readable.
  • There are a great deal of custom functions which are not differentiated from callbacks used by the game. Our recommendation is that internal script functions have names beginning with _ or $.
Moderator: added documentation link for strict mode

_________________
Chat and relax with other commanders in the [url=irc://irc.oftc.net/oolite]DS's Seedy Space Bar[/url]. The Coolest Bar in the Eight.

Phantor's OXPs: [EliteWiki] GalCop Rewards and [EliteWiki] Safe Docking


Top
   
PostPosted: Mon Jul 16, 2012 3:48 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Fri Nov 26, 2010 9:08 pm
Posts: 1044
Location: Help! I'm stranded down here on Earth!
.....


Last edited by SandJ on Mon Jul 16, 2012 7:11 pm, edited 1 time in total.

Top
   
PostPosted: Mon Jul 16, 2012 4:05 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Jun 11, 2011 6:07 am
Posts: 2161
Location: Western Australia
Quote:
- the don't-use-Notepad issue (which I cannot replicate for some reason)
Probably because it's just a myth. Microsoft adopted unicode with Windows XP - if you're still using Windows 98, go away.
Quote:
- case sensitivity in file names in Linux;
- the fussiness of Macs around ";" usage;
Inferior file-name parsing in non-unix-derived OSes.
Inferior property list parsing in non-Mac OSes.


Top
   
PostPosted: Mon Jul 16, 2012 4:16 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Fri Nov 26, 2010 9:08 pm
Posts: 1044
Location: Help! I'm stranded down here on Earth!
.....


Last edited by SandJ on Mon Jul 16, 2012 7:07 pm, edited 1 time in total.

Top
   
PostPosted: Mon Jul 16, 2012 4:40 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sat Jun 11, 2011 6:07 am
Posts: 2161
Location: Western Australia
Quote:
Quote:
Quote:
- the don't-use-Notepad issue (which I cannot replicate for some reason)
Probably because it's just a myth. Microsoft adopted unicode with Windows XP - if you're still using Windows 98, go away.
I'm writing this on a PC running Windows ME. Do I have to go away?
No. ME would have been the best OS Microsoft ever made (if not for the glaring omission of unicode). It's bad reputation is very much undeserved, and caused by people who didn't configure it well. Apart from the adoption of unicode it's been downhill ever since.

The Notepad thing really is a myth, based I guess on previous versions of notepad defaulting to using some Microsoft code-page that causes apps expecting UTF-8 to choke.
Quote:
Quote:
Quote:
- case sensitivity in file names in Linux;
- the fussiness of Macs around ";" usage;
Inferior file-name parsing in non-unix-derived OSes.
Inferior property list parsing in non-Mac OSes.
:lol: If we're going to have a Holy OpSys War, shouldn't we start a new thread forum? :D
I'm not interested in OSes; my point is merely that just because you're in the minority, doesn't mean you're wrong.

Addendum: two of these issues are related - the UTF-8 thing and the MAC parsing of property lists both stem from property lists originally being an XML format, so a .plist file is still supposed to follow the rules of XML even if it's not.


Top
   
PostPosted: Mon Jul 16, 2012 10:48 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Can we please not have discussions of operating system and what the Right Thing is here? They contribute nothing.
Quote:
Addendum: two of these issues are related - the UTF-8 thing and the MAC parsing of property lists both stem from property lists originally being an XML format, so a .plist file is still supposed to follow the rules of XML even if it's not.
This isn’t true; the OpenStep format, which is based (loosely) on C syntax, predates both XML and Unicode.

The details of what will be accepted in OpenStep format plists varies between GNUstep and different versions of Mac OS X but correct syntax, which works in all cases, is:
  • Arrays are enclosed in parentheses – ( ) – and have commas between items, so there is no comma after the last one.
  • Dictionaries are enclosed in braces – { } – and have semicolons after each pair, including the last one.
This is correctly documented on [EliteWiki] the wiki, although the structure of the article isn’t really very helpful. It would probably be better to split off sections for OpenStep and XML syntax.

_________________
E-mail: jens@oolite.org


Top
   
PostPosted: Mon Jul 16, 2012 11:11 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Apr 29, 2012 2:23 pm
Posts: 883
Location: United Kingdom
Am I right in thinking that OpenStep is the prefered way of laying out plist files? I have noticed that most OXPs seem to use this "style" of laying out the contents of the file as opposed to the XML "style". I myself have just converted the remaining files in my Taxi Galactica OXP to OpenStep, as well as fixing flaws in the script that were previously pointed out so that it conforms to the stock scripts layout.


Top
   
PostPosted: Mon Jul 16, 2012 11:19 am 
Offline
Retired Assassin
Retired Assassin
User avatar

Joined: Tue Feb 09, 2010 11:31 am
Posts: 8311
Location: Disunited Kingdom
I believe it is, although I couldn't find mention of this on the wiki when I looked, although it is there somewhere.
Certainly the core plists were all converted to openstep some time ago and I for one much prefer it to XML for many reasons, not least of which are that it's easy to read and therefore to debug, and it's a lot shorter - an openstep plist is half the length of an XML one.
Indeed I feel this thread (and eventual wiki page) should urge those using other OXPs as templates to choose a modern one using openstep over an old XML one. Indeed I even know of at least one ship OXP which uses a mix of both formats - how confusing is that!

_________________
Commander Smivs, the friendliest Gourd this side of Riedquat.


Top
   
PostPosted: Mon Jul 16, 2012 11:22 am 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
Am I right in thinking that OpenStep is the prefered way of laying out plist files?
When you have to edit plist with a text editor, it is easier when using openStep. So, I would think that it will be preferable for most users. For Oolite itself it does not matter which type you use. In the past I already removed several XML versions of code from the wiki and I think they should all be converted there, except for the page that deals with the difference between those two.
Only mac users have easy access to plist editors and when using that editor, it really does not matter what you use because, when viewed in the plist-editor, both versions look the same. Advantage of using the plist editor is that you can't make syntax errors :D But, for the sake of window and linux users, save it in openstep format. (save as: 'Text Property List')

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Last edited by Eric Walch on Mon Jul 16, 2012 11:27 am, edited 1 time in total.

Top
   
PostPosted: Mon Jul 16, 2012 11:26 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
I recommend OpenStep format for legibility. However, as a special recommendation, if you do use Property List Editor (or Xcode 4) on Mac OS X, use XML format, because they write invalid OpenStep plists.

_________________
E-mail: jens@oolite.org


Top
   
PostPosted: Mon Jul 16, 2012 11:34 am 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
However, as a special recommendation, if you do use Property List Editor (or Xcode 4) on Mac OS X, use XML format, because they write invalid OpenStep plists.
That should only affect Mac tiger systems. And I wonder how many there are currently around. Look in Oolites own descriptions.plist at the end of the planet descriptions strings at current trunk line 403. I looked back, that error is there since is was converted from XML. No user complained. Probably they assumed Oolite would not run on tiger.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Mon Jul 16, 2012 11:43 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Apr 29, 2012 2:23 pm
Posts: 883
Location: United Kingdom
Okay thanks people, I assumed this was the case. And as a Windows XP user, I just use notepad++ for all my Oolite scripting, as I find its one of the best text editors available on the platform. Are there any tutorials or guidelines when converting XML to OpenStep? I have successfully converted all of the files in my OXP now, but I had to exclude the Frigate from the Galactic Navy OXP as this was written in XML and I have not been able to convert the flashers into OpenStep format, and without them the ship does not look complete... :(


Top
   
PostPosted: Mon Jul 16, 2012 11:46 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Quote:
Quote:
However, as a special recommendation, if you do use Property List Editor (or Xcode 4) on Mac OS X, use XML format, because they write invalid OpenStep plists.
That should only affect Mac tiger systems. And I wonder how many there are currently around. Look in Oolites own descriptions.plist at the end of the planet descriptions strings at current trunk line 403. I looked back, that error is there since is was converted from XML. No user complained. Probably they assumed Oolite would not run on tiger.
Hah. Well, it doesn’t in trunk. I seem to recall there were complaints. :-) Still, correct syntax is the place to be.

_________________
E-mail: jens@oolite.org


Top
   
PostPosted: Mon Jul 16, 2012 11:49 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Quote:
I have successfully converted all of the files in my OXP now, but I had to exclude the Frigate from the Galactic Navy OXP as this was written in XML and I have not been able to convert the flashers into OpenStep format, and without them the ship does not look complete... :(
Unless you’re using modernized subentity declarations, that would look something like <key>subentities</key><array><string>*FLASHER* bla bla</string><string>*FLASHER* bla bla</string></array>. In OpenStepese, that’s subentities = ("*FLASHER* bla bla", "*FLASHER* bla bla");.

_________________
E-mail: jens@oolite.org


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 56 posts ]  Go to page 1 2 3 4 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited