sortInitiative: Difference between revisions
Jump to navigation
Jump to search
(Adding optional reverseOrder param coming in 1.8) |
No edit summary |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
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. | * The Default sort order is ''descending'', with any non-numeric values coming after any numbers, and any blank values coming last. | ||
* '' | * ''Since 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= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
sortInitiative() | sortInitiative() | ||
sortInitiative(reverseOrder) | sortInitiative(reverseOrder) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|reverseOrder|'' | {{param|reverseOrder|''Since 1.8''. Whether the list should be sorted in Reverse (ascending) order - defaults to {{code|false}} ({{code|0}})}} | ||
|example= | |example= | ||
Examples showing each sort order: | Examples showing each sort order: |
Latest revision as of 23:59, 14 March 2023
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.
- Since 1.8: If the
reverseOrder
parameter is1
, 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()
sortInitiative(reverseOrder)
Parameters
reverseOrder
- Since 1.8. Whether the list should be sorted in Reverse (ascending) order - defaults tofalse
(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