Laws of X3 Scripting
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
Laws of X3 Scripting
Indexed Laws of X3 Scripting & Modding
1 ) LV's 1st law
Regardless of the effort an author invests in the features of a product, it's almost a certainty that the first series of reply posts will be requests for new features.
2 ) LV's 2nd law
Regardless of how user friendly a script is, or how much detailed spoonfeeding documentation is included, there will always be a constant flow of users who either don't RTFM or are incapable of following the most basic of advice.
2.1 ) Carlo the Curious' addendum to LV's 2nd law
In space, no one can type "Thereshallbewings".
3 ) LV's 3rd law
If something is broken, wildly blame any script that you feel like.
4 ) jocan2003's 1st Law
No matter how hard you try, your first script will have a lot of bugs.
5 ) mailleweaver's 1st Law
Every function has some built-in undocumented quirk that will eventually throw you for a loop.
6 ) mark_a_condren's 1st Law
What may seem the simplest thing to do, will quite often take the most lines of code to accomplish.
7 ) djrygar's 1st Law
Regardless of how many times you answer, the question will be repeated within the next 2 pages.
8 ) EmperorJon's 1st Law
When you've finally fixed a script bug, you've created a new one.
9 ) Logain Abler's 1st Law
Its not a bug, it's a feature.
9.1 ) Apricotslice's addendum to Logain Abler's 1st Law
A Feature is a Bug you decide works better than the original idea.
10 ) EmperorJon's 2nd Law
More often than not, the scope of a workaround to a feat deemed impossible is directly proportionate to a negative impact in performance.
11 ) jocan2003's 2nd Law
The size of a script is directly proportionate to the author's probability of having carpal tunnel syndrome.
12 ) Apricotslice's 1st Law
There is a point where a complete rewrite is faster than fixing bugs.
13 ) h2o.AvA'ss 1st Law
While loops are magical.
14 ) Roger L.S. Griffiths' 1st Law
In scripting, to wait is to sleep and sleep is divine.
15 ) Killjaeden's 1st Law
At minimum, the notion "oh nice, let's quickly try that" will last 2 hours.
16 ) Alan Phipps' 1st Law
Marking a script package as an Alpha version will automatically trigger a user complaint that said package has destroyed a savegame with no backup.
17 ) EmperorJon's 3rd Law
The amount of time spent making a script is directly and negatively proportional to the number of downloads.
If I've mis-paraphrased you, please let me know. If I've skipped you, it's because I've felt the laws were covered in earlier sections, or weren't necessarily relevant to X3 scripting or modding.
1 ) LV's 1st law
Regardless of the effort an author invests in the features of a product, it's almost a certainty that the first series of reply posts will be requests for new features.
2 ) LV's 2nd law
Regardless of how user friendly a script is, or how much detailed spoonfeeding documentation is included, there will always be a constant flow of users who either don't RTFM or are incapable of following the most basic of advice.
2.1 ) Carlo the Curious' addendum to LV's 2nd law
In space, no one can type "Thereshallbewings".
3 ) LV's 3rd law
If something is broken, wildly blame any script that you feel like.
4 ) jocan2003's 1st Law
No matter how hard you try, your first script will have a lot of bugs.
5 ) mailleweaver's 1st Law
Every function has some built-in undocumented quirk that will eventually throw you for a loop.
6 ) mark_a_condren's 1st Law
What may seem the simplest thing to do, will quite often take the most lines of code to accomplish.
7 ) djrygar's 1st Law
Regardless of how many times you answer, the question will be repeated within the next 2 pages.
8 ) EmperorJon's 1st Law
When you've finally fixed a script bug, you've created a new one.
9 ) Logain Abler's 1st Law
Its not a bug, it's a feature.
9.1 ) Apricotslice's addendum to Logain Abler's 1st Law
A Feature is a Bug you decide works better than the original idea.
10 ) EmperorJon's 2nd Law
More often than not, the scope of a workaround to a feat deemed impossible is directly proportionate to a negative impact in performance.
11 ) jocan2003's 2nd Law
The size of a script is directly proportionate to the author's probability of having carpal tunnel syndrome.
12 ) Apricotslice's 1st Law
There is a point where a complete rewrite is faster than fixing bugs.
13 ) h2o.AvA'ss 1st Law
While loops are magical.
14 ) Roger L.S. Griffiths' 1st Law
In scripting, to wait is to sleep and sleep is divine.
15 ) Killjaeden's 1st Law
At minimum, the notion "oh nice, let's quickly try that" will last 2 hours.
16 ) Alan Phipps' 1st Law
Marking a script package as an Alpha version will automatically trigger a user complaint that said package has destroyed a savegame with no backup.
17 ) EmperorJon's 3rd Law
The amount of time spent making a script is directly and negatively proportional to the number of downloads.
If I've mis-paraphrased you, please let me know. If I've skipped you, it's because I've felt the laws were covered in earlier sections, or weren't necessarily relevant to X3 scripting or modding.
Last edited by Litcube on Thu, 20. Jan 11, 23:57, edited 15 times in total.
-
- Posts: 629
- Joined: Tue, 6. Mar 07, 17:48
-
- Posts: 79
- Joined: Wed, 4. Nov 09, 04:39
Every function has some built-in undocumented quirk that will eventually throw you for a loop.
And no matter how simple a script is, bug testing and fixing always takes at least 10 times as long as writing it.
But... scripting can sometimes be more fun than actually playing, just because of "Oh, the possibilities!"
And no matter how simple a script is, bug testing and fixing always takes at least 10 times as long as writing it.
But... scripting can sometimes be more fun than actually playing, just because of "Oh, the possibilities!"
-
- Sith Lord
- Posts: 8255
- Joined: Wed, 6. Nov 02, 20:31
Well as i'm writing laws now:-
LV's 2nd Law Of Scripting
Pebcak errors
No matter how user friendly a script is, no matter how much detailed documentation is put with it, No matter how much spoonfeeding of how to's are added:- There will always be a constant flow of users who either don't RTFM or are incapable of following the most basic of advice. Therefore all scripts must be written to cater for the Neanderthal user
Expect several posts stating the script does not work or that they can't install it, this will never be the fault of the user, why would it be their fault, just because 99 out of 100 other users are using a script without issue, it is the authors fault it does not work for that user.
Onto Law 3:-
"IF something is broken, wildly blame any script that you feel like"
Yes, the bane of coders, User has a problem and decided either through random topic selection or the fact someone else makes a vague reference to a problem in a topic that a script is the cause of their problems.
No evidence or detail is needed, simply post in a topic that "this script" has broken your game, within hours others will read the post and assume that the script is the cause, the jungle drums will start to beat and before long your script becomes the devil incarnate. The real fun value comes for the coder who then spends hours looking for a bug that does not exist for them as it is not their script that is causing it.
The proverbial cheery to top this cake is after spending countless hours searching the OP on occasions pops back into the thread a couple of days later with "My bad it was something else causing it"
[ external image ]
LV's 2nd Law Of Scripting
Pebcak errors
No matter how user friendly a script is, no matter how much detailed documentation is put with it, No matter how much spoonfeeding of how to's are added:- There will always be a constant flow of users who either don't RTFM or are incapable of following the most basic of advice. Therefore all scripts must be written to cater for the Neanderthal user
Expect several posts stating the script does not work or that they can't install it, this will never be the fault of the user, why would it be their fault, just because 99 out of 100 other users are using a script without issue, it is the authors fault it does not work for that user.
Onto Law 3:-
"IF something is broken, wildly blame any script that you feel like"
Yes, the bane of coders, User has a problem and decided either through random topic selection or the fact someone else makes a vague reference to a problem in a topic that a script is the cause of their problems.
No evidence or detail is needed, simply post in a topic that "this script" has broken your game, within hours others will read the post and assume that the script is the cause, the jungle drums will start to beat and before long your script becomes the devil incarnate. The real fun value comes for the coder who then spends hours looking for a bug that does not exist for them as it is not their script that is causing it.
The proverbial cheery to top this cake is after spending countless hours searching the OP on occasions pops back into the thread a couple of days later with "My bad it was something else causing it"
[ external image ]
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
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
-
- Posts: 1468
- Joined: Wed, 3. Aug 05, 05:05
What may seem the simplest thing to do, will quite often take the most lines of code to accomplish.
Examples:
(Take getting all the items onboard a ship for example, 1 line of code? Oh no .... I still can't find; <RetVar> = Get all items onboard: <Ship/Station>)
And, there is alway,
<RetVar> = Get sector array from universe
<RetVar> = Get sector array: <Var/Race> Start Sector: <Var/Sector> Only include linked sectors: <Var/Booleen> (Race = Argon, Start sector = Argon Prime, Booleen = TRUE. This would return an array of just the linked Argon sectors around Argon Prime)
MarCon
Examples:
(Take getting all the items onboard a ship for example, 1 line of code? Oh no .... I still can't find; <RetVar> = Get all items onboard: <Ship/Station>)
And, there is alway,
<RetVar> = Get sector array from universe
<RetVar> = Get sector array: <Var/Race> Start Sector: <Var/Sector> Only include linked sectors: <Var/Booleen> (Race = Argon, Start sector = Argon Prime, Booleen = TRUE. This would return an array of just the linked Argon sectors around Argon Prime)
MarCon
-
- Posts: 38
- Joined: Tue, 3. Jun 08, 19:34
-
- Posts: 1842
- Joined: Mon, 10. Aug 09, 02:09
there are easy solutions to things described in LV's laws
User:
- how do enable IR menu? / I think I found a bug..IR crashed my game
Me:
-GTFO (go use RFF)

(because no matter how many times you answer, it will be repeated in next 2 pages, because 'users don't have time to go trough 200 pages of text')
User:
- how do enable IR menu? / I think I found a bug..IR crashed my game
Me:
-GTFO (go use RFF)

(because no matter how many times you answer, it will be repeated in next 2 pages, because 'users don't have time to go trough 200 pages of text')
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Another 2:
You spend hours working on a genius idea, and just when you get to the last key feature someone points out it's impossible.
Eventually you come up with a way of making it work.
A way that kills the user's FPS so much nobody will use it.
_______
Just when you've achieved something wonderful, you find a small niggling detail that you're determined to fix. You then find out that it's impossible to make it how you want without using the Mission Director.
You open up the MD files, and promptly commit suicide.
You spend hours working on a genius idea, and just when you get to the last key feature someone points out it's impossible.
Eventually you come up with a way of making it work.
A way that kills the user's FPS so much nobody will use it.
_______
Just when you've achieved something wonderful, you find a small niggling detail that you're determined to fix. You then find out that it's impossible to make it how you want without using the Mission Director.
You open up the MD files, and promptly commit suicide.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 629
- Joined: Tue, 6. Mar 07, 17:48
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 16999
- Joined: Mon, 5. Mar 07, 22:03
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58

EDIT:
More often than not, the scope of a workaround to a feat deemed impossible is directly proportionate to a negative impact in performance.
That is a win way of putting it.
You sir, deserve a Valhalla.

Last edited by EmperorJon on Mon, 6. Dec 10, 23:31, edited 1 time in total.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
-
- Posts: 629
- Joined: Tue, 6. Mar 07, 17:48
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Apricotslice's first law of coding :
A Feature is a Bug you decide works better than the original idea or adds something you decide to keep.
Apricotslice's second law of coding :
Fixing a bug always creates another bug.
Apricotslice's third law of coding :
Bugs multiply exponentially by the number of attempts to fix them.
Apricotslice's fourth law of coding :
There is always a point where a complete rewrite is faster than fixing bugs.
Apricotslice's Law of Honesty in the coding place :
Anywhere where coding is done should have the following sign on the wall. : "Controlled C*ckup in Progress"
A Feature is a Bug you decide works better than the original idea or adds something you decide to keep.
Apricotslice's second law of coding :
Fixing a bug always creates another bug.
Apricotslice's third law of coding :
Bugs multiply exponentially by the number of attempts to fix them.
Apricotslice's fourth law of coding :
There is always a point where a complete rewrite is faster than fixing bugs.
Apricotslice's Law of Honesty in the coding place :
Anywhere where coding is done should have the following sign on the wall. : "Controlled C*ckup in Progress"
Last edited by apricotslice on Tue, 7. Dec 10, 01:48, edited 1 time in total.
-
- Posts: 349
- Joined: Sun, 12. Oct 08, 04:04
1. Don't use the same variable for everything.
2. To master arrays, build yourself an array of arrays and extract data from those arrays.
3. While-loops are magical, they turn 100+ lines of code into 10 lines of code.
4. Use detailed information in incoming messages, write to player logbook, and logs. The more details you provide yourself, the easier it is for you to troubleshoot your bugs.
Code: Select all
$var = [Playership]->get sector
$var = $var->get owner race
if $var == [Argon]
$var = 20
else
$var = 10
end
while $var
dec $var =
skip if $var < 11
continue
$var = [Playership]->get sector
end
*explosion*
3. While-loops are magical, they turn 100+ lines of code into 10 lines of code.
4. Use detailed information in incoming messages, write to player logbook, and logs. The more details you provide yourself, the easier it is for you to troubleshoot your bugs.
-
- Posts: 10522
- Joined: Fri, 12. Mar 04, 19:47
Nice thread, love the concept (kind of like a lessons learned from fellow scripters/modders).
- The holy trinity of scripting is MCSI (Script Editor), AL Engine (Script Editor), MD (Mission Director)
- (The) GoD (Engine) works in mysterious ways (e.g. Weapon/Missile selection for spawned craft, and "apparently" random destruction of "last of their kind" stations)
- What can not be done in MCSI can sometimes be done in MD if at all (and visa versa)
- To wait in scripting is to sleep and sleep is divine
Lenna (aka [SRK] The_Rabbit)
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"When eating an elephant take one bite at a time" - Creighton Abrams
"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55
"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb
"When eating an elephant take one bite at a time" - Creighton Abrams