[lib] Script Libraries by SymTec ltd.

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
User avatar
SymTec ltd.
Posts: 5285
Joined: Mon, 11. Apr 05, 21:11
x3tc

[lib] Script Libraries by SymTec ltd.

Post by SymTec ltd. » Wed, 17. Jan 07, 23:17

This collecting thread contains the Script libraries I wrote for X³. I just think that much work is saved if people share their work instead of doing all the same thing parallel.

The following Libraries are currently up here: For info: There will be no .spk-files of these libraries. I do not see any reason why that would make things easier, it's just more work in this particular case.


Player Possession and Ship Hardware library V1.0

If you want to know how far into the game a script user (player) got, maybe to fine him properly for something in a script, to find out how much money he would be happy about etc., you should know how much money the player has got and what property he owns. This library can find out all of this, either for all player property or for one station/ship.
In addition, the first library script is able to return an Array of all equipment a player has got on a ship. I never found a way other than asking for every equipment there is, and it is a lot of work to write that down in a script. I did, so you don't have to...

This library contains three little scripts doing the following:

lib.st.hardwarearrayship - DE/EN - 17.01.2007 - .xml(.zip.)
This script returns an Array of all ship hardware (equipment) found on a specific ship. You enter the ship, the script will return the array. If you don't enter a correct ship or a ship without equipment, you'll get "null". This script is written pretty simple, it just tests for every known software whether it is installed or not. It uses all softwares found in X³ 2.0.02 and the BonusPack released on Dec 24th, 2006. There is a better way to do this, but this script can be modified so it installs all this hardware, which the other library there is would have a big problem with.
  • Input:
  • Var/Ship , 'Ship' - Ship to get hardware of
    Output:
  • Var/Array - Array of hardware found

    Other Scripts required: no
lib.st.playerownedvalue - DE/EN - 17.01.2007 - .xml(.zip.)
This script returns a number which equals (to a certain degree) the total value of all the player's posessions. This command will take the longer, the more ships and stations the player has got and the more output you request. Finding all stations is easy, but calculating the price for every ware of every station is not.
  • Input:
  • Var/Boolean , 'Bankaccounts' - Should all player and station bank accounts be tested? (True/False)
  • Var/Boolean , 'Stations' - Should all player stations be tested? (True/False)
  • Var/Boolean , 'Ships' - Should all player ships be tested? (True/False)
  • Var/Boolean , 'Wares in Ships and Stations' - Should all wares stored in ships and stations be tested? (True/False)
  • Var/Boolean , 'Equipment on Ships' - Should the ship equipment be tested? (True/False)

    Other Scripts required: lib.st.hardwarearrayship, lib.st.stationvalue

lib.st.stationvalue - DE/EN - 17.01.2007 - .xml(.zip.)
This script returns the credit value of a station or ship (It is called "stationvalue", but still, it covers ships, too!). The output is of type integer and "0" for incorrect inputs and other problems.
  • Input:
  • Var/Ship/Station , 'Ship or Station' - Ship/Station to get value of (Ship/Station)
  • Var/Boolean , 'Bankaccounts' - Should a station bank account be tested? (True/False)
  • Var/Boolean , 'Wares in Ships and Stations' - Should all wares stored in ship or station be tested? (True/False)
  • Var/Boolean , 'Equipment on Ships' - Should ship equipment be tested? (True/False)

    Other Scripts required: lib.st.hardwarearrayship
Questions?

Direct download
[ external image ]

>>>Download-page<<<
Last edited by SymTec ltd. on Thu, 3. Jan 08, 15:11, edited 2 times in total.

User avatar
SymTec ltd.
Posts: 5285
Joined: Mon, 11. Apr 05, 21:11
x3tc

Post by SymTec ltd. » Sun, 4. Feb 07, 18:37

Safe route library

>>>download page<<<

