<RetVar> = script engine version

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

Moderators: Scripting / Modding Moderators, MSCI Moderators

Locked
mark_a_condren
Posts: 1385
Joined: Wed, 3. Aug 05, 05:05
x3tc

<RetVar> = script engine version

Post by mark_a_condren » Tue, 7. Sep 10, 19:30

<RetVar> = script engine version


<RetVar> = Returns an integer with the version of the currently installed MSCI script engine.


As of version 2.5 of X3-TC the number is 44.

This can be used in the event you need to write a script that needs to know whether certain instructions are available – perhaps if it needs to support more than one version of the game.


Example:

$script.eng.version = script engine version

if $script.eng.version = 44

add value selection to menu: $menu, text 'Make Your Selection:', value array = $value.arr, default = 0, return id = 'returnvalue'

else if $script.eng.version < 44

$user.input = [THIS] -> get user input: type = Var/Boolien, title = 'Make Your Selection:'

end

This would be useful due to 'add value selection to menu:' not being introduced until version 44 of the script engine. If a user has a previous version the script will still work due to being able to use an alternate user input method.

(Note: For the above example the $menu and the $menu return would also need to be scripted to also check the $script.eng.version to adapt accordingly.)


Command Location:

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

[TiP][49] 286400

Post by X2-Illuminatus » Fri, 17. Sep 10, 15:02

<RetVar> = script engine version


<RetVar> = Gibt eine ganze Zahl mit dem Wert der zurzeit installierten MSCI Script-Engine zurück.

Seit Version 2.5 von X3-TC ist die Zahl 44.

Dies kann genutzt werden, falls man ein Script schreibt, das wissen muss, ob bestimmte Befehle verfügbar sind - z.B. wenn es mehr als eine Spielversion unterstützen soll.


Beispiel:

$script.eng.version = script engine version

if $script.eng.version = 44

add value selection to menu: $Menu, text 'Triff deine Wahl:', value array = $value.arr, default = 0, return id = 'Rückgabewert'

else if $script.eng.version < 44

$Nutzer.Eingabe = [THIS] -> get user input: type = Var/Boolien, title = 'Triff deine Wahl:'

end

Dies ist nützlich, da 'add value selection to menu:' erst mit Version 44 der Script-Engine hinzugefügt wurde. Wenn ein Nutzer eine frühere Version nutzt, wird das Script aufgrund der alternativen Nutzereingabe immernoch funktionieren.

(Beachte: Für das obige Beispiel müssten $menu und der Rückgabewert von $menu erstellt werden, um zu prüfen, ob auch ihre $script.eng.version übereinstimmen.)


Zu finden unter:
Last edited by X2-Illuminatus on Wed, 24. Nov 10, 21:36, edited 3 times in total.

User avatar
Capux
Posts: 2141
Joined: Sat, 31. Oct 09, 22:17
x4

[TiP] [34] 286400

Post by Capux » Thu, 23. Sep 10, 21:08

<RetVer> = script engine version

<RetVer> = restituisce un intero con la versione attualmente installata del motore script MSCI.

Per esempio la versione dell'MSCI di X3TC 2.5 è 44.

Può essere usato nel caso tu abbia bisogno di scrivere uno script che necessita certi comandi e vuoi sapere se sono disponibili - magari se lo script deve supportare più versioni del gioco.

Esempio:

$script.eng.version = script engine version

if $script.eng.version = 44

add value selection to menu: $menu, text 'Make Your Selection:', value array = $value.arr, default = 0, return id = 'returnvalue'

else if $script.eng.version < 44

$user.input = [THIS] -> get user input: type = Var/Boolien, title = 'Make Your Selection:'

end

Può essere utile per via del comando 'add value selection to menu' che non è stato introdotto prima della versione 44 dell'MSCI (o di altri simili). Se un utente ha una versione precedente del gioco lo script funziona comunque grazie ad un metodo di input alternativo presente anche nelle precedenti versioni.

(Nota: per l'esempio qui sopra la variabile $menu e $menu restituita sono state scriptate per regolare di conseguenza la variabile $script.eng.version).


Posizione dell'istruzione nella lista:

Locked

Return to “MSCI Reference”