Difference between revisions of "Dynamic Windows"
Line 1: | Line 1: | ||
− | These are made to be copy paste ready, leaving in the comments is strongly recommended. If you don't need all the parameters do this: | + | Dynamic Windows allow you to create a window on the server and present it to the client. |
+ | |||
+ | These examples are made to be copy paste ready, leaving in the comments is strongly recommended. If you don't need all the parameters you can do this: | ||
local dynamicWindow = DynamicWindow( | local dynamicWindow = DynamicWindow( |
Revision as of 04:47, 29 October 2016
Dynamic Windows allow you to create a window on the server and present it to the client.
These examples are made to be copy paste ready, leaving in the comments is strongly recommended. If you don't need all the parameters you can do this:
local dynamicWindow = DynamicWindow( "MyWindow", --(string) Window ID used to uniquely identify the window. It is returned in the DynamicWindowResponse event. "My Window, --(string) Title of the window for the client UI 100, --(number) Width of the window 100 --(number) Height of the window --startX, --(number) Starting X position of the window (chosen by client if not specified) --startY, --(number) Starting Y position of the window (chosen by client if not specified) --windowType, --(string) Window type (optional) --windowAnchor --(string) Window anchor (default "TopLeft") )
Please notice after the height parameter the comma was removed, this is crucial or you will receive a Lua error similar to unexpected symbol near ')'
Setting a (number) to 0 or (string) to "" is the same as not setting it.
Contents
DynamicWindow
DynamicWindow( windowId, --(string) Window ID used to uniquely identify the window. It is returned in the DynamicWindowResponse event. title, --(string) Title of the window for the client UI width, --(number) Width of the window height, --(number) Height of the window startX, --(number) Starting X position of the window (chosen by client if not specified) startY, --(number) Starting Y position of the window (chosen by client if not specified) windowType, --(string) Window type (optional) windowAnchor --(string) Window anchor (default "TopLeft") )
WindowAnchor options
- Top
- TopLeft
- TopRight
- Bottom
- BottomLeft
- BottomRight
- Left
- Right
- Center
WindowType options
- Default
- Transparent
- NoFrame
- SemiTransparent
- TriplePane
- TransparentCloseButton
- DefaultLongTitle
DynamicWindow:AddImage
dynamicWindow:AddImage( x, --(number) x position in pixels on the window y, --(number) y position in pixels on the window spriteName, --(string) sprite name width, --(number) width of the image height, --(number) height of the image spriteType, --(string) sprite type Simple, Sliced or Object (defaults to Simple) spriteHue, --(string) sprite hue (defaults to white) opacity --(number) (default 1.0) )
DynamicWindow:AddLabel
dynamicWindow:AddLabel( x, --(number) x position in pixels on the window y, --(number) y position in pixels on the window text, --(string) text in the label width, --(number) width of the text for wrapping purposes (defaults to width of text) height, --(number) height of the label (defaults to unlimited, text is not clipped) fontSize, --(number) font size (default specific to client) alignment, --(string) alignment "left", "center", or "right" (default "left") scrollable, --(boolean) scrollable (default false) outline, --(boolean) outline (defaults to false) font --(string) name of font on client (optional) )
Fonts
- PermianSlabSerifBold_24
- Kingthings_18
- PermianSlabSerif_16_Dynamic
DynamicWindow:AddButton
dynamicWindow:AddButton( x, --(number) x position in pixels on the window y, --(number) y position in pixels on the window returnId, --(string) return id used in the DynamicWindowResponse event text, --(string) text in the button (defaults to empty string) width, --(number) width of the button (defaults to width of text) height,--(number) height of the button (default decided by type of button) tooltip, --(string) mouseover tooltip for the button (default blank) serverCommand, --(string) server command to send on button click (default to none) closeWindowOnClick, --(boolean) should the window close when this button is clicked? (default true) buttonType, --(string) button type (default "Default") buttonState, --(string) button state (optional, valid options are default,pressed,disabled) customSprites --(table) Table of custom button sprites (normal, hover, pressed. disabled) )
ButtonType options
- Default
- Invisible
- Selection
- SimpleButton
- UpDownLock
- TabButton
- LeftArrow
- RightArrow
- CategoryButton
- SectionButton
- SkillSectionButton
- Selection2
DynamicWindow:AddUserAction
dynamicWindow:AddUserAction( x, --(number) x position in pixels of the window y, --(number) y position in pixels of the window userActionData, --(table) table containing the user action data width, --(number) width in pixels of the window (default decided by client) height --(number) height in pixels of the window (default decided by client) )
UserActionData Example
{ ID = "Lightning", ActionType = "Spell", DisplayName = "Lightning Spell", Tooltip = "This is a powerful spell will fux you up", IconObject = spellData.Icon, Icon = spellData.Icon, Enabled = true, Requirements = RequirementsTable, ServerCommand = "", }