Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ Spell Timer

Spell Timer

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Morat   (18 posts)  Bio
Date Thu 18 Feb 2010 06:41 PM (UTC)
Message
This Lua script tracks protective spells using a miniwindow.

You are affected by the following spells:
Spell: armor             : modifies armor class by -20 for 24 cycles, (12 hours)
Spell: sanctuary         : modifies none by 0 for 6 cycles, (3 hours)
Spell: shield            : modifies armor class by -20 for 46 cycles, (23 hours)
Spell: stone skin        : modifies armor class by -40 for 38 cycles, (19 hours)


A cycle is random, but the range is about 42 to 48 seconds per cycle.

A sanctuary spell lasts at minimum 6*42 seconds.

Screenshot:

http://photobucket.com/albums/ad147/moratbucket/spell.png

3, 6 or 9 o'clock means the spell is 25, 50 or 75 percent done, respectively.

The clock is white if the spell has more than 6*42*2/3 seconds to drop.
The clock is yellow if the spell has between 6*42*2/3 and 6*42*1/3 seconds to drop.
The clock is red if the spell has less than 6*42*1/3 seconds to drop.

At 12 o'clock, the timer disappears. When the spell drops, the timer and icon disappears.

I'm curious how other users are tracking their spells with miniwindows.

* Timer

Event: Every interval, 1 second

if not spell then
  spell = {}
  table.insert(spell, {name =      "armor", cycle = 24, time = 24*42, stamp = 0})
  table.insert(spell, {name =  "sanctuary", cycle =  6, time =  6*42, stamp = 0})
  table.insert(spell, {name =     "shield", cycle = 46, time = 46*42, stamp = 0})
  table.insert(spell, {name = "stone skin", cycle = 38, time = 38*42, stamp = 0})
  WindowCreate("spell",                                       -- miniwindow name
    0, 0,                                                     -- left, top (ignore)
    2*64, #spell*64,                                          -- width, height
    6,                                                        -- position (top right)
    8,                                                        -- flags (ignore mouse)
    ColourNameToRGB("black"))                                 -- background colour
  WindowLoadImage("spell",      "armor",      "armor.png")    -- load miniwindow images (64x64 pixels)
  WindowLoadImage("spell",  "sanctuary",  "sanctuary.png")
  WindowLoadImage("spell",     "shield",     "shield.png")
  WindowLoadImage("spell", "stone skin", "stone_skin.png")
  WindowShow("spell", true)                                   -- show miniwindow
else
  for n = 1, #spell do
    local countdown = spell[n].time+spell[n].stamp-os.time()
    if countdown > 0 then
      local pct = 1-countdown/spell[n].time                   -- percent usage: 0 to 1
      local rgb                                               -- circle colour: white, yellow, red
      if     countdown > 6*42*2/3 then
        rgb = ColourNameToRGB("white")                        -- white: countdown > 6*42*2/3
      elseif countdown < 6*42*1/3 then
        rgb = ColourNameToRGB("red")                          --   red: countdown < 6*42*1/3
      else
        rgb = ColourNameToRGB("yellow")
      end
      WindowRectOp("spell",                                   -- miniwindow name
        2,                                                    -- action (fill rectangle with colour 1)
        0, (n-1)*64, 1*64, n*64,                              -- left, top, right, bottom
        ColourNameToRGB("black"),                             -- colour 1
        0)                                                    -- colour 2 (ignore)
      WindowCircleOp("spell",                                 -- miniwindow name
        1,                                                    -- action (ellipse)
        64/4, 64/4+(n-1)*64, 64*3/4, 64*3/4+(n-1)*64,         -- left, top, right, bottom
        rgb, 0, 3,                                            -- pen colour, pen style (solid), pen width
        rgb, 0,                                               -- brush colour, brush style (solid)
        0, 0, 0, 0)                                           -- extra 1 through 4 (ignore)
      WindowLine("spell",                                     -- miniwindow name
        64/2,                                                 -- x position start point
        64/2+(n-1)*64,                                        -- y position start point
        math.cos(pct*2*math.pi-math.pi/2)*64/4+64/2,          -- x position end point
        math.sin(pct*2*math.pi-math.pi/2)*64/4+64/2+(n-1)*64, -- y position end point
        ColourNameToRGB("black"), 0, 3)                       -- pen colour, pen style (solid), pen width
    else
      WindowRectOp("spell",                                   -- miniwindow name
        2,                                                    -- action (fill rectangle with colour 1)
        0, (n-1)*64, 1*64, n*64,                              -- left, top, right, bottom
        ColourNameToRGB("black"),                             -- colour 1
        0)                                                    -- colour 2 (ignore)
    end
    Redraw()
  end
