Go to Page... |
Thread Tools | Display Modes |
10-26-10, 04:12 PM | #1 |
[Questions/Help] Scripts for kgPanels and Grid-Help
Hey Guys - i need your help to add some functions with kgPanels:
1. I'm trying to send a message to the chat via "on click" - not print! (I want to change a profile via buttons, so I need a functions that does the same as if i'm writing "/reflux switch ShiningUI" e.g.) 2. I need to know how to change the "On load"-scripts of frames by clicking a nother frame (So, if i klick the panel, i want to change the onload script of other frames to change their color etc) 3. I want to know, how to show up a Color-Picker frame wih Alpha-Level adjust frame (like the from kgpanels) and then to show the colorcode in [r, b, g, a], e.g. for example [0.2, 0.5, 0.7, 1] printed in the chat. (Mustn't be done with kgpanels, can even be a standalone addon) 4. Can i make fade-in frames? (changing alpha or moving from 1 positon to somethere else, not just popping up) 5. Is there a chance to expand grid centered? (Groupmembers are shown vertikal, groups are growing horinzontal but the shown part is always centered? *i'll make screenschot to show what i mean) Or to attach the position of grid with the number of raidmember? (For example through a kgPanels script?) Any ideas? It sure is a lot and it's not that easy. But I'd be very thankful. Greetz, Faultier |
|
10-27-10, 05:17 AM | #2 |
I can't answer all of them but I'll try to give my bet on some of them:
1) I am pretty sure that you can use this as a function (from the Reflux code) kgPanels OnClick event: Code:
SlashCmdList["REFLUX"]("switch ShiningUI") Code:
MYPANELNAME:SetScript("OnLoad", 'New OnLoad Code goes here') Code:
MYPANELNAME.texture:SetTexture(r, g, b [, alpha]) 4) Yes, you can, you would either have to find a function for it, or make your own. I thought I would give it a try, and here's what I came up with (Untested): The functions can be a separate addon, or you could simply put them in an OnLoad script on one of your panels. Code:
-- Functions created by Nillerr function kgPanels_FadeIn(Panel, fadeTo, fadeDelay, SavedTime) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alpha+0.1) SavedTime = GetTime() kgPanels_FadeIn(Panel, fadeTo, fadeDelay, SavedTime) end end -- Usage: kgPanels_FadeIn(frame, alpha, seconds, time) e.g: kgPanels_FadeIn(self, 1, 0.2, GetTime()) - will fade to max visibility, with 0.1 increase ever 0.2 seconds. (Assuming atleast 20 FPS) function kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alph-0.1) SavedTime = GetTime() kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) end end function kgPanels_MoveTo(Panel, newX, newY, moveDelay, moveStep, SavedTime) if GetTime()-SavedTime <= moveDelay then local point, relativeTo, relativePoint, posX, posY = Panel:GetPoint() if posX == newX and posY == newY then return end if posX < newX then posX = posX+(moveStep or 1) end if posY < newY then posY = posY+(moveStep or 1) end if posX > newX then posX = newX end if posY > newY then posY = newY end Panel:SetPoint(point, relativeTo, relativePoint, posX, posY) SavedTime = GetTime() kgPanels_MoveTo(Panel, newX, newY, moveDelay, moveStep, SavedTime) end end -- USage: kgPanels_MoveTo(frame, posX, posY, interval (seconds), steps, GetTime()) - kgPanels_MoveTo(self, 1000, 1000, 0.1, 10, GetTime()) - will move frame "self" to 1000, 1000. Moving 10 pixels every 0.1 seconds. (Assuming atleast 10 FPS) 5) I would need the screenshot to understand that one. Last edited by Nillerr : 10-27-10 at 08:04 AM. |
|
10-27-10, 10:00 AM | #3 |
Okay, thanks for your help so far, i'll hope i'm able to do sthis stuff, but number 3 seems to be hard for me - i'm able to play around with kgPanels, but LUA and so on itself are cryptic to me
Here are the Screenshots to explain 5.) Normally, Grid grows like this From 5 to 15 Men(Red is the Center of the screen, blue squares are the groupmembers and the yellow things are the numbers pf the groups.) -> -> But i want it to grow like this: -> -> It is quite easy at least - i need to attach a position to the number of groupmembers, the difference to the xpos is [GroupMemberFrameWidth + SpaceBetweenGroupFrames)/2. But i don't know how to change the position of Grid via a script of kgpanels. But i'll give 1,2 and 4 this evening a try - if they work, i'll credit you on my UI-InfoPage. [If you like so ] |
|
10-27-10, 10:20 AM | #4 |
To position grid all you will have to do it find the name of the frame using /framestack and hovering over it.
I think it is called GridLayoutFrame though. The code you would use is (if the frame name is GridLayoutFrame) Code:
local normalPosX = Position X of Grid GridLayoutFrame:SetPoint("CENTER", UIParent, "CENTER", (normalPosX-(GridLayoutFrame:GetWidth()/2), posY) Code:
self:RegisterEvent("RAID_ROSTER_UPDATE") To see the position of Grid, you could type this in chat: Code:
/run print(GridLayoutFrame:GetPoint()) Last edited by Nillerr : 10-27-10 at 10:33 AM. |
|
10-27-10, 10:31 AM | #5 |
Man, thanks!
I owe you one! So, last thing i need to figure out is the ColorCircle, but i think i'll design a little MirkoMenu with kgPanels to change the color with presets. Man, you just flooded my head with dozen of ideas! Edit: I tried the FadeIn. So, i got a Panel working as button. The OnClick looks like: Code:
local button = kgPanels:FetchFrame("barSideShow") local bar1 = kgPanels:FetchFrame("BarSide") self:Hide() button:Show() function kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alph-0.1) SavedTime = GetTime() kgPanels_FadeOut(MultiPanelBar, 0, 0.2, GetTime()) end end function kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alph-0.1) SavedTime = GetTime() kgPanels_FadeOut(MultiBarLeft, 0, 0.2, GetTime()) end end Last edited by FaulTier : 10-27-10 at 10:47 AM. |
|
10-27-10, 10:52 AM | #6 | |
Code:
kgPanels_FadeOut(kgPanels:FetchFrame("MultiBarLeft"), 0, 0.2, GetTime()) As for the bartender issue... it should work just fine if those are the actual bartender names. |
||
10-27-10, 11:00 AM | #7 |
maybe i'm just stupid right know, but i don't know waht you mean, or my english isn't as good as i thought it is :s
Code:
function kgPanels_FadeOut(MultiBarLeft, 0, 0.2, GetTime()) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alph-0.1) SavedTime = GetTime() kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) end end Got 1 other Question - can i hook several frames to 1 alias? E.g.: Code:
local _,Panel = kgPanel1 local _,Panel = kgPanel2 local _,Panel = kgPanel3 ... Just got another problem: Code:
local _,Panel5 = kgPanels:FetchFrame("KgPanel5") Panel5:SetScript("OnLoad", self:SetBackdropBorderColor(0.77, 0.12, 0.23, 1)) self:SetAlpha(0.5) Last edited by FaulTier : 10-27-10 at 12:01 PM. |
|
10-27-10, 12:46 PM | #8 | |
Code:
function kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alph-0.1) SavedTime = GetTime() kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) end end kgPanels_FadeOut(MultiBarLeft, 0, 0.2, GetTime()) About the hooking every frame to one variable... No, you cannot, every time you try to do it, you will overwrite the previous data stored in the variable. Another question... why do you have _, in front of simple variables? You could add them to a table. Code:
local myFrameTable = {kgPanel1, kgPanel2, kgPanel3, ...} Code:
function ChangeColorOfFrames(colors) local myFrameTable = {kgPanel1, kgPanel2, kgPanel3} for _,frame in pairs(myFrameTable) do frame.bg:SetGradientAlpha("HORIZONTAL", colors.r, colors.g, colors.b, (colors.alpha or 1), colors.r, colors.g, colors.b, (colors.alpha or 1)) end end Code:
local colors = {r = 1.0, g = 0.5, b = 0.2, alpha = 1} ChangeColorOfFrames(colors) |
||
10-27-10, 01:20 PM | #9 | |
I didn't tried the one with grid, because i can't find the possibility to emulate a raid with xx-members - grid hasn't a graphical config mode <.< |
||
10-27-10, 01:28 PM | #10 |
My bad with the function =)
This should work. (no time for testing atm) Code:
function kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) if GetTime()-SavedTime <= fadeDelay then local alpha = Panel:GetAlpha() if alpha == fadeTo then return end Panel:SetAlpha(alpha-0.1) SavedTime = GetTime() end kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime) end kgPanels_FadeOut(MultiBarLeft, 0, 0.2, GetTime()) |
|
10-27-10, 01:48 PM | #11 | |
|
||
10-27-10, 01:49 PM | #12 |
I would recommend you try switching to using the animations in the API, as those should work as intended... I cannot give you a tutorial on it though.
|
|
10-28-10, 01:24 PM | #13 |
Code:
if GetNumRaidMembers() > 1 and GetNumRaidMembers() <= 5 or GetNumPartyMembers() > 1 and GetNumPartyMembers() <= 5 then BT4Bar1:MoveTo(-176, 117) BT4Bar3:MoveTo(-4, 117) BT4BarStanceBar:Move(-176, 152.5) BT4BarPetBar:MoveTo(-41, 146.5) end if GetNumRaidMembers() > 5 and GetNumRaidMembers() <= 10 then BT4Bar1:MoveTo(-176, 141) BT4Bar3:MoveTo(-4, 141) BT4BarStanceBar:Move(-176, 176.5) BT4BarPetBar:MoveTo(-41, 170.5) end if GetNumRaidMembers() > 10 and GetNumRaidMembers() <= 15 then BT4Bar1:MoveTo(-176, 165) BT4Bar3:MoveTo(-4, 165) BT4BarStanceBar:Move(-176, 200.5) BT4BarPetBar:MoveTo(-41, 194.5) end if GetNumRaidMembers() > 15 and GetNumRaidMembers() <= 20 then BT4Bar1:MoveTo(-176, 189) BT4Bar3:MoveTo(-4, 189) BT4BarStanceBar:Move(-176, 224.5) BT4BarPetBar:MoveTo(-41, 118.5) end if GetNumRaidMembers() > 20 and GetNumRaidMembers() <= 25 then BT4Bar1:MoveTo(-176, 213) BT4Bar3:MoveTo(-4, 213) BT4BarStanceBar:Move(-176, 248.5) BT4BarPetBar:MoveTo(-41, 242.5) end if GetNumRaidMembers() > 25 and GetNumRaidMembers() <= 30 then BT4Bar1:MoveTo(-176, 237) BT4Bar3:MoveTo(-4, 237) BT4BarStanceBar:Move(-176, 272.5) BT4BarPetBar:MoveTo(-41, 266.5) end if GetNumRaidMembers() > 30 and GetNumRaidMembers() <= 35 then BT4Bar1:MoveTo(-176, 261) BT4Bar3:MoveTo(-4, 261) BT4BarStanceBar:Move(-176, 296.5) BT4BarPetBar:MoveTo(-41, 290.5) end if GetNumRaidMembers() > 35 and GetNumRaidMembers() <= 40 then BT4Bar1:MoveTo(-176, 285) BT4Bar3:MoveTo(-4, 285) BT4BarStanceBar:Move(-176, 320.5) BT4BarPetBar:MoveTo(-41, 314.5) end if GetNumRaidMembers() >= 1 then BT4Bar1:MoveTo(-176, 87) BT4Bar3:MoveTo(-4, 87) BT4BarStanceBar:Move(-176, 122.5) BT4BarPetBar:MoveTo(-41, 116.5) end ]..and I did some other things with layouts instead of overwriting the SavedVariables] Edit: How do i get Code:
if pressed then SendChatMessage("/run /kgpanel layout ShiningHeal") else SendChatMessage("/reload") end Last edited by FaulTier : 10-28-10 at 01:35 PM. |
|
10-29-10, 03:50 AM | #14 | |
Your should be able to use the SlashCmdList table for kgPanels to access the functions. As far as I'm aware, you can't just send command lines as text messages through Addons. Something like this should work: Code:
SlashCmdList["kgpanels"]("layout ShiningHeal") Code:
ReloadUI() |
||
10-29-10, 06:12 AM | #15 |
k thanx for the help with the slash command!
Edit: Doesn't work. How about to call <<code lua>>kgPanels.db:SetProfile("Shining")<</code>> as a script with a onClick-handler?EDIT: WORKS But the other Script does NOT work, even if it isn't throwing any errors. Is Frame:MoveTo(x, y) even a possible function? (i pre-defined nothing) Last edited by FaulTier : 10-29-10 at 10:11 AM. |
|
10-29-10, 11:34 AM | #16 |
There is no MoveTo command. You can use SetPoint instead, read it's info on WowPedia.
obj:SetPoint(point, relativeFrame, relativePoint, ofsx, ofsy); point is the point on the frame that you're using for the location. Code:
Points There are nine valid point values: "TOP", "RIGHT" "BOTTOM" "LEFT": the center-points of the respective sides. "TOPRIGHT", "TOPLEFT", "BOTTOMLEFT", "BOTTOMRIGHT": corners of the frame rectangle. "CENTER": the center point of the frame rectangle. relativePoint is the point on the above frame that you're offsetting FROM. Uses the same "point" values as above. ofsx is the x-offset from relativepoint to point - basically, how far away, horizontally, is the point you're setting from the relativePoint. ofxy is the y-offset - how far away, vertically, is point from relativePoint. Example (I use these two lines to define the bottom left and top right points of my chatframe). Code:
ChatFrame1:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", 63, 32) ChatFrame1:SetPoint("TOPRIGHT", "UIParent", "BOTTOMLEFT", 440, 177) The second line says that the Top-Right of ChatFrame1 is being set to a spot that's 440 right and 177 up from the Bottom-Left point of UIParent. When you use it to place your Bartender4 bars, you should just be able to place one point, instead of both (my above code also sets the window to a specific size, by setting opposite corners).
__________________
-- Taryble |
|
10-29-10, 12:01 PM | #17 | |
Ah, okay, i understand! And you've shown me a way to define my chat-size - awesome Thanks! |
||
11-22-10, 10:09 PM | #18 | |
|
||
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » [Questions/Help] Scripts for kgPanels and Grid-Help |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|