Scripting questions

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Browser_ice
Posts: 488
Joined: Sun, 5. Feb 06, 17:15
x4

Scripting questions

Post by Browser_ice »

Hi, I started to look at all the aiscripts of the vanilla version without DLC.

I have a few questions and I am pretty sure I will have others too later on.

1) what is the first scripts that get executed upon loading up a save game or starting a new game ?

2) if there is no script versions indicated, is it considered version=1 by default (ex: script boarding.pod) ?

3) if there is no priority indicated, what priority is it considered by default (ex: boarding.pod) ?

4) will it always be the scripts with last version to be automaticaly chosen/executed ?

5) how to know what parms are being passed on to any scripts ?

6) how to get the description and their calling/returning parms of all functions called by scripts ? (I am making of list of them)
ex:
...
<add_actor_to_room ... >
<add_ammo ... >
<add_cargo ... >
<add_default_production_wares ... >
<add_faction_relation ... >
<add_relation_boost ... >
<add_to_group ... >
<add_tradeware ... >
...

7) what's the difference between these two ? When is one to be used.
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml version="1.0" encoding="utf-8" ?>

8) when a text is passed on as a value, if I add "$" it will be the content of the variable passed on as text ? ex: "variable" vs "$variable"

9) the option comment="xxx" can be used on every single commands/scripts ?

10) is there a place where all the script commands are explained with their options/parms ? (I am making a list of them)

11) is there a place where all objects are listed and described with their sub-commands/properties ?
ex:
...
player.entity
player.galaxy
player.platform
player.primaryship
player.ship
...

12) Is there a place where all the possible classes are listed and described ?
so far I have :
class.adsign
class.asteroid
class.buildmodule
class.cockpit
class.collectable
class.destructible
class.dockingbay
class.dronelaunchpad
class.engine
class.enginebooster
class.highway
class.jumpdrive
class.launchpad
class.shieldgenerator
class.ship
class.ship_l
class.ship_m
class.ship_s
class.ship_xl
class.ship_xs
class.station
class.storage
class.turret
class.weapon

13) Are all variables defined as Local by default ?
Ubuntu 24.04 playing with ProtonDB
Intel I7-12700K
32Gb Memory
Nvgidia RTX-3060
iforgotmysocks
Posts: 1244
Joined: Fri, 8. Nov 13, 22:35
x4

Post by iforgotmysocks »

Not gonna answer all your questions cause i'm too rusty and might get alot wrong, but u can find alot answers just by taking a look at the md guide.

http://www.egosoft.com/download/x_rebir ... rGuide.pdf

Also what u're looking for regarding types and members check out the libraries/scriptproperties.xml

Functions, properties and stuff are defined in .xsd files. Using a editor that can use those schemata can help you by listing all the functions, their properties, pops up class types for you to choose and shows what parameters are passed on from events/conditions.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

1. i think an MD Root Cue without Conditions serves this purpose

2. yes,, could also be Version 0 internally (and i am pretty sure it was) but assuming 1 is safer

3. not enough to interrupt anything.. had this Problem often with my folllow script when i forgot to add it. so if not defined it seems to default to 0

4. no idea - didnt test what happens if multiple Mods provide the same Scripts so far.. the only purpose i know of is to sort out at which Blocking Action a Game was saved in case you added some in-between (dont forget to add the sinceversion ) and if Patch Actions should be performed...

5. Check the Script Files which are calling them

6. as the previous Poster already said this is defined in the md files aiscripts.xsd, md.xsd and common.xsd (the last one is included by both first ones and contains all shared Commands)
you can find them in the extracted Game Files in the Libraries Folder.
Not sure what purpose a List would serve though, there are XML Editors which have autocompletion based on XSD files so you dont have to look up which Sub-Nodes or Attributes they have

7. File Encoding of the Script you saved. for most files there shouldnt be a difference since both are binary-compatible with ASCII, the difference is when adding non-englisch chars like ä, ü, ö, ß - their respective bit codes represent a diffrent character in the other encoding.

8. i think the question is moot because you pass Strings like this:
<set_value name="***" exact="'variable'"/>
and use Variables like this:
<set_value name="***" exact="$variable"/>
this Expression, which you are asking about, is invalid and will result in an invalid expression error:
<set_value name="***" exact="variable"/>
(note: for further Scripting the result value of an invalid expression is null)

9. didnt encounter one where there wasnt one yet.
<!-- but i prefer XML Comments in most cases -->

10. see 6

11. scriptproperties.html
note that this File depends on some other Files from the extracted Game, so best it to extrct it all to one Folder to have all current stuff
(hint: the Field on the Top helps you to put together valis Expressions - for example when you type "$ship." there it will list all Properties which are available for Vars containing a Ship, and it works for a property chain of any leghth you need ;) )

12. see 11. just type "class." at the top

13.1 for AI Scripts Vars are only used in the respective AI Script (so Script-Local) - you can access them for an entity by using the Syntaxy $entity.$variable (or, in most cases this.$variable is used to acces the Variables on the Blackboard of the NPC running the Script - Object-local)
if you need a Global Variable the syntax global.$variable is used

13.2 for MD Scripts things are a bit more Complex, but per default (no further settings provided) all Variables are Local to the MD Script (so MD File-local). you can do much more complex things thanks to namespaces though. Also you can acces the same Blackboard and global Variables as in 13.1 using the same syntax (except for "this.$variable since MD is not bound to an entity). In Additon for some reason MD has an additional Set of Global Vars using "md.$variable"



and as last thing my current Game Extraction Script - it extracts all Game Data in a sub-folder for easy reference ;) (just put these two lines into a .bat file next to the XRCatTool.exe from the X Rebirth Tools ):

Code: Select all

mkdir "..\X Rebirth\XR_extracted"
XRcatTool.exe -in "..\X Rebirth\01.cat" "..\X Rebirth\02.cat" "..\X Rebirth\03.cat" "..\X Rebirth\04.cat" "..\X Rebirth\05.cat" "..\X Rebirth\06.cat" "..\X Rebirth\07.cat" "..\X Rebirth\08.cat" "..\X Rebirth\09.cat" "..\X Rebirth\10.cat" -out "..\X Rebirth\XR_extracted"
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Return to “X Rebirth - Scripts and Modding”