end


continue...
Top

Posted by Morat   (18 posts)  Bio
Date Reply #1 on Thu 18 Feb 2010 06:47 PM (UTC)
Message
* Trigger (sanctuary spell up)

Regex: ^You are surrounded by a white aura\.$

if spell then
  local n = 2
  spell[n].stamp = os.time()
  WindowDrawImage("spell",      -- miniwindow name
    spell[n].name,              -- image name
    1*64, (n-1)*64, 0, 0,       -- left, top, right, bottom
    1,                          -- mode (copy without stretching or transparency)
    0, 0, 0, 0)                 -- src left, top, right, bottom (ignore)
  Redraw()
end


* Trigger (sanctuary spell down)

Regex: ^(The white aura around your body fades)\.$
Send to: Script (after omit)

if spell then
  local n = 2
  local function round(x) return math.floor(x+0.5) end
  local timepercycle = round((os.time()-spell[n].stamp)/spell[n].cycle)
  if spell[n].stamp == 0 then
    AnsiNote(ANSI(37) .. "%1.")
  else
    AnsiNote(ANSI(37) .. "%1 (" .. spell[n].cycle .. "*" .. timepercycle .. ")")
  end
  spell[n].stamp = 0
  WindowRectOp("spell",         -- miniwindow name
    2,                          -- action (fill rectangle with colour 1)
    1*64, (n-1)*64, 2*64, n*64, -- left, top, right, bottom
    ColourNameToRGB("black"),   -- colour 1
    0)                          -- colour 2 (ignore)
  Redraw()
end


* Trigger

Regex: ^You are not affected by any spells\.$

if spell then
  for n = 1, #spell do
    spell[n].stamp = 0
  end
  WindowRectOp("spell",         -- miniwindow name
    2,                          -- action (fill rectangle with colour 1)
    1*64, 0, 2*64, #spell*64,   -- left, top, right, bottom
    ColourNameToRGB("black"),   -- colour 1
    0)                          -- colour 2 (ignore)
  Redraw()
end


* Trigger

Regex: ^You are affected by the following spells\:$

if spell then
  WindowRectOp("spell",         -- miniwindow name
    2,                          -- action (fill rectangle with colour 1)
    1*64, 0, 2*64, #spell*64,   -- left, top, right, bottom
    ColourNameToRGB("black"),   -- colour 1
    0)                          -- colour 2 (ignore)
  Redraw()
end


* Trigger

Regex: ^Spell\: sanctuary

if spell then
  local n = 2
  WindowDrawImage("spell",      -- miniwindow name
    spell[n].name,              -- image name
    1*64, (n-1)*64, 0, 0,       -- left, top, right, bottom
    1,                          -- mode (copy without stretching or transparency)
    0, 0, 0, 0)                 -- src left, top, right, bottom (ignore)
  Redraw()
end


* Images (64x64 pixels) for Armor, Sanctuary, Shield, Stone Skin

http://vnmedia.ign.com/wowvault.ign.com/icons/Spell_Holy_EmpowerChampion.png
http://vnmedia.ign.com/wowvault.ign.com/icons/Ability_Paladin_BeaconofLight.png
http://vnmedia.ign.com/wowvault.ign.com/icons/Spell_Holy_GreaterBlessingofSanctuary.png
http://vnmedia.ign.com/wowvault.ign.com/icons/Spell_Holy_GreaterBlessingofMight.png
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,255 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.