Quantcast
Download
(357 Kb)
Download
Updated: 02-13-12 03:58 AM
Updated:02-13-12 03:58 AM
Created:02-13-12 03:58 AM
Downloads:54
Favorites:0
MD5:
LibScriptableRift-1.0
Version: 1.0-786fccc
by: starlon [More]
LibScriptable implements the tools involved in building an LCD simulation in Rift. A much simpler version simply offers a programmable text widget. You provide a text string, return the text or number you want to print, and use LibTimer to keep the text updated.

You have multiple "plugins" available. These provide the script environment with fields such as Unit*(), DPS(), SimpleMeter(), BLEND*(), Color2HSV(), etc...

Check the readme. Documatation is available under the docs/ directory. And is also located at the following location, but it is incomplete: LibScriptableRift on Github

Here's an example of a single text widget.

Code:
local LibCore = LibStub("LibScriptableLCDCoreLite-1.0")
local WidgetText = LibStub("LibScriptableWidgetText-1.0")

-- Create a text that we'll "draw" on. aka, text:SetText()
local ctx = UI.CreateContext("My Context")
local text = UI.CreateFrame("Text", "My Text", ctx)
text:SetPoint("CENTER", UIParent, "CENTER")
text:SetVisible(true)
text:SetFontSize(50)
text:SetBackgroundColor(0, 0, 0, 1)

-- Create our "core" object. 
-- This just simply fills "envrionment" with plugin functions.
local environment = {}
local visitor = LibCore:New(environment, "My Core")

-- First we give it a name, then a config. 
-- This is a 1 second repeating widget.
local name = "My Widget"
local config = {
    value="return floor(rand(100))", -- This is your Lua script.
    color="return ClassColor(unit)", -- unit is provided by widget:Start("player")
    repeating = true, -- This widget repeats till widget:Stop() is called.
    update = 1000, -- Update at 1 second intervals
}
local col, row, layer = 0, 0, 0 -- These are for convenience and optional.
local errorLevel = 3 -- Most verbose.

-- we provide the widget with a "draw" callback. 
-- This is called at the end of each refresh. In our case, every second.
local function callback(widget)
     text:SetText(widget.buffer or "")
     text:ResizeToText()
     text:SetFontColor(widget.color.ret1, widget.color.ret2, widget.color.ret3)
end

-- Create the widget
local widget = WidgetText:New(visitor, name, config, row, col, layer, errorLevel, callback)


-- Make sure player's available before calling ClassColor(unit).
table.insert(Event.Unit.Available, { function()
    widget:Start("player")
end, "Example", "System loaded..."})
Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump: