Posted: Tue Jul 21, 2009 10:59 pm
For scripting missions examples you have to have a look at Cataclysm.
For information and discussion about Oolite.
https://bb.oolite.space/
Thanks for the appraisal, however I wouldn't really suggest that as a first look. It's quite complex (probably the longest JS-script to date) and not commented. I'd therefore rather suggest the Anarchies-script, which I happen to have commented quite extensively (it was my first attempt in JS-scripting, also translating the older legacy version, and I found it a good idea at the time to comment basically every line--would still be a good idea, of course, but I've gotten lazy ).another_commander wrote:For scripting missions examples you have to have a look at Cataclysm.
Only that "LogWithClass" in that script is outdated and should be replaced by just "log"Commander McLane wrote:Why don't you start with the JavaScript test OXP provided in the wiki? ... Really, all information you need is concentrated on and accessible from this very entry point.
Yes i will be looking at this toAt the risk of boring you, Rustybolts, by re-iterating my mantra again: Why don't you start with the JavaScript test OXP provided in the wiki? It is again linked to from the Category:Oolite_scripting-page. Really, all information you need is concentrated on and accessible from this very entry point.
Code: Select all
if (missionVariables.longwayround=='MISSION_COMPLETE'
&& !missionVariables.blackbaron
Yes. Mission variables are stored as strings and there you only test for existence with this test.Rustybolts wrote:Have been looking into js one thing that puzzles me so far isIs " !missionVariables.blackbaron " asking if it is undefined?Code: Select all
if (missionVariables.longwayround=='MISSION_COMPLETE' && !missionVariables.blackbaron
Artithmetic Operators
Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus (remainder of a division)
++ Increment
-- Decrement
Assignment Operators
Operator Description
= Assign
+= Add and assign. For example, x+=y is the same as x=x+y.
-= Subtract and assign. For example, x-=y is the same as x=x-y.
*= Multiply and assign. For example, x*=y is the same as x=x*y.
/= Divide and assign. For example, x/=y is the same as x=x/y.
%= Modulus and assign. For example, x%=y is the same as x=x%y.
Comparison Operators
Operator Description
== Is equal to
=== Is identical (is equal to and is of the same type)
!= Is not equal to
!== Is not identical
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
Logical/boolean Operators
Operator Description
&& and
|| or
! not
String Operators
In JavaScript, a string is simply a piece of text.
Operator Description
= Assignment
+ Concatenate (join two strings together)
+= Concatenate and assign
Code: Select all
x = 5;
y = x++;
Code: Select all
x = 5;
y = ++x;
I made a start here. Other may fill it in further.Cmd. Cheyd wrote:If that doesn't get added to the wiki, I'm printing it and posting it beside my home computer.
My pm?Thargoid wrote:As I said in reply to your PM, I'd recommend the FAQs at Javascripter.net as quite a good quick resource for looking things up. Alongside the wiki of course for more Oolite-specific functions, methods and events.