A guide to scripting - Ready at last!

The place to discuss scripting and game modifications for X²: The Threat.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

marklaverty
Posts: 270
Joined: Mon, 23. Feb 04, 15:03
x2

A guide to scripting - Ready at last!

Post by marklaverty » Fri, 7. May 04, 16:55

The scripting guide is ready :D

32 pages of it covering......

1) Introduction
2) Activating and Accessing the Script Editor
3) Basic Script Editor use and Variables
4) Basic Concepts :-
More variables
Arguments
Script calls
Time outs
While, While Not and GO TO
If, If Not, and Expressions
Arrays DONE

http://www.x2source.com/scriptguide.php

*edit- burianek* new address per site owner's instructions:
http://www.x2source.com/index.php?act=scriptguide

Let me know what you think :)
Attachments
ScriptGuide.PDF
X2 scripting guide by marklaverty
(268.08 KiB) Downloaded 81 times
For everything you ever wanted to know about X2,
and more......

[ external image ]

User avatar
JustHere4Coffee
Posts: 1075
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JustHere4Coffee » Fri, 7. May 04, 18:10

yay for doing it, eh for making it a single page rather than a group of pages that'd make for easier digestion, and wtf for making the downloadable a pdf instead of a nice simple doc or txt or html page...

still, it's about a zillion times better than anything I've contributed, so overall our survey says :thumb_up: :thumb_up:

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek » Fri, 7. May 04, 19:29

Very nice, thank you!
You know if you want to give up your intellectual property rights, I'd be willing to wager that if you mailed it to BurnIt!, with your permission, you'd see large chunks of this appear in the 'official' script editor documentation.
Pretty sure he'd appreciate the effort. I do. :D
"Nature's first green is gold" . . . stay golden.

kryptyk
Posts: 483
Joined: Fri, 5. Dec 03, 20:19
x4

Post by kryptyk » Fri, 7. May 04, 20:23

Now that's handy info! :thumb_up:


Where can I find the downloadable version....I seemed to have missed the links..... :?

User avatar
JustHere4Coffee
Posts: 1075
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JustHere4Coffee » Fri, 7. May 04, 20:27

at the very top of the text, where it says "or you can download it here" :)

kryptyk
Posts: 483
Joined: Fri, 5. Dec 03, 20:19
x4

Post by kryptyk » Fri, 7. May 04, 20:29

JustHere4Coffee wrote:at the very top of the text, where it says "or you can download it here" :)
man...I'm going blind..... :lol:

Shara
Posts: 244
Joined: Tue, 24. Feb 04, 19:37
x2

Re: A guide to scripting - Ready at last!

Post by Shara » Fri, 7. May 04, 20:57

marklaverty wrote: Let me know what you think :)

The only thing I want to say about the content is that I was hoping for something more along the lines of X2Scripting in a Nutshell, and this is more like X2Scripting for Dummies.

Knowing that, I still have gripes, and they deal exclusively with presentation. The site that is hosting this is crap for color/font selection. It makes your guide hard to read. There's zero font/color differentiation for code blocks, and they aren't set apart from the rest of the text. The section headings are in italics. They need to be bold, and larger than the rest of the text fonts.

The code blocks really need to be distinguished in some way, much the way quotes are handled in this message board (except maybe without the indentation). Like so:



##############################################



Delete all of the line in the ‘code’ section except for <new line> and return null. Next insert a new line above the ‘return null’, highlight it and hit return. Go into ‘General commands’ and select the ‘<retvar/if><expression>’ function. Then choose ‘if’ from the list of selections. You should now have
Arguments
Ship <Var/ship> Ship
Code
If <?> …
return null
<new line>
Highlight <?> and hit return, highlight ‘ship’ and hit return. You should now have...
Arguments
Ship <Var/ship> Ship
Code
If $ship …
return null
<new line>
Highlight ‘…’ and hit return, select ‘= =’ and hit return. Now your script should look like …
Arguments
Ship <Var/ship> Ship
Code
If $ship = = …
return null
<new line>

Highlight ‘…’ and hit return, select ‘PLAYERSHIP’ and hit return. This should give you…
Arguments
Ship <Var/ship> Ship
Code
If $ship = = [PLAYERSHIP] …
return null
<new line>

Insert a new line above ‘return null’, select it and hit return. Go into the ‘logbook commands’ section and pick ‘write to player logbook <value>’ then hit return. Select <string> from the list of selections and hit return. Type in ‘this is your ship’ and hit return. You should be taken back to your script which will now look like …
Arguments
Ship <Var/ship> Ship
Code
If $ship = = [PLAYERSHIP] …
Write to player logbook ‘this is your ship’
return null
<new line>


