Thread Tools Display Modes
01-06-10, 05:00 PM   #1
jfn302
An Aku'mai Servant
Join Date: Oct 2007
Posts: 36
Scripting Question

Ok, not sure what I'm doing wrong here. I looked at the code that generates the values for the variable fxp, and I made a script that does much the same thing, but I am getting the following error message:

Error: [string "-- UnitFrame: nil..."]:20: '=' expected near 'fp_rxp'

Here is my script:

local fp_rxp = (UnitXP("player") + (GetXPExhaustion()/2))/UnitXPMax("player");
If fp_rxp > 1 then fp_rxp = 1;
end;

Any ideas on why it is errors out?

Full text of the error message:

RDX: Could not compile unit frame.

Extended info:
-----------
Error: [string "-- UnitFrame: nil..."]:20: '=' expected near 'fp_rxp'

Code:
------------
-- UnitFrame: nil
local band,min,max,clamp = bit.band,math.min,math.max,VFL.clamp;
local strformat = string.format;
local _i, _j, _avail, _bn, _tex, _apps, _meta, _dur, _tl, _dispelt, _caster, _isStealable;
local _icons;
local bkdp_Base = { ["_border"]="HalStraight",["bgFile"]="Interface\\Addons\\VFL\\Skin\\white",["kb"]=0.43529411764706,["tile"]=false,["bg"]=0.043137254901961,["kg"]=0.43529411764706,["kr"]=0.43529411764706,["ka"]=0.50599998235703,["ba"]=1,["_backdrop"]="solid",["edgeFile"]="Interface\\Addons\\RDX_mediapack\\Halcyon\\HalBorder",["bb"]=0.043137254901961,["edgeSize"]=8,["br"]=0.043137254901961,["insets"]={ ["top"]=2,["right"]=2,["left"]=2,["bottom"]=2}};
local c1_Frame_sb_xp = { ["a"]=1,["b"]=0.46666666666667,["g"]=0,["r"]=0.36078431372549}local c2_Frame_sb_xp = { ["a"]=1,["b"]=0.46666666666667,["g"]=0,["r"]=0.36078431372549}local function _paint(frame, icv, uid, unit, a1, a2, a3, a4, a5, a6, a7)
if not unit then return; end
if not uid then uid = unit.uid; end
local paintmask = frame._paintmask or 0;
if paintmask ~= 0 then
frame.Frame_decor:Show();
local ismaxlevel = false;
if UnitLevel(uid) == 80 then ismaxlevel = true; end;
local fxp = UnitXP("player")/UnitXPMax("player");
local fpxptxt = floor((UnitXP("player")/UnitXPMax("player")) * 100) .. "% | " .. UnitXP("Player") .. " / " .. UnitXPMax("player");
if GetXPExhaustion() then fpxptxt = fpxptxt .. " " .. (GetXPExhaustion()/2).. " R"; end

local fp_rxp = (UnitXP("player") + (GetXPExhaustion()/2))/UnitXPMax("player");
If fp_rxp > 1 then fp_rxp = 1;
end;
frame.Frame_sb_xp:SetValue(fxp);
frame.Text_infoText:SetText(fpxptxt);
if false then
frame.Text_infoText:SetTextColor(explodeRGBA());
end
end
end
local function _cleanup(frame)
frame.Frame_decor:Hide();
frame.Frame_sb_xp:SetValue(0);
frame.Text_infoText:SetText("");
end

local hindex = {};
local hpri = nil;
local function _hotspot_set(frame, id, spot)
if not id then
hpri = spot;
else
hindex[id] = spot;
end
end
local function _hotspot_get(frame, id)
if id then return hindex[id]; else return hpri; end
end

local function _create(frame)
frame.Cleanup = _cleanup; frame.SetData = _paint;
frame.GetHotspot = _hotspot_get; frame.SetHotspot = _hotspot_set;
frame.Frame_decor = VFLUI.AcquireFrame("Frame");
frame.Frame_decor:SetParent(frame);
frame.Frame_decor:SetAllPoints(frame);
frame.Frame_decor:Show();
local BaseWidth = 500;
local BaseHeight = 18;
frame:SetWidth(500); frame:SetHeight(18);
frame:SetAlpha(1);
VFLUI.SetBackdrop(frame, bkdp_Base);
local _t = VFLUI.StatusBarTexture:new(frame, false);
frame.Frame_sb_xp = _t;
_t:SetOrientation("HORIZONTAL");
_t:SetPoint('TOPLEFT',frame,'TOPLEFT',2,-2);
_t:SetWidth(498); _t:SetHeight(14);
_t:Show();
_t:SetTexture(1,1,1,1); _t:SetBlendMode("BLEND"); _t:SetVertexColor(1,1,1,1);
_t:SetColors(c1_Frame_sb_xp, c2_Frame_sb_xp);
local txt = VFLUI.CreateFontString(frame);
txt:SetWidth(498); txt:SetHeight(16);
txt:SetPoint('LEFT',frame,'LEFT',1,0);
txt:SetFont("Interface\\Addons\\RDX_mediapack\\Fonts\\ComickBook_Simple.ttf", 14);
txt:SetShadowOffset(0,0);
txt:SetJustifyH("CENTER"); txt:SetJustifyV("CENTER");
txt:Show();
frame.Text_infoText = txt;
frame.Destroy = VFL.hook(function(frame)
frame.Cleanup = nil; frame.SetData = nil;
if frame then frame:SetBackdrop(nil); end
frame.Frame_sb_xpestroy(); frame.Frame_sb_xp = nil;
frame.Text_infoTextestroy();
frame.Text_infoText = nil;
frame.Frame_decorestroy(); frame.Frame_decor = nil;
frame.GetHotspot = nil; frame.SetHotspot = nil;
frame._paintmask = nil;
end, frame.Destroy);

return frame;
end

return _create;
  Reply With Quote

WoWInterface » Featured Projects » OpenRDX » OpenRDX Community » OpenRDX: Community Chat » Scripting Question


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off