Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: Nortwin on February 03, 2013, 10:19:45 pm

Title: GlueButtons.lua problem!
Post by: Nortwin on February 03, 2013, 10:19:45 pm
Hey Modcraft!

I am doing a remake of the LUA files (GlueXML), to customize a login screen.
However, when I log in, I get this:

(http://i.minus.com/jC3gyJPkdI58J.jpg)

What have I screwed in GlueButtons.lua?

Here is my code:

http://pastebin.com/KuPWdN5T (http://pastebin.com/KuPWdN5T" onclick="window.open(this.href);return false;)

Thank you all!

Nortwin
Title: Re: GlueButtons.lua problem!
Post by: schlumpf on February 04, 2013, 05:03:02 pm
deleted bump
Title: Re: GlueButtons.lua problem!
Post by: stoneharry on February 04, 2013, 06:55:16 pm
Line 11 index in table is nil.

if ( _G[self:GetName().."Rays"]:IsShown() ) then

_G (the global Lua storage location) does not index the name of the object & Rays. No idea what would cause that, but a temporary hack fix:

Code: [Select]
SECONDS_PER_PULSE = 0.75;

function GlueButtonMaster_OnUpdate(self, elapsed)
if VX_MUSICTIMER then
if VX_MUSICTIMER < GetTime() then
VX_ONMUSIC = true;
PlayLoginMusic();
end
end
if (_G[self:GetName().."Rays"]) then
if ( _G[self:GetName().."Rays"]:IsShown() ) then
local SECONDS_PER_PULSE = 0.75;
local sign = self.pulseSign;
local counter;

if ( self.startPulse ) then
counter = 0;
self.startPulse = true;
sign = 1;
else
counter = self.pulseCounter + (sign * elapsed);
if ( counter > SECONDS_PER_PULSE ) then
counter = SECONDS_PER_PULSE;
sign = -sign;
elseif ( counter < 0) then
counter = 0;
sign = -sign;
end
end

local alpha = counter / SECONDS_PER_PULSE;
_G[self:GetName().."Rays"]:SetVertexColor(1.0, 1.0, 1.0, alpha);

self.pulseSign = sign;
self.pulseCounter = counter;
end
end
end
Title: Re: GlueButtons.lua problem!
Post by: schlumpf on February 04, 2013, 07:02:08 pm
That's not a fix. The fix would be having the object in the interface.
Title: Re: GlueButtons.lua problem!
Post by: stoneharry on February 04, 2013, 07:56:01 pm
Quote from: "schlumpf"
That's not a fix. The fix would be having the object in the interface.

"Hack-fix",

It will fix the error message being displayed which is the primary issue at the moment. Implementing it properly by having the non-required object displayed is not necessary but preferable.
Title: Re: GlueButtons.lua problem!
Post by: schlumpf on February 04, 2013, 08:32:49 pm
Quote from: "stoneharry"
It will fix the error message being displayed which is the primary issue at the moment.
Suppressing an error message instead of solving the error never fixes anything and is the most useless thing to do in development. Fix the issue, or don't do anything.
Title: Re: GlueButtons.lua problem!
Post by: Nortwin on February 05, 2013, 06:11:27 pm
Thank you for the response, using that for now. :)
Title: Re: GlueButtons.lua problem!
Post by: schlumpf on February 05, 2013, 06:38:17 pm
You may as well use
Code: [Select]
SECONDS_PER_PULSE = 0.75;

function GlueButtonMaster_OnUpdate(self, elapsed)
   if VX_MUSICTIMER then
      if VX_MUSICTIMER < GetTime() then
         VX_ONMUSIC = true;
         PlayLoginMusic();
      end
   end
end
which does the same: Playing music.
Title: Re: GlueButtons.lua problem!
Post by: Nortwin on February 06, 2013, 04:43:13 pm
Thank you, I already included the function in another Lua :)