Recent Topics

Ads

lua click through

Here you can post addons, or anything related to addons.
Forum rules
Before posting on this forum, be sure to read the Terms of Use
User avatar
Xnn
Posts: 8

lua click through

Post#1 » Mon Feb 13, 2023 4:38 am

So I'm editing a wonderful addon CoolDownLine, and several people suggested the ability to lock the frame. However using <Frame>:EnableMouse(false) doesn't work; there has to be some other way to tell the game not to interact with mouse clicks!

(then I think you could do something like)
Spoiler:
if input1 == "width" then MaxLength = tonumber(input2)
elseif input1 == "height" then MaxHeight = tonumber(input2)
elseif input1 == "offset" then CDLSAVES.Offset = tonumber(input2)
elseif input1 == "default" then MaxLength = 750;MaxHeight = 40;CDLSAVES.Offset = -50
elseif input1 == "lock" then CoolDownLine:EnableMouse(false)
else
CoolDownLine:EnableMouse(true)
If I can figure that out, I think I have everything else changed so you can enter in "/CDL lock" as a toggle. If anyone knows how to do this please help and I will post the code if I get it working! =D

Ads
User avatar
Xnn
Posts: 8

Re: lua click through

Post#2 » Mon Feb 13, 2023 5:34 am

Another likely easier option is to allow it to only be moved when CTRL is pressed. Not quite a lock option but the chances of accidentally clicking on it WHILE also happening to hold down control is so low it's the next best thing.

Have no idea how to do it but probably something simple...

User avatar
sullemunk
Addon Developer
Posts: 1213

Re: lua click through

Post#3 » Mon Feb 13, 2023 7:11 am

You can set an "lock toggler" with something like:

Code: Select all

elseif input1 == "lock" then WindowSetHandleInput("CoolDownLineWnd",not WindowGetHandleInput("CoolDownLineWnd"))
Image
Image Ethreal   Image Corque   Image Urgiz   Image Loxley   Image Chilli   Image Maduza

User avatar
Xnn
Posts: 8

Re: lua click through

Post#4 » Mon Feb 13, 2023 8:01 am

sullemunk wrote: Mon Feb 13, 2023 7:11 am You can set an "lock toggler" with something like:
Worked like a charm! Here is the text that you copy and paste over the CoolDownLine.lua file:
Spoiler:
CoolDownLine = {}
NextUp = 0
ANIMATIONTIMER = {}
local Cools2={}
local GetHotbarData = GetHotbarData
local GetHotbarCooldown = GetHotbarCooldown



if not MaxLength or MaxLength == nil then
MaxLength = 750 --750
end
if not MaxHeight or MaxHeight == nil then
MaxHeight = 40--40
end

if not CDLSAVES or CDLSAVES == nil then
CDLSAVES = {}
CDLSAVES.Offset = -50
end



function CoolDownLine.Initialize()

LibSlash.RegisterSlashCmd("CDL", function(input) HandleSlash(input) end)

--Announce that the addon is loaded
TextLogAddEntry("Chat", 0, L"<icon=57> CoolDownLine v0.3B Loaded. W:"..towstring(MaxLength)..L",H:"..towstring(MaxHeight)..L", Offset:"..towstring(CDLSAVES.Offset))

--Make the main window/bar
CreateWindow("CoolDownLineWnd", true)

--If abilitys are switched or annything change, update the hotbars and re-register all abilitys
RegisterEventHandler(SystemData.Events.PLAYER_HOT_BAR_UPDATED,"CoolDownLine.RegisterAbilities")
RegisterEventHandler(SystemData.Events.ENTER_WORLD,"CoolDownLine.RegisterAbilities")
RegisterEventHandler(SystemData.Events.INTERFACE_RELOADED,"CoolDownLine.RegisterAbilities")
RegisterEventHandler(SystemData.Events.LOADING_END,"CoolDownLine.RegisterAbilities")

--The texts marks
LabelSetText("10secTimeValue",L"10s")
LabelSetText("30secTimeValue",L"30s")
LabelSetText("1minTimeValue",L"1m")
LabelSetText("10minTimeValue",L"10m")

--set the cooldown animations to 0 (stop them from animating)
Animationtimer = 0
StartAnimation = 0

end

function CoolDownLine.OnUpdate( timeElapsed )--this is whats running every frame
WindowSetDimensions("CoolDownLineWnd",MaxLength,MaxHeight)
WindowSetOffsetFromParent("10secBG2",(MaxLength*0.25) , 1)
WindowSetDimensions("10secBG2",2,MaxHeight-2)
WindowSetOffsetFromParent("30secBG2",(MaxLength*0.50) , 1)
WindowSetDimensions("30secBG2",2,MaxHeight-2)
WindowSetOffsetFromParent("60secBG2",(MaxLength*0.75) , 1)
WindowSetDimensions("60secBG2",2,MaxHeight-2)
WindowSetDimensions("CoolDownLineWndIcon",MaxHeight-4,MaxHeight-4)
WindowSetDimensions("CoolDownLineWndFrame",MaxHeight-2,MaxHeight-2)

