Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Creating misssion oxp

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

Moderators: another_commander, winston

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6557
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

For scripting missions examples you have to have a look at Cataclysm.
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

another_commander wrote:
For scripting missions examples you have to have a look at Cataclysm.
Thanks for the appraisal, :D 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 :roll: ).

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.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

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.
Only that "LogWithClass" in that script is outdated and should be replaced by just "log"

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)
User avatar
Rustybolts
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jun 07, 2009 6:22 pm
Location: UK

Post by Rustybolts »

Thanks guys for the suggestions i will most probably will be looking at all the above suggestions.
Commander Mclane
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.
Yes i will be looking at this to :D

Cheers Rusty
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
Image
User avatar
Rustybolts
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jun 07, 2009 6:22 pm
Location: UK

Post by Rustybolts »

Have been looking into js one thing that puzzles me so far is

Code: Select all

if (missionVariables.longwayround=='MISSION_COMPLETE'
			&& !missionVariables.blackbaron
Is " !missionVariables.blackbaron " asking if it is undefined?
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
Image
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Rustybolts wrote:
Have been looking into js one thing that puzzles me so far is

Code: Select all

if (missionVariables.longwayround=='MISSION_COMPLETE'
			&& !missionVariables.blackbaron
Is " !missionVariables.blackbaron " asking if it is undefined?
Yes. Mission variables are stored as strings and there you only test for existence with this test.
With normal variables this could also mean that the variable is false or zero. (I made already some mistakes with the difference)
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

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.
User avatar
Rustybolts
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jun 07, 2009 6:22 pm
Location: UK

Post by Rustybolts »

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
Image
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2478
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Thanks for the list Rustybolts, very helpful! the '+=' one crops up a lot in the Oolite shader code examples, i could never find out what it was exactly and only managed to work it out with lots of experimenting so it's really great to have a proper explanation
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

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 ++

Code: Select all

x = 5;
y = x++;
First assign and than increment. y will be 5 and x will be 6 at the end

Code: Select all

x = 5;
y = ++x;
First increment and than assign. y will be 6 and x will be 6 at the end
User avatar
Cmd. Cheyd
---- E L I T E ----
---- 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...

Post by Cmd. Cheyd »

If that doesn't get added to the wiki, I'm printing it and posting it beside my home computer. I know JACK about javascripting and have been having a hard time understanding some of the maths / operations by simply looking at existing code.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Cmd. Cheyd wrote:
If that doesn't get added to the wiki, I'm printing it and posting it beside my home computer.
I made a start here. Other may fill it in further.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

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.
User avatar
Rustybolts
---- E L I T E ----
---- E L I T E ----
Posts: 293
Joined: Sun Jun 07, 2009 6:22 pm
Location: UK

Post by Rustybolts »

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.
My pm?
Good site though!
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
Image
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5525
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

No, Cmd. Cheyd's :)
Post Reply