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, 16:03

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 :)
For everything you ever wanted to know about X2,
and more......

Image

User avatar
JustHere4Coffee
Posts: 1070
Joined: Wed, 6. Nov 02, 21:31

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: 2928
Joined: Mon, 29. Dec 03, 04:29

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: 392
Joined: Fri, 5. Dec 03, 21:19

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: 1070
Joined: Wed, 6. Nov 02, 21:31

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: 392
Joined: Fri, 5. Dec 03, 21:19

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: 234
Joined: Tue, 24. Feb 04, 20:37

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: 25953
Joined: Thu, 15. May 03, 20:57

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: :)
Having an Acronym Attack? See the Ego FAQ. Also now for Terran Conflict and Albion Prelude.
NOT an Egosoft employee.

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

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

Image

User avatar
Argonaught.
Posts: 1618
Joined: Wed, 6. Nov 02, 21:31

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

I lurk alot for the most part now
:thumb_up:

Sir Crashalot
Posts: 2012
Joined: Wed, 6. Nov 02, 21:31

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: 2928
Joined: Mon, 29. Dec 03, 04:29

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, 16:03

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

Image

kryptyk
Posts: 392
Joined: Fri, 5. Dec 03, 21:19

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: 340
Joined: Sat, 24. May 03, 19:14

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

Post Reply

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