Thread Tools Display Modes
10-26-10, 04:12 PM   #1
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
[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
__________________
  Reply With Quote
10-27-10, 05:17 AM   #2
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
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")
2) You would have to get the frame name by using /framestack and hovering over it. For some reason, kgPanels doesn't use the names that you see in the configuration, but use "kgpanelX" instead, where X represents a number (1 - Amount of frames). After this, you could use this code:
Code:
MYPANELNAME:SetScript("OnLoad", 'New OnLoad Code goes here')
However, if all you want to do is change the color this one time (without saving it), you could just use:
Code:
MYPANELNAME.texture:SetTexture(r, g, b [, alpha])
3) http://wowprogramming.com/docs/widgets#colorselect - That's all I can give you on this one.

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)
EDIT: The fade in/out functions could be made with animations instead: http://www.wowinterface.com/forums/s...ad.php?t=35104

5) I would need the screenshot to understand that one.

Last edited by Nillerr : 10-27-10 at 08:04 AM.
  Reply With Quote
10-27-10, 10:00 AM   #3
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
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 ]
__________________
  Reply With Quote
10-27-10, 10:20 AM   #4
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
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)
Add that part to a OnEvent script in kgPanels, and in the OnLoad type:
Code:
self:RegisterEvent("RAID_ROSTER_UPDATE")
Again, untested so I have no idea if it works the way your want it.

To see the position of Grid, you could type this in chat:
Code:
/run print(GridLayoutFrame:GetPoint())
The 4th number is the X-position, and the 5th is the Y-position.

Last edited by Nillerr : 10-27-10 at 10:33 AM.
  Reply With Quote
10-27-10, 10:31 AM   #5
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
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
I also tried to exchange MultiBarLeft and MultiBarRight with BT4:Bar5 and BT4Bar6, but nothing happens - does it just work for panels owned by kgpanels?
__________________

Last edited by FaulTier : 10-27-10 at 10:47 AM.
  Reply With Quote
10-27-10, 10:52 AM   #6
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
Originally Posted by FaulTier View Post
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
I also tried to exchange MultiBarLeft and MultiBarRight with BT4:Bar5 and BT4Bar6, but nothing happens - does it just work for panels owned by kgpanels?
You didn't do the fading right man, you have to use
Code:
kgPanels_FadeOut(kgPanels:FetchFrame("MultiBarLeft"), 0, 0.2, GetTime())
outside of the function itself =)

As for the bartender issue... it should work just fine if those are the actual bartender names.
  Reply With Quote
10-27-10, 11:00 AM   #7
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
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
My mistake isn't as easy as i think right now, is it?



Got 1 other Question - can i hook several frames to 1 alias? E.g.:
Code:
 local _,Panel = kgPanel1
local _,Panel = kgPanel2
local _,Panel = kgPanel3
...
I want to use the script to change the color by clicking a frame to change the color of 16 panels and i don't want to have miles of scripts for each of my 12 ColorPresets (10 ClassColorPresets, DefaultPreset and a Preset fitting to your class)


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)
doesn't work as an OnClick script, but buggrabber shows no errors.
__________________

Last edited by FaulTier : 10-27-10 at 12:01 PM.
  Reply With Quote
10-27-10, 12:46 PM   #8
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
Originally Posted by FaulTier View Post
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
My mistake isn't as easy as i think right now, is it?



Got 1 other Question - can i hook several frames to 1 alias? E.g.:
Code:
 local _,Panel = kgPanel1
local _,Panel = kgPanel2
local _,Panel = kgPanel3
...
I want to use the script to change the color by clicking a frame to change the color of 16 panels and i don't want to have miles of scripts for each of my 12 ColorPresets (10 ClassColorPresets, DefaultPreset and a Preset fitting to your class)


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)
doesn't work as an OnClick script, but buggrabber shows no errors.
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())
This would be the correct code to use.


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, ...}
And then use a function to execute the same function for all the table entries.
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
Usage:
Code:
local colors = {r = 1.0, g = 0.5, b = 0.2, alpha = 1}
ChangeColorOfFrames(colors)
  Reply With Quote
