This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: GlueButtons.lua problem!  (Read 2182 times)

Nortwin

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 24
    • View Profile
GlueButtons.lua problem!
« 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:



What have I screwed in GlueButtons.lua?

Here is my code:

http://pastebin.com/KuPWdN5T

Thank you all!

Nortwin
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: GlueButtons.lua problem!
« Reply #1 on: February 04, 2013, 05:03:02 pm »
deleted bump
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: GlueButtons.lua problem!
« Reply #2 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
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: GlueButtons.lua problem!
« Reply #3 on: February 04, 2013, 07:02:08 pm »
That's not a fix. The fix would be having the object in the interface.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: GlueButtons.lua problem!
« Reply #4 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: GlueButtons.lua problem!
« Reply #5 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nortwin

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 24
    • View Profile
Re: GlueButtons.lua problem!
« Reply #6 on: February 05, 2013, 06:11:27 pm »
Thank you for the response, using that for now. :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: GlueButtons.lua problem!
« Reply #7 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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Nortwin

  • Registred Member
  • GM Isle Explorer
  • *****
  • Posts: 24
    • View Profile
Re: GlueButtons.lua problem!
« Reply #8 on: February 06, 2013, 04:43:13 pm »
Thank you, I already included the function in another Lua :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »