This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Classic Theme
Thottbot Theme
Help with an unusual macro?
Post Reply
Return to board index
Post by
1025907
This post was from a user who has deleted their account.
Post by
pelf
Likely larger than the scope of a macro. It would have to handle whatever event fires when a trade completes. You could either use HighFive's guide and make a mini-addon to do it or use something like _DevPad and write it in there.
Post by
janniie
/run local f,C=CreateFrame("Frame")f:RegisterEvent("TRADE_CLOSED")f:RegisterEvent("PLAYER_MONEY")f:SetScript("OnEvent",function(s,e)if e=="PLAYER_MONEY" and C then print(format("G: %d",floor(C-GetMoney()/10000)))C=nil else C=GetMoney() end end)
Drycoded, but it could work? (244 chars) And only prints Gold
Post by
pelf
Disclaimer being, of course, that you have to hit that macro once every time you log in to any character you want it active on. Also, if you hit it more than once, it appears that it will just create more frames and handle the same event
n
times where
n
is the number of times you've pressed it.
If I'm reading that wrong and the latter isn't the case, I apologize for saying it was.
Post by
HighFive
Yep, pelf is correct. You should just make them globals and add "if not f then ... end".
I don't understand your logic, but this seems wrong: "e=="PLAYER_MONEY" and C". The 'and' operator has higher precedence than the '==' one. You could just make that "C and e=="PLAYER_MONEY"". Also, I suggest making "PLAYER_MONEY" a variable for maximum golf
age.
Post by
Neffi
If you need a script to run once upon login, don't throw it in a macro. Download
Devpad
, insert the script into a new page (sans the leading /run) and click the arrow next to the page's name to have it auto-run on startup.
This also gives you the benefit of not having to squish things down so far. And syntax highlighting.
local f = CreateFrame('Frame')
local C
f:RegisterEvent("TRADE_CLOSED")
f:RegisterEvent("PLAYER_MONEY")
f:SetScript("OnEvent",function(s,e)
if e=="PLAYER_MONEY" and C then
print(format("G: %d",floor(C-GetMoney()/10000)))
C=nil
else
C=GetMoney()
end
end)
Post by
pelf
Yeah. That's what I said
:)
. And there's the code for it. win/win
Post by
HighFive
It's bugging me, so let me just fix it.local f = CreateFrame('Frame')
local C
f:RegisterEvent("TRADE_CLOSED")
f:RegisterEvent("PLAYER_MONEY")
f:SetScript("OnEvent",function(s,e)
if e == "TRADE_CLOSED" then
C=GetMoney()
else if C then
C = (C - GetMoney())/10000
if C > 0 then
print(format("Got %dg", floor(C)))
else
C = -C
print(format("Gave %dg", floor(C)))
end
C=nil
end
end)
BTW, I couldn't find the API to get your tradee's (Is this a word? It should be) name. What am I missing? :|
Post by
pelf
My guess (without looking) is that it's something you have to catch when the trade opens rather than closes.
Post by
Thearksrainbow
how do i make it not whisper them and instead public!
Post by
kc99
<a href="
https://1680380.com/view/fcssq/index.html"
title="福彩双色球">福彩双色球</a>
<a href="
https://1680380.com/view/jisuft/pk10kai.html"
title="极速飞艇">极速飞艇</a>
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.