#############################################

See how this is easier to read?

Get the hosts of that site to do your guide a favor, and format it like a regular coding guide. It will help your readers.

Nanook
Moderator (English)
Moderator (English)
Posts: 27829
Joined: Thu, 15. May 03, 20:57
x4

Post by Nanook » Sat, 8. May 04, 00:13

Excellent job and thanks for putting it into a nice universal format. I much prefer pdf over some potentially incompatible text or doc format. :thumb_up: :thumb_up: :thumb_up: :)
Have a great idea for the current or a future game? You can post it in the [L3+] Ideas forum.

X4 is a journey, not a destination. Have fun on your travels.

marklaverty
Posts: 270
Joined: Mon, 23. Feb 04, 15:03
x2

Post by marklaverty » Sat, 8. May 04, 01:53

Thanks for the feedback , much appreciated :D

JustHere4Coffee -> Thanks :thumb_up: :thumb_up: I did pass Raven a .doc and a .pdf for downloading. I'll ask him to put the .doc up aswell.

Burianek -> Again, cheers dude :D . The guide is still incomplete and there is alot of stuf still to go in. I hadn't really dared consider it good enough to be part of the official documentation! :oops:

kryptyk -> Glad it helped :D

Shara -> I take your point and yes it would make it alot easyier to read *nods in agreement*. I'll ask for the code to be formatted in code blocks. In fairness I did just give him a load of unformatted text on a word document and let him sort it, out then tidyied it up for the pdf :fg:

On the other point. if it comes accros as a 'scripting for dummies guide' instead of a 'x2 scripting in a nutshell' guide then I've suceeded in what I set out to do. An x2 scripting in a nutshell would be more like 300 pages long instead of 32, and I don't know anywhere near enought to begin compiling one. The guide will grow with me as I get time to update it and learn new things (already loads more to go in ) then it should turn into a 'scripting in a nutshell' guide.

It was done for the sole purpose of giving anyone who knows absolutely nothing about scripting/programming a helping hand to get started. I remember how hard it was when I started and some of the time I work with relational databases and a querey language (ms sql server) as part of my day job.

Nanook -> Glad you like it :D
For everything you ever wanted to know about X2,
and more......

[ external image ]

User avatar
Argonaught.
Posts: 1827
Joined: Wed, 6. Nov 02, 20:31
x4

Post by Argonaught. » Sat, 8. May 04, 02:55

Fantastic Mark...very easy to understand....Many, many thanks for the Guide :thumb_up: :thumb_up: :thumb_up: :thumb_up: :thumb_up:
[MOD]X3TC No Fog / [MOD]X3AP No Fog / [MD]X3TC Menagerie Shipyard / [MD]X3AP Menagerie Shipyard
<==<<Argonaught>>==>

XBTF>XT>X2TT>X3R>X3TC>X3AP>X4F

I lurk alot for the most part now
:thumb_up:

Sir Crashalot
Posts: 3846
Joined: Wed, 6. Nov 02, 20:31
x4

Post by Sir Crashalot » Sat, 8. May 04, 03:01

Good work ! :thumb_up: :thumb_up: :thumb_up: :thumb_up:

An excellent beginners guide to scripting. :)
If you can`t dazzle them with dynamics, then baffle them with bullsh*t :D

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek » Sat, 8. May 04, 09:46

marklaverty wrote:Burianek -> Again, cheers dude :D . The guide is still incomplete and there is alot of stuf still to go in. I hadn't really dared consider it good enough to be part of the official documentation! :oops:
I think you may be surprised. It's my impression that these guys are swamped with work beyond what most of us would figure. Every time I've seen Bernd in the chat rooms and someone has asked him about scripting guides and the like the answer is always:

'Scripting is an unsupported feature. Since we don't even have enough time to finish all of the things that we absolutely have to finish, it will have to be placed on the back burner as there aren't enough hours in the day. If anyone out there would like to contribute and take a shot at writing something, please do and send it to me.'

I've even seen him (Bernd) offer access to higher level people to get questions answered to a german forum member that was considering putting together a modder's guide.

A first attempt is better than no attempt, and while I certainly don't have any say in anything important, this stuff may be more well received than you think it would be.

Just something to think about.
"Nature's first green is gold" . . . stay golden.

marklaverty
Posts: 270
Joined: Mon, 23. Feb 04, 15:03
x2

Post by marklaverty » Sat, 8. May 04, 11:06

Thanks everyone, glad its ok and easy to understand :D


Burianek -> I'll send an E-mail and see what happens :wink:
For everything you ever wanted to know about X2,
and more......

[ external image ]

kryptyk
Posts: 483
Joined: Fri, 5. Dec 03, 20:19
x4

Post by kryptyk » Sun, 9. May 04, 00:22

maybe they'll look at it, maybe add some more info and use it as the unofficial documentation

ya never know..... :D

User avatar
Witchking
Posts: 698
Joined: Sat, 24. May 03, 19:14
x2

Post by Witchking » Sun, 9. May 04, 14:53

On behalf of all morons everywhere I would like to thank you for the Scripting Guide, I just dl'd it and was extremely relived to discover that it's not written in Swahili as most of the scripting tuts I've tried to understand seem to be. Great work man thanx again

Happy chappie :D

marklaverty
Posts: 270
Joined: Mon, 23. Feb 04, 15:03
x2

Post by marklaverty » Mon, 10. May 04, 09:36

Glad you found it helpfull :D :D :D :D
For everything you ever wanted to know about X2,
and more......

[ external image ]

User avatar
Kailric
Posts: 985
Joined: Sun, 7. Dec 03, 05:15
x3

Post by Kailric » Mon, 10. May 04, 14:26

:? Thanks to you I understand Arrays lots better now! :idea:
"Try not. Do or do not, there is no try."-Yoda

"[Its] time for the human race to enter the solar system"-Dan Quayle

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Tue, 11. May 04, 00:54

Now now gentlemen


Any guide is a good guide


The only way this scripting forum is going to get anywhere is if it's users work together as the any official help/hints are about as likely as martians landing on earth tommorow :)

It's a fine guide but i must admit it is hard to read and the code should standout, marklaverty has put some serious effort in here and i'd hope if someone else tidied it up mark would apprieciate it.

I'd happily tidy it up but I have nearly 30 scripts to tidy b4 1.4 comes out

If the peeps on this forum wants some scripting docs their going to have to make them themselves and if you havn't worked this out yet you never will :wink:
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

marklaverty
Posts: 270
Joined: Mon, 23. Feb 04, 15:03
x2

Post by marklaverty » Tue, 11. May 04, 12:14

Hi,

Ok, I'd just like to start by saying that I did ask for comments and that was because I wanted them, both good and bad.

I'm not one of these people who don't like being critisised, as long as it's helpfull.

Shara -> whilst your comments might may be percieved as a bit 'blunt', your sugestion about the code blocks was very usefull and I thank you for it. I have asked for this to be done ASAP.

That said, and this was never going to be a 'scripting in a nutshell guide'. It is aimed at helping people get started with scripting and is just an attempt to take some of the steepness out of the learning curve.

As LV said, it will be some time before we see a 'propper' scripting in a nutshell guide from egosoft, and we may never do.

With this in mind, the more that's written down by people the better. If you know how to do something with x2 scripts please consoider taking just half an hout or so and writing it down.

If you want send it to me and I'll add it to the guide, obviously stating your name as the person who submitted that section and thanking you profusely!
For everything you ever wanted to know about X2,
and more......

[ external image ]

Shara
Posts: 244
Joined: Tue, 24. Feb 04, 19:37
x2

Post by Shara » Tue, 11. May 04, 17:20

marklaverty wrote:Hi,

Ok, I'd just like to start by saying that I did ask for comments and that was because I wanted them, both good and bad.

I'm not one of these people who don't like being critisised, as long as it's helpfull.

Shara -> whilst your comments might may be percieved as a bit 'blunt', your sugestion about the code blocks was very usefull and I thank you for it. I have asked for this to be done ASAP.

That said, and this was never going to be a 'scripting in a nutshell guide'. It is aimed at helping people get started with scripting and is just an attempt to take some of the steepness out of the learning curve.

As LV said, it will be some time before we see a 'propper' scripting in a nutshell guide from egosoft, and we may never do.

With this in mind, the more that's written down by people the better. If you know how to do something with x2 scripts please consoider taking just half an hout or so and writing it down.

If you want send it to me and I'll add it to the guide, obviously stating your name as the person who submitted that section and thanking you profusely!
I never meant to disrespect your guide. So, if it got perceived that way, that was not my intent. My intent was simply to provide feedback that was asked for, so I did. I noted two important things: (1) The format needed some work, and that was not your fault, but the maintainers of the site and (2) I expected a different guide. That was my expectation, and I never meant for it to reflect the quality of your guide. You meant to write a Scripting for Dummies guide, and so you achieved your objective - good show!

Post Reply

Return to “X²: The Threat - Scripts and Modding”