Page 1 of 1
Javascript vs Python
Posted: Thu Oct 08, 2020 10:57 am
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?
Re: Javascript vs Python
Posted: Thu Oct 08, 2020 11:17 am
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.
Re: Javascript vs Python
Posted: Thu Oct 08, 2020 11:39 am
by Cholmondely
Thank you!
Re: Javascript vs Python
Posted: Thu Oct 08, 2020 8:48 pm
by phkb
Well, there is always
Griff's Python!