Creating misssion oxp
Moderators: winston, another_commander
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
- Commander McLane
- ---- 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:
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.
At 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.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
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.
For mission offering I would look inside UPS-courier as Svengali wrote. The UPS scripts themselves are to complex to start with, but I added a stripped demo script that is commented and dedicated to offering missions. (I really should upload it once as a separate file)
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Thanks guys for the suggestions i will most probably will be looking at all the above suggestions.
Commander Mclane
Cheers Rusty
Commander Mclane
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.
Cheers Rusty
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Have been looking into js one thing that puzzles me so far is
Is " !missionVariables.blackbaron " asking if it is undefined?
Code: Select all
if (missionVariables.longwayround=='MISSION_COMPLETE'
&& !missionVariables.blackbaron
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
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
With normal variables this could also mean that the variable is false or zero. (I made already some mistakes with the difference)
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- 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:
Ah, that's a point I completely forgot. Sorry.
What is not included in the wiki-documentation is a documentation of the JavaScript-syntax as such (like what '!' means, or the difference between '=' and '==', and things like that). You would need to find this elsewhere. But it should be easily available somewhere in the interweb.
What is not included in the wiki-documentation is a documentation of the JavaScript-syntax as such (like what '!' means, or the difference between '=' and '==', and things like that). You would need to find this elsewhere. But it should be easily available somewhere in the interweb.
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
For anyone else reading this thread and is interested
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
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Thanks Rustybolts, maybe the list should be put on the wiki for starting scripters. It covers the most often used operators needed to understand 99% of the scripts. (At least on the point of operators)
I only want to add that there are two kinds of ++
First assign and than increment. y will be 5 and x will be 6 at the end
First increment and than assign. y will be 6 and x will be 6 at the end
I only want to add that there are two kinds of ++
Code: Select all
x = 5;
y = x++;
Code: Select all
x = 5;
y = ++x;
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
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.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
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.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
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.
Good site though!
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871