<RetVar> = sort array: data = <Value> sort values = <Value>

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: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

<RetVar> = sort array: data = <Value> sort values = <Value>

Post by mark_a_condren » Tue, 14. Sep 10, 17:50

<RetVar> = sort array: data = <Value> sort values = <Value>


<RetVar> = The name for the new sorted array.
<Value> = This array will have its value sorted based on the values from the next array.
<Value> = The values in this array will be used to sort the values for the previous array.


Sorts the data array by the values found in the sort array.


Example:

If you were to get a list of all wares available in a particular sector and store them in an array. Then go through that list and get a corresponding array of all the Minimum values for these wares, you could sort the list of wares by their minimum value based on the array containing these values.


$ware.array = Array containing all the wares from the sector.
$min.cr.array = Array containing the minimum credits for the wares.

The above arrays must have corresponding indexes. ie.
$ware.array [0] = Ware "A"
$min.cr.array [0] = Ware "A" min credits.

You could then use the following to sort $ware.array in assending order of their minimum credits.

$sorted.ware.array = sort array: data = $ware.array sort values = $min.cr.array


Command Location:

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

[TiP][49] 286904

Post by X2-Illuminatus » Sat, 9. Oct 10, 23:03

<RetVar> = sort array: data = <Value> sort values = <Value>


<RetVar> = Der Name, des neu sortierten Arrays.
<Value> = Diesem Array werden seine Werte auf Grundlage der Werte des nächsten Array sortiert.
<Value> = Die Werte in diesem Array werden genutzt, um die Werte des vorherigen Arrays zu sortieren.


Sortiert das Daten-Array über die Werte aus dem Sortieren-Array.


Beispiel:

Wenn du alle verfügbaren Waren in einem bestimmten Sektor erhalten wollen würdest und sie in einem Array speicherst, könntest du danach durch diese Liste gehen und ein dazugehöriges Array erstellen, in dem alle minimalen Werte dieser Waren gespeichert sind. Damit könntest du dann die Warenliste nach ihren minimalen Werten ordnen, basierend auf einem Array, das diese Werte enthält.


$ware.array = Array, das alle Waren des Sektors enthält.
$min.cr.array = Array, das die minimalen Preise der Waren enthält.

Die obigen Arrays müssen übereinstimmende Stellen haben, z.B.
$ware.array [0] = Ware "A"
$min.cr.array [0] = Ware "A" minimale Preise.

Du kannst anschließend, wie folgt, vorgehen, um $ware.array in aufsteigender Reihenfolge nach den minimalen Preisen zu sortieren:

$sorted.ware.array = sort array: data = $ware.array sort values = $min.cr.array


Zu finden unter:

Locked

Return to “MSCI Reference”