Thread: Kgpanels script

  1. #1

    Kgpanels script

    Hey guys,

    I need your help with something: I have set up a panel with the addon kgpanels for my unit frames. Now i need a script that hides the panel if i don't have a target and loads it if i do.

    Tried messing around with it myself a little bit, but since im kind of lost when it comes to scripts and coding, I'd need a little input here thanks!

  2. #2
    Deleted
    You do not need a script to do this. If you are using an addon to show the unit frames then it is very simple. Type "/fstack" and hover your mouse cursor over the target frame. Find out the ID of it. For example I use Shadowed Unit Frames and the player frame is called "SUFUnitplayer". Use this code and go into your KgPanels and go to the bottom where it says Parent and Anchor. If you parent the frame to the ID then it will hide when the frame hides. Unfortunately it will change the position of it so you will need to reposition the frame after. Anchor will just put the panel in the relative position of that unit frame and when you move the frame around, the panel will move with it.

  3. #3
    does not work for me. if i do this (set the parent to "SUFUnittarget" (shadowed unit frames target frame)) then the frame disappears completely, even when i have a target. after i reloaded my ui, the frame was there, but not around the target but in the middle of the screen. when i repositioned it, kgpanels said something with failed to load background texture and did not position it around the target.

    when i additionally anchored it to the SUFunitframe, the panel was in the right position (around the target frame), but suddenly alot bigger than it was before, although i did not change the scale/height/width of it..

    so yeah, doesn't work that way.

  4. #4
    Deleted
    Quote Originally Posted by Jainzar View Post
    when i additionally anchored it to the SUFunitframe, the panel was in the right position (around the target frame), but suddenly alot bigger than it was before, although i did not change the scale/height/width of it..

    so yeah, doesn't work that way.
    Usually when you anchor a panel to anything, the scale does alter so you need to readjust the width and height to suit it. It sounds like you got it working by the sounds of thedescription. Not really sure why it said "failed to load background texture" though.

  5. #5
    yea, no idea why that comes up

    didn't work out tho, because the scale gets readjusted in a way that i can't make it match the unit frame. so i kinda need a script that hides the panel whenever i dont have a target.

    anyone knows how to do this?

  6. #6
    Deleted
    Haven't tested this but try putting this in the OnUpdate script window:
    Code:
    if SUFUnittarget:IsVisible() then
    self:Show()
    else
    self:Hide()
    end

  7. #7
    Quote Originally Posted by Pharrax View Post
    Haven't tested this but try putting this in the OnUpdate script window:
    Code:
    if SUFUnittarget:IsVisible() then
    self:Show()
    else
    self:Hide()
    end
    doesn't work unfortunately. panel just disappears and when i reload the UI it's gone and doesn't show up either when i select a target.
    Last edited by Jainzar; 2013-02-15 at 02:46 PM.

  8. #8
    Deleted
    Ok now that I have got time to test this, try this script instead:

    Code:
    if SUFUnittarget:IsVisible() then
    self:SetAlpha(1)
    else
    self:SetAlpha(0)
    end

  9. #9
    worked, thanks a lot appreciate it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •