Quicksort Plugin
⚪ Last updated 2019Preview

🔍 Analysis
- 🏆 #35 of 43 Utilities mods in this game by downloads
📋 About This Mod
Provides an interface for a custom sort use cases
The plugin will provide a possibility for mod scripts to utilize the imo most efficient (in terms of speed and memory usage) sorting algorithm existing.
It will not change any parameter or things ingame.
This mod is solely ment for developer to work with.
Please be aware following decriptions is for developer which intend to use this mod:
Mod developer can use the sorter by calling the 'quicksort' script.
It will sort the given objects list by its given values ascending
Example of use:
<run_script name="'quicksort'">
<param name="objects" value="$UnsortedObjects"/>
<param name="values" value="$UnsortedValues"/>
<save_retval name="sortedobject" variable="$SortedObjects" />
<save_retval name="sortedvalue" variable="$SortedValues" />
</run_script>
While $UnsortedObjects contain the Object which are not sorted $UnsortedValues contain the values after which are to be sorted.
$UnsortedObjects can contain any value, no matter which type.
$UnsortedValues has to contain a float or integer type value.
$UnsortedObjects and $UnsortedValues have to contain the same amount of entries.
$SortedObjects and $SortedValues contain the sorted values of the respective input after script has finished.
How does it work:
Lets give another example:
Lets assume $UnsortedObjects has following data
and $UnsortedValues has following data
Each element of both lists on the same index are refering to each other, which means for the sort algorithm the first value of
$UnsortedObjects (wareY) has the value of the first element of $UnsortedValues (2) and so on.
This gets important when we know it all of them will be sorted ascending by their values.
Result in this case after running the sort script would be:
$SortedObjects
$SortedValues
Elements are now sorted while $SortedValues contain their values ascending, and their respective objects in their partner list changed their order respectively.
This will work for lists of ANY size.
Example usecase:
You want to sort a bunch of stations for their cargo size (for example).
This is how:
First iterate your station list to set the value list to sort after:
<create_list name="$UnsortedStationValues" />
<do_all exact="$UnsortedStations.count" counter="$b">
<append_to_list name="$Unsorted
📊 Mod Details
- Game
- X4foundations Mods
- Author
- Ramokthan
- Version
- 1.1
- Downloads
- 121
- Endorsements
- 2
- Category
- Utilities
- Created
- 7/7/2019
- Updated
- 7/9/2019
🔧 How to Install X4: Foundations Mods
Download from Nexus Mods.
📖 Full step-by-step install guide for X4: Foundations →
Visit the official mod page for specific installation instructions for this mod.
🎮 Need cheat codes or console commands? Check ur gaming wiki for X4: Foundations commands, item IDs, and more.
Keep browsing — more X4: Foundations mods await