a dynamic scoreboard that displays what you feed it
npm install grad-scoreboardmodules. Then create one inside there and call it grad-scoreboard.
grad-scoreboard : npm install --save grad-scoreboard
description.ext with #define MODULES_DIRECTORY node_modules
description.ext:
sqf
#include "node_modules\grad-scoreboard\grad_scoreboard.hpp"
class CfgFunctions {
#include "node_modules\grad-scoreboard\cfgFunctions.hpp"
};
`
Usage
If no second statistics array is provided, the additional window will be hidden. The parameter array can be generated with GRAD Winrate Tracker (however, if you want any other stats than games, wins, losses, winrate, winrateTracker will not work for you).
To open the scoreboard, use
[duration,main stats,main headline,rank numbers,sort,2nd stats,2nd headline,2nd rank numbers,2nd sort,disable simulation] call grad_scoreboard_fnc_loadScoreboard:
| Parameter | Explanation |
|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| duration | Number - Duration for which the dialog is displayed. -1 to disable. |
| main stats | Array - Contains all statistics to be displayed in main window (see below for correct syntax). |
| main headline | String - Title of the main window. |
| rank numbers (optional) | Bool - Display rank numbers as first column in main window? |
| sort (optional) | Bool/Array - If array: [sort statistics? (bool), index to sort by (number), sort ascending (bool)]. If bool, true: Sort by first index, descending. |
| 2nd stats (optional) | Array - Contains all statistics to be displayed in additional window (see below for correct syntax) |
| 2nd headline (optional) | String - Title of additional window. |
| 2nd rank numbers (optional) | Bool - Display rank numbers as first column in additional window? |
| 2nd sort (optional) | Bool/Array - If array: [sort additional statistics? (bool), index to sort by (number), sort ascending (bool)]. If bool, true: Sort by first index, descending. |
| disable simulation | Bool - Disable player simulation for the duration. |
Example:
[20,_allStats,"statistics of my mission",true] call grad_scoreboard_fnc_loadScoreboard
Statistics Arrays Syntax
The statistics arrays passed to the scoreboard have to be formatted in a certain way:
_allStats = [array,array,array,...]
* the first nested array is interpreted as the headline
* all nested arrays have to be the same length
* all elements of the same index have to be of the same type
* the main and additional stats arrays can be completely different
Example:
`sqf
_allStats = [
["Player name", "Points", "Kills"],
["Hans", 12, 6],
["Franz", 15, 5],
["Alf", 9, 2]
];
`
Sorting
If the statistics are to be sorted before displaying, the sort parameter is used.
[true,1,false] would sort the stats array from the previous example descending by points:
`sqf
_allStats = [
["Player name", "Points", "Kills"],
["Franz", 15, 5],
["Hans", 12, 6],
["Alf", 9, 2]
];
`
[true,2,true] would sort the stats array from the previous example ascending by kills:
`sqf
_allStats = [
["Player name", "Points", "Kills"],
["Alf", 9, 2]
["Franz", 15, 5],
["Hans", 12, 6],
];
``