Pet Battle Scripts

Pet Battle Scripts

265k Downloads

Script editor LUA error when moving the window

axc450 opened this issue · 3 comments

commented

Sometimes a LUA error can occur when attempting to move the Script Editor window:

3x ...t/Libs/LibWindow-1.1-18/LibWindow-1.1/LibWindow-1.1.lua:129: attempt to perform arithmetic on a nil value
[string "@Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1-18/LibWindow-1.1/LibWindow-1.1.lua"]:129: in function `SavePosition'
[string "@Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Widget/BasicPanel.lua"]:39: in function <...s/tdBattlePetScript/Libs/tdGUI/Widget/BasicPanel.lua:37>

Locals:
frame = Frame {
 0 = <userdata>
 TitleText = FontString {
 }
 RightBorder = Texture {
 }
 LeftBorder = Texture {
 }
 Drag = Frame {
 }
 Update = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:688
 TopRightCorner = Texture {
 }
 TopLeftCorner = Texture {
 }
 Bg = Texture {
 }
 TopBorder = Texture {
 }
 TopTileStreaks = Texture {
 }
 TitleBg = Texture {
 }
 BottomBorder = Texture {
 }
 SetRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:31
 IsRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:36
 Refresh = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:21
 CloseButton = Button {
 }
 _storage = <table> {
 }
 Resize = Button {
 }
 BotLeftCorner = Texture {
 }
 Portrait = Frame {
 }
 SetTitle = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:30
 BotRightCorner = Texture {
 }
}
parent = UIParent {
 0 = <userdata>
 Tabs = <table> {
 }
 ContainerFrames = <table> {
 }
 firstTimeLoaded = 1
 variablesLoaded = true
}
s = 1
(*temporary) = nil
(*temporary) = Frame {
 0 = <userdata>
 TitleText = FontString {
 }
 RightBorder = Texture {
 }
 LeftBorder = Texture {
 }
 Drag = Frame {
 }
 Update = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:688
 TopRightCorner = Texture {
 }
 TopLeftCorner = Texture {
 }
 Bg = Texture {
 }
 TopBorder = Texture {
 }
 TopTileStreaks = Texture {
 }
 TitleBg = Texture {
 }
 BottomBorder = Texture {
 }
 SetRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:31
 IsRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:36
 Refresh = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:21
 CloseButton = Button {
 }
 _storage = <table> {
 }
 Resize = Button {
 }
 BotLeftCorner = Texture {
 }
 Portrait = Frame {
 }
 SetTitle = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:30
 BotRightCorner = Texture {
 }
}
(*temporary) = <userdata>
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to perform arithmetic on a nil value"
nilParent = <table> {
 GetHeight = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:115
 GetWidth = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:112
 GetScale = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:118
}
abs = <function> defined =[C]:-1
setStorage = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:61

image

commented

I get this every time I try to move or resize the window. The whole window becomes unusable until I open it again.

commented

So that i am currently experiencing this, and thought I'd try to see what i can learn.

  1. First, it's the main window (GetModule('UI.MainPanel').MainPanel) which inherits the BasicPanel class.
  2. Second, it's not LibWindow library, as calling the SavePosition method works as normal.

I've tracked it down to the StartMoving/StartSizing methods that cause the issue. In the OnDragStart script. they're called, and for some reason, remove all the frame's point. That instantly triggers the OnDragStop script, calling LibWindow:SavePosition() which tries to access the frame offset via :GetLeft() and that causes the error, as the frame has no points.

What i can't figure out, when calling StartMoving on the frame outside of the script, the frame loses its points (and for me other elements disappear)

This could very well be a Blizzard UI issue, or some other problem causing StartMoving to do this.

commented

At this point I'd probably rather redo the frames in a different UI framework (AceGUI? Rawdogging Blizzard?) than continuing this pain…