Javascript vs Python

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

Moderators: winston, another_commander

Post Reply
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Javascript vs Python

Post by Cholmondely »

If I understand correctly (and I am a rank neophyte in such matters), the old .oxp's were (partially?) written in Python and from 2008 (Oolite v.1.67) had to be converted to Javascript.

I assume that that means that Python is no longer supported and just does not work.

But: Javascript needs a 'host environment' eg a web-browser or presumably Oolite. Python doesn't.

Javascripts 'inputs' are mediated by this host environment - so if Oolite does not allow the Q key to do anything, then a Javascript oxp will be unable to allow it to do anything either.

Am I correct in further assuming that a Python oxp would have been able to allow input from the Q key?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Javascript vs Python

Post by another_commander »

No, it's nothing like that I'm afraid. Let me explain:
If I understand correctly (and I am a rank neophyte in such matters), the old .oxp's were (partially?) written in Python and from 2008 (Oolite v.1.67) had to be converted to Javascript.

I assume that that means that Python is no longer supported and just does not work.
We never used Python in Oolite. The only application written in Python is the external Windows and Linux debug console and Oolite does not require the console to run. Python in Oolite was never a thing and the older OXPs used the standard XML or GNUstep plist format for everything. We still keep these around for compatibility reasons.
But: Javascript needs a 'host environment' eg a web-browser or presumably Oolite. Python doesn't.
Oolite itself is the host environment for the Javascript engine. The JS library we use is stripped of all browser-specific and almost all disk-output functionality for security reasons (As far as I can recall, the only disk-write capability available from JS in Oolite is by executing the takeSnapShot script command, which is available only in the test release versions of the game). Python, as can be expected from all the above, is irrelevant.
Javascripts 'inputs' are mediated by this host environment - so if Oolite does not allow the Q key to do anything, then a Javascript oxp will be unable to allow it to do anything either.
Since input receiving functionality is stripped from our JS, yes, it is Oolite that decides which keys are usable and which aren't.
Am I correct in further assuming that a Python oxp would have been able to allow input from the Q key?
No, because Python has nothing to do with Oolite's scripting language and there has never been a Python oxp.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Javascript vs Python

Post by Cholmondely »

Thank you!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Javascript vs Python

Post by phkb »

another_commander wrote: Thu Oct 08, 2020 11:17 am
there has never been a Python oxp
Well, there is always Griff's Python! :wink: :D
Post Reply