This packet contains five scripts that help a ship find a secure route through the universe. As the scripts need to be called from other scripts, this is only useful for scripters and does not help other players.
The script "lib.st.findsaferoute" is the one I wrote this packet for - it works like the Xenon/Terraformers did (or better: as they did not): It simulates a bunch of explorers moving forward through the universe, moving on as they find their sectors safe, leaving a roadsign behind that tells the way back. If this bunch comes to a crossing, it splits up. If it finds danger or another roadsign, it just stops. If an explorer finds the destination, he sends a little boy running back through the universe, collecting all the roadsigns, so the motherscript knows which way the explorers got to the destination fastest. That's how H5N1, the Xenon, a brushfire, water inside a wrecked ship and a normal array work, and I think it's a nice way to manage this task. Further updates will be announced, so I suggest changing the names of the scripts (and all calls!) for internal use if no update is wanted.


lib.st.safesector.xml - DE/EN - 04.02.2007 - .xml(.zip)
This Script checks whether a sector is safe or not.
  • Input:
  • Var/Sector , 'Sector' - Sector you want to have checked
  • Var/Array , 'Avoid Race Array' - Array of Races you want to avoid. Only input Array!
  • Var/Array , 'Avoid Ship Type Array' - Array of Ship Types/Classes you want to avoid. Only input Array!
  • Var/Array , 'Only Ply Ship Type Array' - Array of Player Ship Types/Classes you need to have in that sector
  • Var/Boolean , 'Only known Sectors' - Return FALSE if sector is not known

    Output:
  • TRUE - Sector is safe
  • FALSE - Sector is not safe

    Other Scripts required: no
lib.st.saferoute.xml - DE/EN - 04.02.2007 - .xml(.zip)
This Script checks whether a route between two sectors or objects is safe or not.
  • Input:
  • Var/Ship/Station , 'Object1' - first object
  • Var/Ship/Station , 'Object2' - second onject
  • Var/Boolean , 'Use Satellites?' - Use Sats and Adv Sats?
  • Var/Boolean , 'Only known Enemy Ships?' - Only check for Enemies visible on the map
  • Var/Boolean , 'Avoid Enemy Secs?' - Check whether a sector is listed as enemy in the commands of [THIS] (or [PLAYERSHIP] for Global tasks)

    Output:
  • TRUE - Route is safe
  • FALSE - Route is not safe

    Other Scripts required: no

lib.st.move.route.xml - DE/EN - 04.02.2007 - .xml(.zip)
Makes a ship move along a certain route array. You enter an Array of sectors, the ship will follow this array from first to last entry.
  • Input:
  • Var/Ship , 'Ship' - [THIS] in most cases - be carful not to have another move-command running on the ship at the same time
  • Var/Array , 'Route Array' - Array of Sectors

    Output:
  • FALSE if the ship did not arrive in last sector
  • TRUE if the Ship did arrive

    Other Scripts required: no

lib.st.findsaferoute.xml - DE/EN - 04.02.2007 - .xml(.zip)
This is a pretty high level script that lets a ship calculate/find out the best route from A to B. It will only pass safe sectors, so it will avoid Xenon areas, Kha'ak Invasions and and other problematic zone. Due to its complexity, this script will only be able to run once at a time, and as it is written to influence the performance as little as possible, it might in some cases take more than a minute to complete. So, if you call this script too often, the calls will queue up, slowing down whatever ship you want to move with this script. If the waiting time exceeds 15 Minutes, a complete shutdown of all scripts of this type is initiated to prevent crashes. You can input Arrays for custom wishes and TRUE/FALSE for the default settings.
  • Input:
  • Var/Sector , 'Start' - start sector
  • Var/Sector , 'Destination' - destination sector
  • Var/Array/Boolean , 'Avoid Race Array/Avoid Enemy' - Array of Races you want to avoid
    Default: TRUE: Pirate, Xenon, Kha'ak FALSE: none
  • Var/Array/Boolean , 'Avoid Ship Type Array/Avoid Ship' - Array of Ship types you want to avoid
    Default: TRUE: M5-M1 FALSE: none
  • Var/Array/Boolean , 'Only Ply Ship Type Array/NavSat?' - Array od Player ship types you need to have (e.g. M6 as Sector patrol)
    Default: TRUE: Satellites, Adv Sats
  • Var/Boolean , 'Only known Sectors' - TRUE: Find only sectors you know - FALSE: Also fly through unknown sectors

    Output:
  • Array of Sectors: this route is safe
  • FALSE: no safe route found

    Other Scripts required: lib.st.safesector.xml, lib.st.managesafesec.xml, lib.st.findsaferoute.reset.xml
lib.st.managesafesec.xml Script for internal use only. Please do not refer to this in external scripts, as it might start off about 200 Scripts and prevent any further route search to start.

lib.st.findsaferoute.reset.xml Script for reset - start this script manually to reset all values and stop the current running findsaferoute-script. Obvoiusly, the programmer of the Terraformer-fleet forgot this script...

direct download:
[ external image ]

>>>download page<<<

User avatar
SymTec ltd.
Posts: 5285
Joined: Mon, 11. Apr 05, 21:11
x3tc

Post by SymTec ltd. » Sun, 4. Feb 07, 18:38

Three new Libraries written for Information Management:


lib.st.reversearray - DE/EN - 18.02.2007 - .xml(.zip)
This script reverts the order of data of one array and stores it in another. What is first in the Input Array will be last in the Output Array. Somewhat biblical, but necessary for most bigger scripts. It is based on the script lib.ad.reversepath from the Bbonuspack.
  • Input:
  • 1: Array , Var/Array , 'Array' - Array to revert

    Output:
  • Array (another one!)
[ external image ]


lib.st.formatnames - DE/EN - 18.02.2007 - .xml(.zip)
This script converts an Array of Data into a String list that can be displayed to the user via logfile etc. without worries. An ugly output like
ARRAY(Your Eclipse(Argon Prime),Your Buster(Trinity Sanctum),NavSat II(Home of Light),...)
will after the Script look like
Your Eclipse, Your Buster, NavSat II.
This way, ship- or station lists can be made look nice to the eye, Array-Lists of stupid values are converted into beautiful strings.
  • Input:
  • 1: Array , Var/Array , 'Array' - Array of Entries
  • 2: Separator , Var/String , 'Separator' - String to separate each entry from the next
  • 3: GetName , Var/Boolean , 'GetName' - Shall the whole object definition be taken up into the string, or only the name of the object?

    Output:
  • String of data
[ external image ]


lib.st.getsectorsize - DE/EN - 18.02.2007 - .xml(.zip)
This script calculates the average distance of each sector gate to another via the sector center, so that one can approximately see how big the sector really is, e.g. for sending patrol ships or setting up satellite networks.
  • Input:
  • 1: Sector , Var/Sector , 'Sector' - Sector

    Output:
  • Number (Sector size in meters)
[ external image ]


link here
Last edited by SymTec ltd. on Sun, 18. Feb 07, 22:26, edited 2 times in total.

User avatar
SymTec ltd.
Posts: 5285
Joined: Mon, 11. Apr 05, 21:11
x3tc

Post by SymTec ltd. » Sun, 4. Feb 07, 18:39

lib.st.md.message.ask (Incoming Question Handler) - DE/EN - 03.01.2008 - .xml(.zip)
This script-MD-package handles any question you want to ask the player. It pops them up on the player's screen and does not write them to the player logbook.
  • Input:
  • 1: pageid , Var/String/Integer , 'pageid OR message string' - pageid of the message to ask, or complete message as string
  • 2: textid , Var/Integer , 'textid OR null' - textid of the message to ask, or null if message string provided
  • 3-7: arg1-arg7 , Var/String , 'arg OR null' - 5 arguments to enter into the message string for dynamic messages

    Output:
  • String/Integer (answer from the select of the textfile)
[ external image ]
Last edited by SymTec ltd. on Thu, 3. Jan 08, 15:08, edited 1 time in total.

User avatar
SymTec ltd.
Posts: 5285
Joined: Mon, 11. Apr 05, 21:11
x3tc

Post by SymTec ltd. » Sun, 4. Feb 07, 18:40

reserved3 (yes, that's it...)

wga
Posts: 34
Joined: Thu, 19. Feb 09, 15:04

Where to download these lib?

Post by wga » Fri, 6. Mar 09, 06:40

The link is dead.

Post Reply

Return to “X³: Reunion - Scripts and Modding”