1. #1
    I am Murloc! Terahertz's Avatar
    10+ Year Old Account
    Join Date
    Apr 2012
    Location
    Your basement
    Posts
    5,177

    Converting macro script into addon?

    So I've got this macro that changes my stopwatch to fit my taste. It puts the stopwatch in the middle of the screen without any borders, just the text. I copied this macro from a rogue livestreamer but I extremely dislike having to press the macro every time I log in or reload. So I was wondering if it's possible to convert the script into an addon.

    Code:
    /run StopwatchFrame:SetScale(.01)
    /run StopwatchFrame:SetPoint("TOPLEFT",84750,-16000)
    /run StopwatchTicker:SetScale(100)
    /run StopwatchTicker:SetPoint("TOPLEFT",-330,-400)
    /run StopwatchFrame:SetMovable(false)
    Thanks

  2. #2
    Yes, it is.

    Basically you just need to make a .lua file without the same lines without the /run at the beginning.

    For making it a complete addon there's a sticky guide.
    Last edited by Coldkil; 2013-12-16 at 10:00 PM.
    Non ti fidar di me se il cuor ti manca.

  3. #3
    Code:
    local a = CreateFrame("Frame")
    a:RegisterEvent("PLAYER_LOGIN")
    a:SetScript("OnEvent", function(self)
     StopwatchFrame:SetScale(.01)
     StopwatchFrame:SetPoint("TOPLEFT",84750,-16000)
     StopwatchTicker:SetScale(100)
     StopwatchTicker:SetPoint("TOPLEFT",-330,-400)
     StopwatchFrame:SetMovable(false)
    self:UnregisterAllEvents()
    end)

  4. #4

  5. #5
    Deleted
    For simple things like this I usually use DevPad instead, since it lets you set Lua code to autorun with just a paste and a button press.

    Quote Originally Posted by Aleaa View Post
    Code:
    local a = CreateFrame("Frame")
    a:RegisterEvent("PLAYER_LOGIN")
    a:SetScript("OnEvent", function(self)
     StopwatchFrame:SetScale(.01)
     StopwatchFrame:SetPoint("TOPLEFT",84750,-16000)
     StopwatchTicker:SetScale(100)
     StopwatchTicker:SetPoint("TOPLEFT",-330,-400)
     StopwatchFrame:SetMovable(false)
    self:UnregisterAllEvents()
    end)
    I'm not entirely sure, but I think you might want PLAYER_ENTERING_WORLD instead? If the stopwatch position gets reset upon entering and leaving instances when using the above, replacing "PLAYER_LOGIN" with "PLAYER_ENTERING_WORLD" should fix it, anyway.
    Last edited by mmocf531e475c8; 2013-12-16 at 10:03 PM.

  6. #6
    I am Murloc! Terahertz's Avatar
    10+ Year Old Account
    Join Date
    Apr 2012
    Location
    Your basement
    Posts
    5,177
    Quote Originally Posted by Coldkil View Post
    Yes, it is.

    Basically you just need to make a .lua file without the same lines without the /run at the beginning.

    For making it a complete addon there's a sticky guide.
    Already skimmed through the sticky guide, but couldn't find anything about macro code into addon lua code and I've no knowledge of lua at all.
    Quote Originally Posted by Aleaa View Post
    Code:
    local a = CreateFrame("Frame")
    a:RegisterEvent("PLAYER_LOGIN")
    a:SetScript("OnEvent", function(self)
     StopwatchFrame:SetScale(.01)
     StopwatchFrame:SetPoint("TOPLEFT",84750,-16000)
     StopwatchTicker:SetScale(100)
     StopwatchTicker:SetPoint("TOPLEFT",-330,-400)
     StopwatchFrame:SetMovable(false)
    self:UnregisterAllEvents()
    end)
    Thanks, going to try this out now

    Nice, it's working! Thanks Aleaa
    Last edited by Terahertz; 2013-12-16 at 10:14 PM.

Posting Permissions

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