WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Released AddOns (https://www.wowinterface.com/forums/forumdisplay.php?f=9)
-   -   McRun - Official thread (https://www.wowinterface.com/forums/showthread.php?t=32575)

dafire 05-21-10 11:48 AM

Thanks.. I think that this whole addon in a macro thing is a great idea .. I don't use many macros yet and look forward to play around with that stuff ;)

dafire 05-21-10 01:21 PM

I just played around with it.. and at least the buttons are changing when I switch the talents.. that's all a wanted to know for now ;)

Changing the layout on switching talents would be even better ;)

Hmm.. I think there is some more important stuff missing... a petbar / vehicleui comes to my mind :)

Cogwheel 05-21-10 03:42 PM

Quote:

Originally Posted by dafire (Post 188779)
Hmm.. I think there is some more important stuff missing... a petbar / vehicleui comes to my mind :)

I could probably find a simple way to reattach the built-in pet bar to one of the CogsBar bars.

Vehicle support might be a bit too complex to handle elegantly within the space limitations. At the very least I can make sure the built-in one shows up. There might be a way to hack it in the current version with clever use of state paging though...

To be continued...

Tuller 05-22-10 06:31 PM

It needs some work, but here's McBag


Commands:
/mb - Toggle window.

1:
Code:

local F,CNS,Mt,C,g=CF('Button','McBag',UIParent),GetContainerNumSlots,setmetatable,ceil,{0,1,2,3,4,5}local B,H=function(i,b)b=F.b[i]b.size=CNS(i)return b end,function(i)for k,v in pairs(g)do if v==i then return k end end end Ij(F,{b=Mt({},{__index=
2:
Code:

function(t,k,f)f=CF('Frame',F:GetName()..'B'..k,F)f:SetID(k)t[k]=f f.i=Mt({},{__index=function(t,i,s)s=CF('Button',f:GetName()..'Item'..i,f,'ContainerFrameItemButtonTemplate')s:SetID(i)t[i]=s return s end})return f end}),lo=function(c,p,i,z,t)i,z=1,36+p
3:
Code:

for _,b in ipairs(g)do for _,v in pairs(B(b).i)do F.H(v)end for s=1,CNS(b)do t=B(b).i[s]t:ClearAllPoints()F.SP(t,'TOPLEFT',F,'TOPLEFT',(i-1)%c*z+8,-(C(i/c)-1)*z-24)F.S(t)i=i+1 end F.up(b)end F:SS(z*min(c,i)-p+16,z*(C(i/c)-1)-p+32)end,up=function(i)if H(i)
4:
Code:

then ContainerFrame_Update(B(i))end end,ul=function(i,s)if H(i)and s then ContainerFrame_UpdateLockedItem(B(i),s)end end})F:SetBackdrop{bgFile=[[Interface\ChatFrame\ChatFrameBackground]],edgeFile=[[Interface\Tooltips\UI-Tooltip-Border]],edgeSize=16,tile=1
5:
Code:

,tileSize=16,insets={left=4,right=4,top=4,bottom=4}}F:SetBackdropColor(0,0,0,.5)F:SSc('OnEvent',function(s,e,...)s[e](...)end)F.RE=function(e,m)F:R(e)F[e]=F[m]end F.RE('BAG_UPDATE','up')F.RE('ITEM_LOCK_CHANGED','ul')F:MM()F.lo(8,2)F:SP('RIGHT',-48,0)F:H()
6:
Code:

SL(function()if F:IsShown()then F:H()else F:S()end end,'/mb')
Original:
Code:

