Quantcast
Spec swap script - WoWInterface
Thread Tools Display Modes
07-01-11, 11:20 AM   #1
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Spec swap script

Hiyas, all I'm looking for a script for KG panels, that will change when I swap specs. I use sStats for all my data feeds, and can't bring myself to install fortress, or chocolate bar, etc, for just one feed. So a script (for KG Panels) that will change my spec. I THINK I'll be able to muddle my way thru to mimicing (sp?) a data feed if I could get this core script for OnClick to let me swap specs.
Mebbe I should try to insert a /runscript macro into an OnClick script for KG Panels. Gah, the sheer amount of things I do not know, is horrifying
My thanks, in advance, for any/all help, this community is incredible
__________________
  Reply With Quote
07-01-11, 11:27 AM   #2
Verttex
Super Monkey
 
Verttex's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 297
/run if( GetActiveTalentGroup() == 1 ) then DEFAULT_CHAT_FRAME:AddMessage("Spec1...");SetActiveTalentGroup(2) else DEFAULT_CHAT_FRAME:AddMessage("Spec2...");SetActiveTalentGroup(1) end
/in 6 /equipset [spec:2]Eq1;Eq2
__________________

Last edited by Verttex : 07-01-11 at 11:27 AM. Reason: http://www.wowwiki.com/Useful_macros#Swap_Current_Dual-Spec_Talent
  Reply With Quote
07-01-11, 06:35 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,929
I use this macro to swap specs. The /usetalents command is provided in the default UI.
Code:
/usetalents [spec:1] 2;1
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
07-01-11, 07:03 PM   #4
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Originally Posted by SDPhantom View Post
I use this macro to swap specs. The /usetalents command is provided in the default UI.
Code:
/usetalents [spec:1] 2;1
So how would I turn this into a kgpanels OnClick script? Aaah, nvm, thanks much for your help. Will try to see if I can work this.
__________________
  Reply With Quote
07-01-11, 08:00 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,929
I've never used kgPanels, and looking through the code, it looks like it takes in Lua code to run a script. I can provide code to feed into the addon, but I wouldn't know where to go to put it in. This is made to run in version 1.5.4.4 if it makes any difference. There's an added check because kgPanels appears to register CLICK events as 2 handler functions. Without checking a local variable it injects into the user script, it'll run the code twice in one click.

Code:
if released then SetActiveTalentGroup(GetActiveTalentGroup()%2+1); end
Note: released appears to be a local defined inside kgPanels to determine that it's running from the OnMouseUp handler.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 07-01-11 at 08:03 PM.
  Reply With Quote
07-03-11, 01:56 PM   #6
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Originally Posted by SDPhantom View Post
Code:
if released then SetActiveTalentGroup(GetActiveTalentGroup()%2+1); end
Note: released appears to be a local defined inside kgPanels to determine that it's running from the OnMouseUp handler.
This worked PERFECTLY. My thanks!
__________________
  Reply With Quote
07-03-11, 01:57 PM   #7
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Now I'd like to know if anyone knows a script that would call a panel based on what spec I'm currently in?
__________________
  Reply With Quote
07-07-11, 01:20 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,745
Originally Posted by Kendian View Post
call a panel
What do you mean by this?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-07-11, 01:42 PM   #9
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,929
I'm assuming to show another frame configured in kgPanels. You'd have to know the frame's name to access it. I would suggest trying to find it using /framestack. I'm not sure what API calls are provided by kgPanels if any at all.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
07-07-11, 02:51 PM   #10
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Exactly, I'm looking for a script for KG Panels, that would would show/call a panel that I've made when I switch specs. From tank to heals, and vice versa. The basic idea is making two panels, one that shows when I'm bear, while the other one hides, and one that shows when I'm in heals spec, while the first one hides.
__________________

Last edited by Kendian : 07-07-11 at 02:58 PM.
  Reply With Quote
07-07-11, 03:33 PM   #11
Taryble
A Molten Giant
 
Taryble's Avatar
Join Date: Jan 2009
Posts: 811
kgPanels includes a way to get the actual frame name of a panel as long as you know the name you use to configure it - /framestack isn't needed.

I believe the command is
kgPanels:FetchFrame("framenameinconfigmenu")
as kgPanels doesn't name the actual frames that it generates.
__________________
-- Taryble
  Reply With Quote
