[UTILITY] MSCI Reference Formatter

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Locked
User avatar
Saetan
Posts: 3223
Joined: Wed, 1. Feb 06, 19:26
x4

[UTILITY] MSCI Reference Formatter

Post by Saetan » Sun, 12. Dec 10, 18:03

Here a small online-utility for those of you, who want some assistance in formatting your descriptions:

MSCI Reference Formatter 1.1 (New Version)

MSCI Reference Formatter 1.0 (BackUp: Old Version)

The usage of this utility is quite self-explanatory. It uses Mark's Template as base for its color sheme. Here what it would look like:
@ START|[skip|else] if [not]|while [not]| <RetVar> = <RefObj> call script <Script Name>: [<Parameter>=<Value>] [...]


START|[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar> = If the called script is to 'return' information.
<RefObj> = The 'Object' that the called script is to be run on.
<Script Name> = The script that is to be 'called'.
<Parameter> = The arguments that are to be passed to the 'called' script, if any.


Use this command to call another script from a currently running script. Dependant on the first 'Parameter' used ie START or <RetVar> etc, the called script will be run concurrently with the calling script or the calling script will wait for the called script to finish and return before continuing.

Without START, the script is called to run on the same object and task ID as the calling script.
The calling script is still on the stack but the called script is now on top of the stack and will run until it quits and returns control back to the calling script with a return.

<RefObj> is ignored unless you use START.

Using START and a <RefObj> of null, will run the script as an independent global script.
Global scripts are more difficult to control because they cannot be detected by other scripts.

Using START and an existing <RefObj> will kill all task 0 scripts on <RefObj> and start this script on task 0 instead.
Not all objects are valid. Asteroids and missiles are examples of invalid objects.

A script cannot overwrite itself so a task 0 script can not START on a <RefObj> = [THIS].

START spawns a new process instead of “calling” on top of the current one so control is returned to the calling script immediately.

An '@' character in a scripting statement marks an “interrupt point”.

A return variable can be assigned to the value returned by the called script.
In this case, whatever value is passed to the return statement in the called script is assigned to the specified variable in the calling script. The result of the call can also be used as a condition in an if, skip, or while.
If this is done, then the result can only be tested for whether or not it is null. If it isn't null, then the conditional test passes. If it is null, then it fails.

A 'called' script may have up to 10 arguments, dependant on how many were used when the script was written. All arguments must have their parameter set, this may however be as simple as null if the called script was written to allow for this.


Examples:

@ START = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Starts the 'called' script The.script.i.want.to.run on the 'object' $ship and pass it the arguments $do.this and $then.do.this. This will result in the 'called' script running concurrently with the 'calling' script. The 'calling' script will continue on while the 'called' script does its thing.

-----------------------------------

@ $return = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

The 'called' script The.script.i.want.to.run will be run and passed the arguments $do.this and $then.do.this. This will result in the 'called' script running sequentially with the 'calling' script. The 'calling' script will wait while the 'called' script does its thing and will only continue on after the 'called' script has finished and returned the variable $return (or the 'called' script is stopped).

-----------------------------------

@ = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

As above but, the 'calling' script will wait for the 'called' script to finish, but no return is required by the 'calling' script.

To obtain the '=' without having 'null' or a '$return.variable' there you select 'No return variable' from the list of possible conditional statements at the bottom of the SE menu.


Unknown Outcomes:

Use this area if there are any 'unknown outcomes' for the command that you wish to mention.



Command Location:

»» General Commands
»» Script Calls
@ <RetVar/IF/Start><RefObj> call script <Script Name> : <Parameter>
Write your description in the text-box of the Formatter, or simply copy an already written one in. After hitting the button, the description will get some bb-tags, based on the "Replacements List". You just have to copy your formatted description, check and revise its formatting and post it in their own topics.

If you have questions or suggestions, just ask and tell here.
Last edited by Saetan on Tue, 14. Dec 10, 15:00, edited 9 times in total.

User avatar
Saetan
Posts: 3223
Joined: Wed, 1. Feb 06, 19:26
x4

Post by Saetan » Sun, 12. Dec 10, 18:04

-- reserved --
Last edited by Saetan on Sun, 2. Jan 11, 18:14, edited 2 times in total.

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Mon, 13. Dec 10, 14:27

Just noticed this,

If you have the arrow '->' showing after <RefObj> it adds another close color tag.

@ [skip|else] if [not]|while [not]|<RetVar/IF> = <RefObj> ->[/color] follow <Var/Ship> with
precision <Var/Number> m : timeout=<Var/Number> ms

Code: Select all

[color=blue]@ [skip|else] if [not]|while [not]|[/color][color=lime]<RetVar/IF>[/color] = [color=lime]<RefObj>[/color] ->[/color] follow [color=lime]<Var/Ship>[/color] with 
precision [color=lime]<Var/Number>[/color] m : timeout=[color=lime]<Var/Number>[/color] ms
Mark

User avatar
Saetan
Posts: 3223
Joined: Wed, 1. Feb 06, 19:26
x4

Post by Saetan » Mon, 13. Dec 10, 15:02

@ [skip|else] if [not]|while [not]|<RetVar/IF> = <RefObj> -> follow <Var/Ship> with
precision <Var/Number> m : timeout=<Var/Number> ms
Fixed ... there are no References, or something like that, ( <...> ) ending with -> which could cause other problems, right?


edit:
... ehm ... Mark? I just recognized:
@ [START|[skip|else] if [not]|while [not]|
It's the one out from your template ... the [ before start, isn't that to much? I see no closing ] for it ...

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Mon, 13. Dec 10, 18:19

there are no References, or something like that, ( <...> ) ending with -> which could cause other problems, right?
Not that i can think of off the top of my head.

@ [START|[skip|else] if [not]|while [not]|
Damn, hadn't noticed the [ but no ]. I'll take the [ out, it has no need there.


Thanks

Mark

User avatar
Saetan
Posts: 3223
Joined: Wed, 1. Feb 06, 19:26
x4

Post by Saetan » Tue, 14. Dec 10, 05:03

Mark, another question. I have seen you using the -> colored in lime if it's after a variable at the beginning of the command.


Which version would be used more often, respective better to handle for you (all)?

... a "->" in the command line or an uncolored "->" just as description?

... or should I try to add simple AI logics like:

if -> has been found, check the word before ... if it's a Var, that means starting with $, make it lime else let it be uncolored? ;-)

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Tue, 14. Dec 10, 10:34

... or should I try to add simple AI logics like:

if -> has been found, check the word before ... if it's a Var, that means starting with $, make it lime else let it be uncolored?
This would be ideal, but if its to much of a PITA, i can live with fixing this when final formatting the command post.


I came across another formatting foo foo with the foo foo inserter last night, but for the life of me can't remember what it was now. Will post when i remember.

Thanks Saetan


Mark

User avatar
Saetan
Posts: 3223
Joined: Wed, 1. Feb 06, 19:26
x4

Post by Saetan » Tue, 14. Dec 10, 14:52

mark_a_condren wrote:This would be ideal, but if its to much of a PITA, i can live with fixing this when final formatting the command post.
Did it ... also $Var's will be automatically colored over the whole length. But that also means (at least for now) that non-alphabetical parts, like quotas or points, at the end of the word will be colored too. But at least on its own in the middle of a sentence, $Var's should be revision-free now.

'cause I had to do major changes in the new version, it's online additionally to the old one. Both links are in the opening post. (If you made bookmarks, they will lead you automatically to the new version)

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Wed, 15. Dec 10, 04:28

Whoa, this just keeps getting better and better ...
Saetan wrote:If you made bookmarks
:) ... yep, and,
  • Direct link from browser tool bar.
  • Direct link from desktop.
  • Direct link from inside Notepad ++.
Is that showing a pattern that i'm lazy?

EDIT:
I must remember that the command used as the 'temple' still hasn't been posted as a command post yet. :)


Mark

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24965
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Sat, 5. Feb 11, 14:37

Very practical tool so far. :) I just noticed a little glitch: Sometimes the formatter doesn't marks the subcategory in SE structure under Command Location. For example:

Code: Select all

Command Location: 
»» Trade Commands 
»» Passengers 
<RetVar/IF><RefObj> get passenger array
will be formatted to

Code: Select all

[i]Command Location:[/i]
[color=red]»» Trade Commands[/color]
»» Passengers
[color=lime]<RetVar/IF>[/color][color=lime]<RefObj>[/color] get passenger array
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Locked

Return to “MSCI Reference”