local F,CNS,Mt,C,g=CF('Button','McBag',UIParent),GetContainerNumSlots,setmetatable,ceil,{0,1,2,3,4,5}
local B,H=function(i,b) b=F.b[i] b.size=CNS(i) return b end,function(i)for k,v in pairs(g) do if v == i then return k end end end
Ij(F,{
        b=Mt({},{__index=function(t,k,f)
                f=CF('Frame',F:GetName()..'B'..k,F) f:SetID(k) t[k]=f
                f.i=Mt({},{__index=function(t,i,s)
                        s=CF('Button',f:GetName()..'Item'..i,f,'ContainerFrameItemButtonTemplate') s:SetID(i) t[i]=s
                        return s
                end})
                return f
        end}),
        lo=function(c,p,i,z,t)
                i,z=1,36+p
                for _,b in ipairs(g) do
                        for _,v in pairs(B(b).i) do F.H(v) end
                        for s=1,CNS(b) do
                                t=B(b).i[s]
                                t:ClearAllPoints()
                                F.SP(t,'TOPLEFT',F,'TOPLEFT',(i-1)%c*z+8,-(C(i/c)-1)*z-24)
                                F.S(t)
                                i=i+1
                        end
                        F.up(b)
                end
                F:SS(z*min(c,i)-p+16,z*(C(i/c)-1)-p+32)
        end,
        up=function(i)
                if H(i) then
                        ContainerFrame_Update(B(i))
                end
        end,
        ul=function(i,s)
                if H(i) and s then
                        ContainerFrame_UpdateLockedItem(B(i),s)
                end
        end
})

F:SetBackdrop{
        bgFile=[[Interface\ChatFrame\ChatFrameBackground]],
        edgeFile=[[Interface\Tooltips\UI-Tooltip-Border]],
        edgeSize=16,
        tile=1,
        tileSize=16,
        insets={left=4,right=4,top=4,bottom=4}}
F:SetBackdropColor(0,0,0,.5)

F:SSc('OnEvent',function(s,e,...)s[e](...)end)
F.RE = function(e,m) F:R(e) F[e]=F[m] end
F.RE('BAG_UPDATE','up')
F.RE('ITEM_LOCK_CHANGED','ul')
F:MM()

F.lo(8,2)
F:SP('RIGHT',-48,0)
F:H()
SL(function()if F:IsShown() then F:H() else F:S() end end, '/mb')


Cogwheel 05-22-10 06:36 PM

:eek:


I luff you!


:banana:

Slakah 05-23-10 04:45 AM

I think it might be a nice addition to the McRun macro if we were able to separate the McRun mods using <> this would allow the naming of each snippet by having name<code>, it would also make it substantially easier for an external addon created to manage snippets to differentiate between different snippets.
something like this
lua Code:
  1. /run local function m(p,e)local s,i,f,c={},0,GetMacroInfo repeat s[i]=c i=i+1 c,c,c=f(p..i)until(not c)table.concat(s," "):gsub("%b<>",function(x)setfenv(loadstring(x:sub(2,-2)),e and setmetatable(e,{__index=_G})or _G)()end)end m"McLib"m"McLoad"McRun=m

Also the current Mc<addons> are making pretty quick progress :)

pingbo 05-24-10 03:28 PM

McCC
 
Here's a CooldownCount (this code is basically taken from evl's BlizzardTweaks and then stuffed through a meat grinder).

1:
Code:

local h,c,t,b,x,U=hooksecurefunc,"CENTER"U=function(f,e)if f.x and f.a then t=ceil(f.s+f.d-GetTime())if f.e>0 and t>0 then f.x:T(t)else f.x:T""f.a=false end end end h("ActionButton_OnUpdate",U)h("CooldownFrame_SetTimer",function(f,s,d,e)b=Ij(f:GetParent(
2:
Code:

))if s>0 and d>3 and e>0 then if not b.x then t=CF("Frame",b:N().."C",f)t:SzPt(32,32,c,b,c)x=Ij(t:CF(nil,"ARTWORK"))x:SetFont(NAMEPLATE_FONT,20)x:SetTextColor(1,.9,.2)x:SAP(t)x:SetJustifyH(c)b.x=x else b.x:T""end b.a,b.s,b.d,b.e=true,s,d,e U(f,1)end end)
Original:
Code:

local h,c,t,b,x,U=hooksecurefunc,"CENTER"
U=function(f,e)
        if f.x and f.a then
                t=ceil(f.s+f.d-GetTime())
                if f.e>0 and t>0 then
                        f.x:T(t)
                else
                        f.x:T""
                        f.a=false
                end
        end
end
h("ActionButton_OnUpdate",U)
h("CooldownFrame_SetTimer",function(f,s,d,e)
        b=Ij(f:GetParent())
        if s>0 and d>3 and e>0 then
                if not b.x then
                        t=CF("Frame",b:N().."C",f)
                        t:SzPt(32,32,c,b,c)
                        x=Ij(t:CF(nil,"ARTWORK"))
                        x:SetFont(NAMEPLATE_FONT,20)
                        x:SetTextColor(1,.9,.2)
                        x:SAP(t)
                        x:SetJustifyH(c)
                        b.x=x
                else
                        b.x:T""
                end
                b.a,b.s,b.d,b.e=true,s,d,e
                U(f,1)
        end
end)


Edit: With McRun 1.3 and a lot of finessing, I was able to get this down to 2 macros. I removed the stipulation that it only shows for abilities with less than one minute cooldowns, mostly to save space (so an ability with a 2-minute cooldown might show up as "1..." for a while until it gets below 100 seconds).

Cogwheel 05-25-10 10:12 PM

Quote:

Originally Posted by Slakah (Post 189032)
I think it might be a nice addition to the McRun macro if we were able to separate the McRun mods using <> this would allow the naming of each snippet by having name<code>, it would also make it substantially easier for an external addon created to manage snippets to differentiate between different snippets.
something like this
lua Code:
  1. /run local function m(p,e)local s,i,f,c={},0,GetMacroInfo repeat s[i]=c i=i+1 c,c,c=f(p..i)until(not c)table.concat(s," "):gsub("%b<>",function(x)setfenv(loadstring(x:sub(2,-2)),e and setmetatable(e,{__index=_G})or _G)()end)end m"McLib"m"McLoad"McRun=m

if 1 > 1 - 1 then this:fail() end

;)

Put another way, any additions to the "syntax" of McRun scripts would either interfere with the lua syntax or require too much code to accomplish robustly (special comments, for instance would consume a lot of characters). Plus, I don't think you'd gain more characters than you would save by tighter packing (or at least not enough to make the extra library weight worth it).

That or I'm just being stubborn. I don't want to make any changes to McRun's fundamental architecture at this point. :o

<edit>
As far as McRun management addons, I think using the names of the macros will suffice.
</edit>

Quote:

Also the current Mc<addons> are making pretty quick progress :)

le squee :banana:

Cogwheel 05-25-10 11:45 PM

V1.3
 
New version posted. See the link in the OP for details.

Thanks to everyone's enthusiasm, I've been able to identify several methods that are worth the additional macro slot for McLib:

:N (GetName)
:SAP (SetAllPoints)
:CAP (ClearAllPoints)
:T (SetText)
:FT (SetFormattedText)
:CF (CreateFontString)
:HS (HookScript)

I've also added a couple more code shortening tips.

zork 05-26-10 01:48 PM

Holy crap. This is like bringing Twiiter to WoW. :D
To bad I need textures.

Cogwheel 06-30-10 05:21 PM

So now that the NDA is lifted, I might as well mention the reason i made this... Addons were disabled through most of the Cataclysm Alpha and i NEED my bar mods!

Torhal 06-30-10 05:30 PM

And here I thought you had a completely unrelated mental disorder...:D

ffcloud2000 07-02-10 01:29 AM

Would anyone be able to make a script that would allow me to add keybinds to Main Action Bar 2? I was trying to do it hacking away at CogsBar but wasn't having any luck :( It's the bar under keys 1,2,3 etc etc (uses ActionID 13-24)

or if someone could help me make a CogsBar config that creates 1 12button bar with keybinds and sets the bar offscreen

