Signup Now
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 40

Thread: Task Helper

  1. #1
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22

    Task Helper

    Task Helper



    Description

    It'll show the amount of killed monsters selected on your screen and the totals.


    Configuration

    To configurate this script simply use the right mouse click, this will open a menu with all the options available.


    • Show All: Show all the monsters in a separated line.
    • Show Total Only: Show the total amount of monsters only.
    • Reset Monsters: This will set all monsters killed amount to 0. If you're using killCount by Raphael, it'll reset all the monsters on your database too.
    • Reset Timer: Restarts the timer.
    • Reset Both: Resets both timer and monsters.
    • Add Monster: This will ask for a monster name and will add its amount on the display.
    • Remove Monster: This will remove a monster name and its information from the display, this doesn't restart the count of the monster.
    • Scan Targeting: This will pick all the monsters from your targeting list and insert on the display. This will remove any custom monster you inserted with Add Monster option.

    Code

    init start
    -- local SCRIPT_VERSION = "3.1.0"

    local TaskHelper = {
    ShowAll = true,
    }

    -- DO NOT EDIT BELOW THIS LINE --

    local hud = {
    -- settings
    pos = {0, 0},
    aux = {0, 0},
    width = 0,
    height = 0,
    moving = false,

    -- colors
    blue = {0.0, color(36, 68, 105, 20), 0.33, color(39, 73, 114, 20), 0.66, color(21, 39, 60, 20)},
    black = {0.0, color(75, 75, 75, 20), 0.33, color(45, 45, 45, 20), 0.66, color(19, 19, 19, 20)},
    orange = {0.0, color(145, 95, 0, 20), 0.33, color(158, 104, 0, 20), 0.66, color(84, 55, 0, 20)},
    }

    local tempPos = $chardb:getvalue('TaskHelper', 'Position')

    if tempPos then
    tempPos = tempPos:explode(":")
    hud.pos = {tonumber(tempPos[1]), tonumber(tempPos[2])}
    end

    TaskHelper.Monsters = {}

    if not $chardb:getvalue("TaskHelper", "Monsters") then
    foreach settingsentry e 'Targeting/Creatures' do
    local mname = get(e, 'Name')

    table.insert(TaskHelper.Monsters, mname:lower())
    end

    table.sort(TaskHelper.Monsters)
    $chardb:setvalue("TaskHelper", "Monsters", table.tostring(TaskHelper.Monsters))
    else
    TaskHelper.Monsters = $chardb:getvalue("TaskHelper", "Monsters"):totable()
    end

    function inputevents(e)
    if e.type == IEVENT_MMOUSEDOWN then
    hud.moving, hud.aux = true, {$cursor.x - hud.pos[1], $cursor.y - hud.pos[2]}
    end

    if e.type == IEVENT_MMOUSEUP then
    hud.moving = false
    $chardb:setvalue('TaskHelper', 'Position', table.concat(hud.pos, ':'))
    end

    if e.type == IEVENT_RMOUSEUP then
    requestmenu(0)
    requestmenuitem(tern(TaskHelper.ShowAll, "Show Total Only", "Show All"))
    requestmenuitem("Reset Timer")
    requestmenuitem("Reset Monsters")
    requestmenuitem("Reset Both")
    requestmenuitem("Add Monster")
    requestmenuitem("Remove Monster")
    requestmenuitem("Scan Targeting")
    end

    if e.type == IEVENT_REQUESTMENU then
    if e.value1 == 0 then
    if e.value2 == 'Show Total Only' or e.value2 == 'Show All' then
    TaskHelper.ShowAll = not TaskHelper.ShowAll
    end

    if e.value2 == 'Reset Timer' or e.value2 == 'Reset Both' then
    $chardb:setvalue("TaskHelper", "Timer", tosec(os.date("%X")))
    end

    if e.value2 == 'Reset Monsters' or e.value2 == 'Reset Both' then
    for k, v in pairs(TaskHelper.Monsters) do
    $chardb:setvalue('TH MonstersKilled', v, 0)

    if killCount then
    killCount.set(0, v)
    end
    end
    end

    if e.value2 == 'Scan Targeting' then
    TaskHelper.Monsters = {}

    foreach settingsentry e 'Targeting/Creatures' do
    local mname = get(e, 'Name')

    if not table.find(TaskHelper.Monsters, mname:lower()) then
    table.insert(TaskHelper.Monsters, mname:lower())
    end
    end

    table.sort(TaskHelper.Monsters)
    $chardb:setvalue("TaskHelper", "Monsters", table.tostring(TaskHelper.Monsters))
    end

    if e.value2 == 'Add Monster' then
    requesttext(1, 'Name the monster you want to add:')
    end

    if e.value2 == 'Remove Monster' then
    requestmenu(2)

    for _, v in pairs(TaskHelper.Monsters) do
    requestmenuitem(v:capitalizeall())
    end
    end
    end

    if e.value1 == 2 then
    local t = table.find(TaskHelper.Monsters, e.value2:lower())

    if t then
    table.remove(TaskHelper.Monsters, t)
    $chardb:setvalue("TaskHelper", "Monsters", table.tostring(TaskHelper.Monsters))
    end
    end
    end

    if e.type == IEVENT_REQUESTTEXT then
    if e.value1 == 1 then
    if not table.find(TaskHelper.Monsters, e.value2:lower()) then
    table.insert(TaskHelper.Monsters, e.value2:lower())
    $chardb:setvalue("TaskHelper", "Monsters", table.tostring(TaskHelper.Monsters))
    end
    end
    end
    end

    local tempTime = tosec(os.date("%X"))

    if $chardb:getvalue("TaskHelper", "Timer") then
    if tempTime - $chardb:getvalue("TaskHelper", "Timer") >= 293^2 then
    $chardb:setvalue("TaskHelper", "Timer", tempTime)
    end
    else
    $chardb:setvalue("TaskHelper", "Timer", tempTime)
    end

    filterinput(false, true, false, false)
    setfillstyle('gradient', 'linear', 2, 0, 0, 0, 14)
    setfontstyle('Tahoma', 10, 75, 0xFFFFFF, 1.5, color(0, 0, 0, 50))
    setmaskcolorxp(0)

    init end

    if hud.moving then
    auto(10)
    hud.pos = {$cursor.x - hud.aux[1], $cursor.y - hud.aux[2]}
    end

    if killCount and killCount.lastRan <= 10000 then
    foreach $chardb:sectionvalue sec 'TH MonstersKilled' do
    $chardb:setvalue('TH MonstersKilled', sec.name, killCount.get(sec.name))
    end
    else
    foreach newmessage m do
    if m.type == MSG_INFO then
    local monster = m.content:match("Loot of a?n? (.+): .-")

    if monster then
    monster = (monster:match("the (.+)") or monster):lower()
    $chardb:setvalue('TH MonstersKilled', monster, ($chardb:getvalue('TH MonstersKilled', monster) or 0) + 1)
    end
    end
    end
    end

    local Total, Line = 0, 0
    local msg = "TASK HELPER"
    local strwidth, strheight = measurestring(msg)
    hud.width, hud.height = math.max(hud.width, strwidth or 0), math.max(hud.height, strheight or 0)

    setfillstyle('gradient', 'linear', 2, 0, 0, 0, 16)
    addgradcolors(unpack(hud.blue))
    drawroundrect(0, 0, hud.width + 10, hud.height, 2, 2)
    drawtext(msg, (hud.width - strwidth + 10) * 0.5, (hud.height - strheight) * 0.5)

    setfontsize(8)

    Line = Line + 1.2

    for _, Name in ipairs(TaskHelper.Monsters) do
    local Amount = $chardb:getvalue("TH MonstersKilled", Name)

    if Amount and Amount > 0 then
    if TaskHelper.ShowAll then
    msg = string.format("[%s] Killed: %s | Rate: %s/HR", Name:capitalizeall(), num(Amount), num(math.positive(math.floor((Amount / (tosec(os.date("%X")) - $chardb:getvalue('TaskHelper', 'Timer')) * 3600)))))
    strwidth, strheight = measurestring(msg)
    hud.width, hud.height = math.max(hud.width, strwidth or 0), math.max(hud.height, strheight or 0)

    addgradcolors(unpack(hud.black))
    drawroundrect(0, Line * hud.height, hud.width + 10, hud.height, 2, 2)
    drawtext(msg, (hud.width - strwidth + 10) * 0.5, Line * hud.height + strheight * 0.1)

    Line = Line + 1.2
    end

    Total = Total + Amount
    end
    end

    msg = string.format("Killed: %s - Rate: %s/HR - Timer: %s", num(Total), num(math.positive(math.floor((Total / (tosec(os.date('%X')) - $chardb:getvalue('TaskHelper', 'Timer')) * 3600)))), formattime(tosec(os.date('%X')) - $chardb:getvalue('TaskHelper', 'Timer')))
    strwidth, strheight = measurestring(msg)
    hud.width, hud.height = math.max(hud.width, strwidth or 0), math.max(hud.height, strheight or 0)

    addgradcolors(unpack(hud.orange))
    drawroundrect(0, Line * hud.height, hud.width + 10, hud.height, 2, 2)
    drawtext(msg, (hud.width - strwidth + 10) * 0.5, Line * hud.height + strheight * 0.1)

    Line = Line + 1.2

    setfixedsize(hud.width * 1.1, hud.height * Line)
    setposition(unpack(hud.pos))

    Download
    Last edited by Leonardo; 03-16-2015 at 06:00 PM.

  2. #2
    Free User Ragekemi's Avatar
    Join Date
    Jan 2014
    Location
    Curitiba - Parana - Brazil
    Posts
    242
    Reputation
    13
    Rep Power
    21
    @Leonardo ,is there a way to itinerate this with Persistent Kill Counter by Raphael ?
    RagekemiScriptsWorkshop


    LASTEST SCRIPTS | UPDATES | CHECK MY THREAD!


  3. #3
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    Quote Originally Posted by Ragekemi View Post
    @Leonardo ,is there a way to itinerate this with Persistent Kill Counter by Raphael ?
    Yes, I recently asked Raphael to update his persistent so I can extract the information from it, I just haven't time to update my HUD aswell.

  4. #4
    Free User Sajean's Avatar
    Join Date
    Feb 2014
    Posts
    386
    Reputation
    26
    Rep Power
    21
    @Ragekemi what you need to make with implement in this persistent ?
    I have make a little modified and working for me with my task counter.
    Last edited by Sajean; 08-03-2014 at 07:02 PM.

  5. #5
    Free User Ragekemi's Avatar
    Join Date
    Jan 2014
    Location
    Curitiba - Parana - Brazil
    Posts
    242
    Reputation
    13
    Rep Power
    21
    Quote Originally Posted by Leonardo View Post
    Yes, I recently asked Raphael to update his persistent so I can extract the information from it, I just haven't time to update my HUD aswell.
    Thank's alot, rep+ for that.

    Quote Originally Posted by Sajean View Post
    @Ragekemi what you need to make with implement in this persistent ?
    I have make a little modified and working for me with my task counter.
    That:
    Quote Originally Posted by Ragekemi View Post
    Next release: Farmine - Ghastly Dragons + Ethershreck Tasker
    RagekemiScriptsWorkshop


    LASTEST SCRIPTS | UPDATES | CHECK MY THREAD!


  6. #6
    Free User
    Join Date
    May 2014
    Posts
    25
    Reputation
    10
    Rep Power
    0
    12:59:32 error in Persistent script NewPersistentScript4:
    ["HUD.Restart = drawroundrect(x ..."]:NewPersistentScript4:84 attempt to perform arithmetic on global 'w' (a nil value)

    What can I do to fix it ? thanks ;D

  7. #7
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    Quote Originally Posted by tiagokg View Post
    12:59:32 error in Persistent script NewPersistentScript4:
    ["HUD.Restart = drawroundrect(x ..."]:NewPersistentScript4:84 attempt to perform arithmetic on global 'w' (a nil value)

    What can I do to fix it ? thanks ;D
    Put on the right place, HUD > New Hud not Scripter persistents.

  8. #8
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    @Ragekemi

    Done bro.

    Changelog:

    The right click draggable function was substituted by a built-in menu with all the options described on the first post. To move the HUD use the middle mouse button.
    The "Reset" button was substituted by the menu option "Reset Both", "Reset Timer" and "Reset Monsters".
    This version consumes 4-5x less memory than the last version, so I really recommend to change.
    Can be used with killCount by @Raphael, some functions of the HUD will also reset monsters in both HUD and killCount (read main post).

  9. #9
    Free User Ragekemi's Avatar
    Join Date
    Jan 2014
    Location
    Curitiba - Parana - Brazil
    Posts
    242
    Reputation
    13
    Rep Power
    21
    Quote Originally Posted by Leonardo View Post
    @Ragekemi

    Done bro.

    Changelog:

    The right click draggable function was substituted by a built-in menu with all the options described on the first post. To move the HUD use the middle mouse button.
    The "Reset" button was substituted by the menu option "Reset Both", "Reset Timer" and "Reset Monsters".
    This version consumes 4-5x less memory than the last version, so I really recommend to change.
    Can be used with killCount by @Raphael, some functions of the HUD will also reset monsters in both HUD and killCount (read main post).

    Thanksssssssssss


    error in HUD script TaskHelper:
    ["if killCount and killCount.lastRan <= 10..."]:TaskHelper:156 attempt to compare nil with number




    Really no idea what i'm doing wrong, just replaced the old by the new one
    Last edited by Ragekemi; 08-17-2014 at 05:32 PM.
    RagekemiScriptsWorkshop


    LASTEST SCRIPTS | UPDATES | CHECK MY THREAD!


  10. #10
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,441
    Reputation
    309
    Rep Power
    28
    Quote Originally Posted by Ragekemi View Post
    Thanksssssssssss


    error in HUD script TaskHelper:
    ["if killCount and killCount.lastRan <= 10..."]:TaskHelper:156 attempt to compare nil with number




    Really no idea what i'm doing wrong, just replaced the old by the new one
    You need to update your Kill Counter script.

 

 

Posting Permissions

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