10-27-10, 01:20 PM   #9
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
Originally Posted by Nillerr View Post
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()
        kgPanels_FadeOut(Panel, fadeTo, fadeDelay, SavedTime)
    end
end

kgPanels_FadeOut(MultiBarLeft, 0, 0.2, GetTime())
This would be the correct code to use.

Doesn't work as intended - frames behave like Hide() and Show(), no fading.
Maybe the mistake is SavedTime = GetTime, because there we say If GetTime()-SavedTime <= fadeDelay but GetTime()-SavedTime is equal to GetTime()-GetTime() which is always Zero, so the fading is never called.




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?
i do that often automatically..



You could add them to a table.
Code:
local myFrameTable = {kgPanel1, kgPanel2, kgPanel3, ...}
And then use a function to execute the same function for all the table entries.
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
Usage:
Code:
local colors = {r = 1.0, g = 0.5, b = 0.2, alpha = 1}
ChangeColorOfFrames(colors)
This seems to be a momentary change of the BackgroundColor, but i want the Script of the frames changed, that the color will remain after i logged out.
maybe i missed something with Panel5:SetScript("OnLoad", self:SetBackdropBorderColor(0.77, 0.12, 0.23, 1)), because that's the part which isn't working

Comments in the Quote.
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 <.<
__________________
  Reply With Quote
10-27-10, 01:28 PM   #10
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
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())
  Reply With Quote
10-27-10, 01:48 PM   #11
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
Originally Posted by Nillerr View Post
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())
Still no fading - i assume, there is no value for a duration to fade. GetTime() shows the uptime of your machine, or?
__________________
  Reply With Quote
10-27-10, 01:49 PM   #12
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
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.
  Reply With Quote
10-28-10, 01:24 PM   #13
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
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
K, then how about this one.

]..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
wokring as a OnClick handler? Slash commands appear in the chat, like being printed but i want them to to do their job.
__________________

Last edited by FaulTier : 10-28-10 at 01:35 PM.
  Reply With Quote
10-29-10, 03:50 AM   #14
Nillerr
A Fallenroot Satyr
 
Nillerr's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2010
Posts: 22
Originally Posted by FaulTier View Post
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
K, then how about this one.

]..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
wokring as a OnClick handler? Slash commands appear in the chat, like being printed but i want them to to do their job.
Very messy code up there, but if that's what works for you, I wont try to change it up at the moment.
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")
As for the /reload, just use:
Code:
ReloadUI()
  Reply With Quote
10-29-10, 06:12 AM   #15
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
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.
  Reply With Quote
10-29-10, 11:34 AM   #16
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
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.
relativeFrame is what frame you're setting this point relative to (I usually use UIParent).

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 first line says that I'm setting the Bottom-Left point of ChatFrame1 to a spot that's 63 right and 32 up from the Bottom-Left point of UIParent.

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
  Reply With Quote
10-29-10, 12:01 PM   #17
FaulTier
A Theradrim Guardian
 
FaulTier's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 61
Originally Posted by Taryble View Post
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.
relativeFrame is what frame you're setting this point relative to (I usually use UIParent).

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 first line says that I'm setting the Bottom-Left point of ChatFrame1 to a spot that's 63 right and 32 up from the Bottom-Left point of UIParent.

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).

Ah, okay, i understand!
And you've shown me a way to define my chat-size - awesome

Thanks!
__________________
  Reply With Quote
11-22-10, 10:09 PM   #18
Deadmau5
A Murloc Raider
 
Deadmau5's Avatar
Join Date: Jul 2010
Posts: 9
Originally Posted by FaulTier View Post
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
Does this work with a Pitbull Frame?
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » [Questions/Help] Scripts for kgPanels and Grid-Help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off