07-07-11, 03:44 PM   #12
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Mebbe I explained it wrong, lol, sometimes I confuse myself. I 'm looking for a script that will show a panel based on what spec my toon is in. I switch spec, the panel switches.
__________________
  Reply With Quote
07-07-11, 04:27 PM   #13
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,745
Yeah, you need the name of the frame to do this.

Code:
local f = kgPanel:Fetch("myframenameforspec2")  --or whatever this line should be
local spec = GetActiveTalentGroup(false,false)

if spec == 1 then
     self:Show()
     f:Hide()
elseif spec == 2 then
     self:Hide()
     f:Show()
end
Put the above in the OnEvent section of your spec1 panel. In OnLoad, you'll need to register for ACTIVE_TALENT_GROUP_CHANGED
Code:
self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-07-11, 07:36 PM   #14
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
This worked perfectly, Seerah, with very few tweaks. You rock, lady, as always, my thanks! This is what I ended up with.
OnLoad:
Code:
self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
self.text:SetFont("Fonts\\Home.ttf", 10, "OUTLINEMONOCHROME")

self.text:SetShadowOffset(1, -1)
OnClick:
Code:
if released then SetActiveTalentGroup(GetActiveTalentGroup()%2+1); end
OnEvent:
Code:
local f = kgPanels:FetchFrame("BM")  
local spec = GetActiveTalentGroup(false,false)

if spec == 1 then
     self:Show()
     f:Hide()
elseif spec == 2 then
     self:Hide()
     f:Show()
end
__________________
  Reply With Quote
07-08-11, 06:10 PM   #15
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
And here's a new noobish wrinkle....when I reload, or zone, they both show up, ao I have to change specs, to get one to hide. Any ideas how I would change the show/hide parameters? It works flawlessly, except for this one small thing, lol. My thanks, in advance, for any/all help~
__________________
  Reply With Quote
07-08-11, 06:14 PM   #16
Nibelheim
local roygbi-
 
Nibelheim's Avatar
Featured
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Kendian View Post
And here's a new noobish wrinkle....when I reload, or zone, they both show up, ao I have to change specs, to get one to hide. Any ideas how I would change the show/hide parameters? It works flawlessly, except for this one small thing, lol. My thanks, in advance, for any/all help~
Register PLAYER_ENTERING_WORLD
  Reply With Quote
07-08-11, 07:15 PM   #17
Kendian
A Molten Giant
 
Kendian's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 614
Originally Posted by Nibelheim View Post
Register PLAYER_ENTERING_WORLD
Man, Nibelheim, once again you have provided the cure to my OCD ills. Much gratitude~

__________________
  Reply With Quote
09-30-11, 02:36 PM   #18
zoktar
A Cliff Giant
AddOn Compiler - Click to view compilations
Join Date: Dec 2006
Posts: 72
cfg for all 3 trees?

Kinda looking for the same thing, im about to create art for each spec for a few classes with the release of my ui edit, would there be a way to have it detect what tree im into rather than what spec im into?. Like for dks

Blood - Frost - Unholy
1 2 3


the art is based around the spec so id like it to switch accordingly! thanks.
edit, also class would be preferable!

Last edited by zoktar : 09-30-11 at 03:27 PM.
  Reply With Quote
09-30-11, 03:35 PM   #19
brotherhobbes
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 313
Could probably use
http://wowprogramming.com/docs/api/GetPrimaryTalentTree
tabIndex = GetPrimaryTalentTree(isInspect, isPet, talentGroup)

so like

local spec = GetPrimaryTalentTree(false, false)

if spec == 1
blood
else if spec == 2
frost
etc
etc
  Reply With Quote
10-01-11, 12:25 PM   #20
zoktar
A Cliff Giant
AddOn Compiler - Click to view compilations
Join Date: Dec 2006
Posts: 72
Originally Posted by brotherhobbes View Post
Could probably use
http://wowprogramming.com/docs/api/GetPrimaryTalentTree
tabIndex = GetPrimaryTalentTree(isInspect, isPet, talentGroup)

so like

local spec = GetPrimaryTalentTree(false, false)

if spec == 1
blood
else if spec == 2
frost
etc
etc
thanks need to learn some basics at some point, could someone translate that into a working kgpanels script?
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Spec swap script

Thread Tools
Display Modes

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