LowestCD = 9999 -- annything above this, i don't even bother showing
NextUp = nil --next ability to be ready, start by setting it to nothing
DynamicImageSetTexture("CoolDownLineWndIcon","icon000020", 62, 62) --sets the next-up-ability icon to empty
LabelSetText("NextCDValue",L"") --clears the next-up-ability timer

for i=0,121 do --goes throu every Hotbar slot, one at a time
local windowName = "CoolDownLineWnd"..i --assigns a window name to slots, "CoolDownLineWnd0" to "CoolDownLineWnd121"
local Fader = tonumber(wstring.format(L"%.01f",GetHotbarCooldown(i)))
if GetHotbarCooldown(i) > 1.6 and GetHotbarCooldown(i) < 600 then --if the cooldown is above the Global cooldown (else it would show even abilitys w/o a cooldown)
Cools2.ISONCOOLDOWN = true --set the hotbar slot to ISONCOOLDOWN if above statement is true..
elseif GetHotbarCooldown(i) < 0.01 then
Cools2.ISONCOOLDOWN = false --else ISONCOOLDOWN gets set to false..
if ( DoesWindowExist( windowName ) ) then DestroyWindow(windowName);StartAnimation = 1 end --and if it is false, destroy the window (or they will be stacking upp infinitly)
end
if Cools2.ISONCOOLDOWN == true then

--Setting up the icon for ability with the Lowest cooldown on the Line
if GetHotbarCooldown(i) < LowestCD then LowestCD = GetHotbarCooldown(i); NextUp = i end
if NextUp ~= nil then
local Nexticon = GetHotbarIcon(NextUp)
local Nexttime = TimeUtils.FormatTimeCondensed(GetHotbarCooldown(NextUp))
LabelSetText("NextCDValue",towstring(Nexttime))
if Nexticon < 10000 and Nexticon > 1000 then
DynamicImageSetTexture("CoolDownLineWndIcon",tostring(L"icon00"..towstring(Nexticon)), 62, 62)
elseif Nexticon < 1000 and Nexticon > 100 then
DynamicImageSetTexture("CoolDownLineWndIcon",tostring(L"icon000"..towstring(Nexticon)), 62, 62)
elseif Nexticon < 100 then
DynamicImageSetTexture("CoolDownLineWndIcon",tostring(L"icon0000"..towstring(Nexticon)), 62, 62)
else
DynamicImageSetTexture("CoolDownLineWndIcon",tostring(L"icon0"..towstring(Nexticon)), 62, 62)
end
end

if ( DoesWindowExist( windowName ) ) then

WindowSetDimensions(tostring(towstring(windowName)..L"A"),MaxHeight-7,MaxHeight-7)
WindowSetDimensions(tostring(towstring(windowName)..L"AFlash"),MaxHeight+16,MaxHeight+16)

if (ANIMATIONTIMER[windowName] > 0) then ANIMATIONTIMER[windowName] = ANIMATIONTIMER[windowName]-timeElapsed end

if ANIMATIONTIMER[windowName] <= 0 then AnimatedImageStopAnimation(tostring(towstring(windowName)..L"AFlash")) end

WindowSetShowing( windowName, true )
WindowSetOffsetFromParent(tostring(towstring(windowName)..L"BTimeValue"),-10, 45+CDLSAVES.Offset)

if GetHotbarCooldown(i) < 1 then
WindowSetAlpha(tostring(windowName),Fader)
else
WindowSetAlpha(tostring(windowName),1)
end

if GetHotbarCooldown(i) < 10 then
--WindowSetOffsetFromParent(windowName, math.floor(GetHotbarCooldown(i)*(28+(20-(GetHotbarCooldown(i)*2)))), -6)
--WindowSetOffsetFromParent(windowName, ((GetHotbarCooldown(i)/10)*(MaxLength*0.25)), -6)

--Here's some MatheMagics to get the icons working, God i hate math(because i'm realy terrible at it)
--WindowSetOffsetFromParent(windowName, ((GetHotbarCooldown(i)/10)*(MaxLength*0.25)), -6)
WindowSetOffsetFromParent(windowName, ((GetHotbarCooldown(i)/10)*(MaxLength*(2-(GetHotbarCooldown(i)/15))))*0.1875, -6)
LabelSetText(tostring(towstring(windowName)..L"BTimeValue"),wstring.format(L"%.01f",towstring(GetHotbarCooldown(i))))
elseif GetHotbarCooldown(i) > 10 and GetHotbarCooldown(i) < 30 then
WindowSetOffsetFromParent(windowName, (MaxLength*0.125)+((GetHotbarCooldown(i)/20)*(MaxLength*0.25)) , -6)
local testtime = TimeUtils.FormatSeconds(GetHotbarCooldown(i), true)
LabelSetText(tostring(towstring(windowName)..L"BTimeValue"),testtime)
elseif GetHotbarCooldown(i) > 30 and GetHotbarCooldown(i) < 60 then
WindowSetOffsetFromParent(windowName, (MaxLength*0.25)+((GetHotbarCooldown(i)/30)*(MaxLength*0.25)) , -6)
local testtime = TimeUtils.FormatTimeCondensed(GetHotbarCooldown(i))
LabelSetText(tostring(towstring(windowName)..L"BTimeValue"),testtime)
elseif GetHotbarCooldown(i) > 60 and GetHotbarCooldown(i) < 600 then
WindowSetOffsetFromParent(windowName, (MaxLength*0.75)+(((GetHotbarCooldown(i)-60)/600)*(MaxLength*0.25)), -6)

local testtime = TimeUtils.FormatTimeCondensed(GetHotbarCooldown(i))
LabelSetText(tostring(towstring(windowName)..L"BTimeValue"),testtime)
end
else
CreateWindowFromTemplate( windowName, "CoolDownLineICONTemplate", "CoolDownLineWnd" )
AnimatedImageStartAnimation (tostring(towstring(windowName)..L"AFlash"), 0, true, true, 0)
ANIMATIONTIMER[windowName] = 0.6
WindowSetShowing( windowName, false )
WindowSetParent(windowName,"CoolDownLineWnd")
if GetHotbarIcon(i) < 10000 and GetHotbarIcon(i) > 1000 then
DynamicImageSetTexture(tostring(towstring(windowName)..L"AIcon"),tostring(L"icon00"..towstring(GetHotbarIcon(i))), 62, 62)
elseif GetHotbarIcon(i) < 1000 and GetHotbarIcon(i) > 100 then
DynamicImageSetTexture(tostring(towstring(windowName)..L"AIcon"),tostring(L"icon000"..towstring(GetHotbarIcon(i))), 62, 62)
elseif GetHotbarIcon(i) < 100 then
DynamicImageSetTexture(tostring(towstring(windowName)..L"AIcon"),tostring(L"icon0000"..towstring(GetHotbarIcon(i))), 62, 62)
else
DynamicImageSetTexture(tostring(towstring(windowName)..L"AIcon"),tostring(L"icon0"..towstring(GetHotbarIcon(i))), 62, 62)
end
end
end
end

if StartAnimation == 1 then
WindowSetDimensions("CoolDownLineWndFlash",MaxHeight+14,MaxHeight+14)
WindowSetShowing ("CoolDownLineWndFlash", true)
AnimatedImageStartAnimation ("CoolDownLineWndFlash", 0, true, true, 0)
StartAnimation = 0
Animationtimer = 0.6
end

if Animationtimer > 0 then
Animationtimer = Animationtimer - timeElapsed
else
AnimatedImageStopAnimation ("CoolDownLineWndFlash")
end
end

function CoolDownLine.RegisterAbilities()
local abilityData,ID,cooldown,TYPE
Cools2={}
for i=0,121 do
Cools2 = {}
Cools2.ISONCOOLDOWN = false
TYPE,ID=GetHotbarData(i)
abilityData=GetAbilityData(ID)
Cools2.ABDATA = abilityData
Cools2.ABID = ID
Cools2.ABTYPE = TYPE
end
end

function HandleSlash(action) --Slashcommands
local input1 = string.sub(action,0,string.find(action," "))
if string.find(action," ") ~= nil then
input1 = string.sub(action,0,string.find(action," ")-1)
input2 = string.sub(action,string.find(action," ")+1,-1)
end

if input1 == "width" then MaxLength = tonumber(input2)
elseif input1 == "height" then MaxHeight = tonumber(input2)
elseif input1 == "offset" then CDLSAVES.Offset = tonumber(input2)
elseif input1 == "default" then MaxLength = 750;MaxHeight = 40;CDLSAVES.Offset = -50
elseif input1 == "lock" then WindowSetHandleInput("CoolDownLineWnd",not WindowGetHandleInput("CoolDownLineWnd"))

end
end


Oh! And it looks like you are the author. Hopefully I helped with an update. =D
Last edited by Xnn on Mon Feb 13, 2023 8:08 am, edited 1 time in total.

User avatar
sullemunk
Addon Developer
Posts: 1213

Re: lua click through

Post#5 » Mon Feb 13, 2023 8:07 am

Just a fyi, i made the Cooldownline addon, but it's rather absoleete for me since i have made a another revision of it that works a bit better / is more refined
Image
Image Ethreal   Image Corque   Image Urgiz   Image Loxley   Image Chilli   Image Maduza

User avatar
Xnn
Posts: 8

Re: lua click through

Post#6 » Mon Feb 13, 2023 8:09 am

sullemunk wrote: Mon Feb 13, 2023 8:07 am Just a fyi, i made the Cooldownline addon, but it's rather absoleete for me since i have made a another revision of it that works a bit better / is more refined
Oh really? And what is the name of that one?

Who is online

Users browsing this forum: No registered users and 27 guests