This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Classic Theme
Thottbot Theme
Useful Sneaky or Complicated Macros
Post Reply
Return to board index
Post by
Wanderingfox
No wai; shortening macros is fun.
It does show the "You aren't in a party." message if you're not in a party and try to SCM to "PARTY".
Funny you did it that way, this is what I thought of when I was driving home from work...
/run local r,p,t=GetNumRaidMembers(),GetNumPartyMembers(),UnitName("target") if r+p>0 then SendChatMessage("Resurrecting "..t..".",r and "RAID" or "PARTY) end
Does that look like it would work?
Yes, it does, but It seems like a large amount of unneeded math to me. If you need to do the GetNumRaidMembers() and "RAID" or "PARTY" anyway, why not just use the result of that to figure out whether or not you should send the chat message or not?
Post by
pelf
Yeah, that's the tradeskill macro, thanks.
EDIT
: Well, I didn't want it to do anything when BOTH return 0, so adding them seemed to be a good way to check that. After that, it's mutually exclusive; if you're in a raid, you're not in a party for the purposes of this macro.
Post by
Wanderingfox
Well what I was getting at is that the r+p>0 bit is literally checking if you're in either a party or a raid... which is basically what the second part does. The only difference being that your method won't generate an error if the person isn't in a party. Throwing a /stopmacro nogroup at the top resolves that though
:P
Post by
260392
This post was from a user who has deleted their account.
Post by
pelf
Well what I was getting at is that the r+p>0 bit is literally checking if you're in either a party or a raid... which is basically what the second part does. The only difference being that your method won't generate an error if the person isn't in a party. Throwing a /stopmacro nogroup at the top resolves that though
:P
Ohh, stopmacro nogroup is a good idea. Look at how sneaky you are. Totally belong in this thread. I'll go with that.
@Elvis: Yeah. You can have only one GCD-locking spell in a macro at a time. But, the trinkets don't make a GCD and Inner Focus doesn't either. The sound and error stuff wrapping them make sure there are no errors or sounds when the trinkets or IF is on cooldown. Does that explain it?
Post by
pelf
Can we analyze and improve these:
Intended to sell all gray items to a vendor. Improvements: fix the stupid variable spam at the end / make it stop if there's no vendor open.
/script local G=0 for 0,4 do for s=1,GetContainerNumSlots(b) do local n=GetContainerItemLink(b,s) if n and string.find(n,"ff9d9d9d") then N,L,R,IL,M,T,ST,S,E,I,SP = GetItemInfo(n); print(n); G=G+SP; UseContainerSlot(b,s) end end end print(getCoinText(G))
Intended to delete all gray items.
/stopmacro
/run for bag = 0,4,1 do for slot = 1, 32, 1 do local name = GetContainerItemLink(bag,slot); if name and string.find(name,"ff9d9d9d") then PickupContainerItem(bag,slot); DeleteCursorItem(); end; end; end
Trade skill link. Uses GetChannelName for trade channel number independence? Is that right? Also uses a different API to get the tradeskill link. Which is right?
/script CastSpellByName(#prof#);SendChatMessage("I'll create items against mats, look out: "..GetTradeSkillListLink(),"CHANNEL",nil,GetChannelName("Trade - City"));CloseTradeSkill();
Multiple trade skills.
/cast Inscription
/run SendChatMessage("Free with your mats "..GetTradeSkillListLink(), "channel", nil, "2")
/cast Enchanting
/run SendChatMessage(GetTradeSkillListLink().." I'll even give you 5g if I skill up!", "channel", nil, "2") CloseTradeSkill()
Post by
260392
This post was from a user who has deleted their account.
Post by
Safturento
Intended to sell all gray items to a vendor. Improvements: fix the stupid variable spam at the end / make it stop if there's no vendor open.
/script local G=0 for 0,4 do for s=1,GetContainerNumSlots(b) do local n=GetContainerItemLink(b,s) if n and string.find(n,"ff9d9d9d") then N,L,R,IL,M,T,ST,S,E,I,SP = GetItemInfo(n); print(n); G=G+SP; UseContainerSlot(b,s) end end end print(getCoinText(G))
That macro was murdering my bugsack and took 254 characters, fixed it and cut it down to 236:
/script if MerchantFrame:IsShown() then local G=0 for b=0,4 do for s=1,32 do local n=GetContainerItemLink(b,s) if n and string.find(n,"ff9d9d9d") then print(n); G=G+select(11,GetItemInfo(n)); UseContainerItem(b,s) end end end print(GetCoinText(G)) end
I don't think it'll be possible to stop it from running when your not at a vendor without breaking the character limit though.
>.<
edit: cut it down to 215 now, might be able to squeeze that in there.
edit2: Macro will no longer do anything if a merchant frame isn't open. It's now back to 251 characters though.
edit3: Just shortened some variable names for the second macro:
/stopmacro
/run for b=0,4 do for s=1,32 do local n=GetContainerItemLink(b,s); if n and string.find(n,"ff9d9d9d") then PickupContainerItem(b,s); DeleteCursorItem() end end end
Post by
pelf
So, who are you anyway, Saft? You haven't been posting in UI&M before recently, have you? I like the cut of your jib.
EDIT
: Are iterator variables for a for block automatically local? I assume so as they should only have scope in that block unless you explicitly use a previously defined variable, yes?
What do you (all) think about GetTradeSkillLIstLink and GetChannelName?
EDIT2
: I think this is going to be almost enough for me to start formatting that first post. Whoopie.
Post by
Wikipedia
He's one of us, the UI nubs
:D
Post by
Safturento
So, who are you anyway, Saft? You haven't been posting in UI&M before recently, have you? I like the cut of your jib.
Well until a few months ago my Lua knowledge was pretty limited, so most of my posts were in the Post your UI thread. When I started using Tukui I learned a hell of a lot more, so now I actually have a clue of what you guys are talking about.
:P
If you look at my recent posts though, I've been posting on the UI forums for years
XD
.
Post by
pelf
Well, I'm glad you're posting now. There's been a dearth of people who really want to discuss and debate Lua. I'm still quite a noob myself.
Post by
Wanderingfox
Sell Grays can be cut down to:
/run for b=0,4 do for s=1,GetContainerNumSlots(b) do local i,q=GetContainerItemLink(b,s) if i then _,_,q=GetItemInfo(i) if q==0 then if GetMerchantItemInfo(1) then UseContainerItem(b,s) end end end end end
Post by
Safturento
What do you (all) think about GetTradeSkillListLink and GetChannelName?
I don't think there's any way around using GetTradeSkillLink, but I think GetChannelName is pretty useless for the tradeskill macro, since the majority of people who use trade chat have it defaulted to /2.
I'd say ' Scm("msg","CHANNEL",nil,"2") ' (taken from the macro below it) is the better route.
Post by
pelf
I guess I ask because my trade usually doesn't end up as /2. I have a ton of guild channels and all sorts of stuff going on with that.
I asked about the GetTradeSkillLink because the previous macro linked used "GetSpellLink("Leatherworking")". Does the latter even work? Do both work?
Sell Grays can be cut down to:
/run for b=0,4 do for s=1,GetContainerNumSlots(b) do local i,q=GetContainerItemLink(b,s) if i then _,_,q=GetItemInfo(i) if q==0 then if GetMerchantItemInfo(1) then UseContainerItem(b,s) end end end end end
vs
/script if MerchantFrame:IsShown() then local G=0 for b=0,4 do for s=1,32 do local n=GetContainerItemLink(b,s) if n and string.find(n,"ff9d9d9d") then print(n); G=G+select(11,GetItemInfo(n)); UseContainerItem(b,s) end end end print(GetCoinText(G)) end
What's the difference? Looks like one is printing how much money you made? Also, I'd like to keep the if MerchantFrame:IsShown() thing so grays don't get equipped.
Post by
Safturento
I guess I ask because my trade usually doesn't end up as /2. I have a ton of guild channels and all sorts of stuff going on with that.
I asked about the GetTradeSkillLink because the previous macro linked used "GetSpellLink("Leatherworking")". Does the latter even work? Do both work?
Hmm, I just looked it up and it looks like if possible, GetSpellLink will get
your
tradeskill link:
Returns
link
String - A link to the spell
TradeSkillLink
String - A link to the tradeskill if available, otherwise nil. (3.0.1+)
I guess that would work better. :P
Here's what I'm thinking for the multiple tradeskill link (or single if you want):
/script SendChatMessage(GetSpellLink("Leatherworking")..GetSpellLink("Alchemy").." LFW","CHANNEL",nil,GetChannelName("Trade - City"))
Post by
pelf
There's a maximum message length, isn't there? That's going to hit it isn't it? I think that's why those multiple tradeskill link macros usually send two messages.
Post by
HighFive
Correct. It should be 255 characters.
Post by
pelf
You're like my conscience, HighFive. Always watching
:)
.
Post by
HighFive
:D
I just lurk a lot and hesitate to post most of the times.
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.