Page 1 of 3

A guide to scripting - Ready at last!

Posted: Fri, 7. May 04, 16:55
by marklaverty
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 :)

Posted: Fri, 7. May 04, 18:10
by JustHere4Coffee
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:

Posted: Fri, 7. May 04, 19:29
by Burianek
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

Posted: Fri, 7. May 04, 20:23
by kryptyk
Now that's handy info! :thumb_up:


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

Posted: Fri, 7. May 04, 20:27
by JustHere4Coffee
at the very top of the text, where it says "or you can download it here" :)

Posted: Fri, 7. May 04, 20:29
by kryptyk
JustHere4Coffee wrote:at the very top of the text, where it says "or you can download it here" :)
man...I'm going blind..... :lol:

Re: A guide to scripting - Ready at last!

Posted: Fri, 7. May 04, 20:57
by Shara
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.

Posted: Sat, 8. May 04, 00:13
by Nanook
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: :)

Posted: Sat, 8. May 04, 01:53
by marklaverty
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

Posted: Sat, 8. May 04, 02:55
by Argonaught.
Fantastic Mark...very easy to understand....Many, many thanks for the Guide :thumb_up: :thumb_up: :thumb_up: :thumb_up: :thumb_up:

Posted: Sat, 8. May 04, 03:01
by Sir Crashalot
Good work ! :thumb_up: :thumb_up: :thumb_up: :thumb_up:

An excellent beginners guide to scripting. :)

Posted: Sat, 8. May 04, 09:46
by Burianek
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.

Posted: Sat, 8. May 04, 11:06
by marklaverty
Thanks everyone, glad its ok and easy to understand :D


Burianek -> I'll send an E-mail and see what happens :wink:

Posted: Sun, 9. May 04, 00:22
by kryptyk
maybe they'll look at it, maybe add some more info and use it as the unofficial documentation

ya never know..... :D

Posted: Sun, 9. May 04, 14:53
by Witchking
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

Posted: Mon, 10. May 04, 09:36
by marklaverty
Glad you found it helpfull :D :D :D :D

Posted: Mon, 10. May 04, 14:26
by Kailric
:? Thanks to you I understand Arrays lots better now! :idea:

Posted: Tue, 11. May 04, 00:54
by LV
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:

Posted: Tue, 11. May 04, 12:14
by marklaverty
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!

Posted: Tue, 11. May 04, 17:20
by Shara
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!