trying to cheat but not working out too well :(
Code:

bars={
 {B=24,W=12,V=-500,H=0,
  K={'nil','nil','nil','nil','nil','nil',
    'nil','nil','nil','nil','nil','nil',
    'Z','X','SHIFT-Q','SHIFT-E',
    'SHIFT-W','SHIFT-A','SHIFT-S','SHIFT-D',
    'F1','F2','F3','F4',},
 },}

nevermind i got it to work :).. tho it would be nice to do it without the nils..

ffcloud2000 07-02-10 03:22 AM

Quote:

Originally Posted by Slakah (Post 188603)
lua Code:
  1. local f,l=CF()f:SSc("OnEvent",function()for b=0,4 do for s=0,GetContainerNumSlots(b)do l=GetContainerItemLink(b,s)if l and select(3,GetItemInfo(l))==0 then ShowMerchantSellCursor(1)UseContainerItem(b,s)end end end end)f:R"MERCHANT_SHOW"

Ok heres an autojunk seller, 237 characters (it's not tested but it's pretty much identical to tekjunkseller).

Causes my fps to drop hard when i run it and makes AutoMcRun's memory usage to go through the roof

Cogwheel 07-02-10 09:12 AM

Quote:

Originally Posted by ffcloud2000 (Post 195459)
nevermind i got it to work :).. tho it would be nice to do it without the nils..

Glad you got it working. FWIW, the the nils shouldn't be in quotes otherwise it's trying to set the binding to a key called "nil". Since there's no key called "nil" it doesn't really break anything, but removing the quotes will help keep the character count down :)

I agree it would be nice to have more direct control over the action slots used, but there are too many "would be nice"s to fit inside just a few macro slots. (I can think of a few I'd like as well).

Cogwheel 07-02-10 09:30 AM

Quote:

Originally Posted by ffcloud2000 (Post 195470)
Causes my fps to drop hard when i run it and makes AutoMcRun's memory usage to go through the roof

Would I be correct in assuming the FPS drop is only temporary? I don't see anything obviously wrong with the code.

This kind of performance impact is actually inevitable for any auto-junk selling addon. The API calls involved generate a lot of information (read: memory usage). There's also the effect of all the "sell item" calls which depends on your latency. This is simply the side effect of sending several (dozens?) of server requests.

The only way to get around these is to sell items asynchronously, but that requires a lot of extra code overhead (and if you walk away from the vendor during the process, not everything will be sold).

slickwalker 07-03-10 08:20 AM

You really are a coding genius Cog.

mikelley517 07-05-10 06:53 AM

McLoad Script-noob question.
 
I love the idea of this, but I am no code writer. I see that all these are required to be included in a "McLoad script" but I have not seen an example of the mcload script. Did I miss something obvious? Thanks for the help!

Cogwheel 07-05-10 08:00 AM

Quote:

Originally Posted by mikelley517 (Post 195957)
I love the idea of this, but I am no code writer. I see that all these are required to be included in a "McLoad script" but I have not seen an example of the mcload script. Did I miss something obvious? Thanks for the help!

The section of the main McRun page called "Creating the McRun addon loader(s)" describes McLoad itself, and "Installing a McRun addon" gives an example of adding an addon to it.

I'm also working on a more beginner-friendly walkthrough that should be done in the not-too-distant future.

mikelley517 07-06-10 03:55 AM

Quote:

Originally Posted by Cogwheel (Post 195967)
The section of the main McRun page called "Creating the McRun addon loader(s)" describes McLoad itself, and "Installing a McRun addon" gives an example of adding an addon to it.

I'm also working on a more beginner-friendly walkthrough that should be done in the not-too-distant future.

Thank you. I did get the bars to work, but I was wondering if there is a way to hide the blizz main action bar, or if I just move this bar to where i want it and ignore the other. Thanks for all the work and the quick response!


All times are GMT -6. The time now is 01:47 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI