Register new account
Skada Damage Meter
=== Datasets === Modes and display modules both operate on window datasets. The dataset is populated by the mode module and displayed by the display module. A dataset is an indexed table with each row representing one item. The dataset is only cleared when the active mode is changed. The display system should render all rows that have an "id" property. Attributes are: * id, a unique id for the item * label, a name for the item * value, the current value of the item * valuetext, a descriptive string for the value * color, an optional color to be used by the display * class, optional player class to possibly be used for color by the display === Mode API === Modes have only 1 required function, Update. The rest can be implemented if desired. Modes can have a "metadata" property, a dictionary table with hints on how to interpret the data. Common metadata properties are: * click1, which should be another mode * click2 * click3 * tooltip, which should be a function, triggered when mousing over an item * showspots, a boolean, ask the display systems to show order numbers in front of items * ordersort, which asks the display system to disregard the value in favor of raw order in the data table when ordering items * columns, a dictionary table with column names as key and default boolean state (true/false) as values. Modes add themselves to Skada by using the Skada:AddMode function. <<code lua>> -- Called when a Skada window wants its dataset updated. function mod:Update(win, set) -- This should return a suitable summary value (like the RDPS). function mod:GetSetSummary(set) -- Called by Skada when a new set is created. -- This is where the mode should add any required attributes or subtables to the set. function mod:AddSetAttributes(set) -- Called by Skada when a new player is added to a set. -- The mode should add any required attributes or subtables to the player. function mod:AddPlayerAttributes(player) -- Called by Skada when the user mouses over its tooltip. function mod:AddToTooltip(set, tooltip) <</code>> === Display system API === All these functions take a "Window" as parameter. A Window is a table with a metadata and dataset subtables. Metadata is used to give hints to the display how to present the data, and the dataset is an uptodate table of data created by a mode. The built-in bar display module is quite complex with tons of options, but a display system can be much simpler. Display systems register themselves by adding themselves to the dictionary table Skada.displays. <<code lua>> -- Called when a Skada window starts using this display provider. function mod:Create(window) -- Called by Skada windows when the window is to be destroyed/cleared. function mod:Destroy(win) -- Called by Skada windows when the window is to be completely cleared and prepared for new data. function mod:Wipe(win) -- Called by Skada windows when the display should be updated to match the dataset. function mod:Update(win) function mod:Show(win) function mod:Hide(win) function mod:IsShown(win) -- Called by Skada windows when window settings have changed. function mod:ApplySettings(win) -- Display can add options here. function mod:AddDisplayOptions(win, options) <</code>>
The type of markup for this entry.
Click here for details