sortInitiative: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Fixing wikilinks)
(Adding optional reverseOrder param coming in 1.8)
Line 6: Line 6:
|description=
|description=
Sorts the [[Initiative:Initiative Panel|Initiative Panel]] [[Token]]s and returns the number of [[Token]]s in the [[Initiative:Initiative Panel|Initiative Panel]].
Sorts the [[Initiative:Initiative Panel|Initiative Panel]] [[Token]]s and returns the number of [[Token]]s in the [[Initiative:Initiative Panel|Initiative Panel]].
* The Default sort order is ''descending'', with any non-numeric values coming after any numbers, and any blank values coming last.
* '''Coming in 1.8''': If the {{code|reverseOrder}} parameter is {{code|1}}, this order is reversed - blank values come first, and any non-numeric strings (in ascending lexical order) come before numbers (in ascending order).


|usage=
|usage=
Line 11: Line 13:
sortInitiative()
sortInitiative()
</source>
</source>
==== Options Coming in 1.8 ====
<source lang="mtmacro" line>
sortInitiative(reverseOrder)
</source>
'''Parameters'''
{{param|reverseOrder|'''Coming in 1.8'''. Whether the list should be sorted in Reverse (ascending) order - defaults to {{code|false}} ({{code|0}})}}
|example=
Examples showing each sort order:
{{{!}} class="wikitable"
{{!}}-
!
!Default Order
!Reverse Order
{{!}}-
!Command
{{!}}{{code|sortInitiative()}}<br/>{{code|sortInitiative(0)}}
{{!}}{{code|sortInitiative(1)}}
{{!}}-
!Result
{{!}}[[File:InitiativePanel_DefaultOrder.png]]
{{!}}[[File:InitiativePanel_ReverseOrder.png]]
{{!}}}
|changes=
* '''1.3b41''' - Added function.
* '''1.8''' - Added optional param to control the order used when sorting
}}
}}
[[Category:Initiative Function]]
[[Category:Initiative Function]]

Revision as of 02:11, 7 September 2020

 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.

sortInitiative() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.3b41
Sorts the Initiative Panel Tokens and returns the number of Tokens in the Initiative Panel.
  • The Default sort order is descending, with any non-numeric values coming after any numbers, and any blank values coming last.
  • Coming in 1.8: If the reverseOrder parameter is 1, this order is reversed - blank values come first, and any non-numeric strings (in ascending lexical order) come before numbers (in ascending order).

Usage

sortInitiative()

Options Coming in 1.8

sortInitiative(reverseOrder)

Parameters

  • reverseOrder - Coming in 1.8. Whether the list should be sorted in Reverse (ascending) order - defaults to false (0)

Example

Examples showing each sort order:
Default Order Reverse Order
Command sortInitiative()
sortInitiative(0)
sortInitiative(1)
Result


Version Changes

  • 1.3b41 - Added function.
  • 1.8 - Added optional param to control the order used when sorting