Signup Now
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 48

Thread: Skills Timer

  1. #1
    Moderator Dehan's Avatar
    Join Date
    Dec 2013
    Posts
    1,404
    Reputation
    315
    Rep Power
    26

    Skills Timer

    Skills Timer


    Description

    Will show you the time left to advance on skills (Weapon Skill, Shielding and Magic Level).

    Configuration

    You Need to Add the Persistent Code on the tab Scripter -> Persistent and the HUD Code on the tab HUDs.
    You need to wait your character gain 1% full on the skill to calculate the time left.

    Codes

    Persistent Code:
    init start
    -- Version 2.0.1
    function GetWeaponPC()
    SkillType = findweapontype()
    local SkillNames = {'axe','sword','club','no weapon','distance weapon'}
    if table.find(SkillNames,SkillType) then
    if SkillType == 'axe' then
    return $axepc
    elseif SkillType == 'sword' then
    return $swordpc
    elseif SkillType == 'club' then
    return $clubpc
    elseif SkillType == 'no weapon' then
    return $fistpc
    elseif SkillType == 'distance weapon' then
    return $distancepc
    end
    else
    return $mlevelpc
    end
    end
    local Config = {
    {name = 'Weapon', _starttime = $timems, _skill = GetWeaponPC(), _traceskill = 0, _timers = {0}, _try = 0, _finalTime = {}},
    {name = 'Magic', _starttime = $timems, _skill = $mlevelpc, _traceskill = 0, _timers = {0}, _try = 0, _finalTime = {}},
    {name = 'Shielding', _starttime = $timems, _skill = $shieldingpc, _traceskill = 0, _timers = {0}, _try = 0, _finalTime = {}},
    {name = 'Fishing', _starttime = $timems, _skill = $fishingpc, _traceskill = 0, _timers = {0}, _try = 0, _finalTime = {}}
    }
    init end

    auto(100)
    local Skills = {
    {name = 'Weapon', _skill = GetWeaponPC(), _left = _left or 0, _avgTime = _avgTime or 0, _advanceTime = _advanceTime or 0},
    {name = 'Magic', _skill = $mlevelpc, _left = _left or 0, _avgTime = _avgTime or 0, _advanceTime = _advanceTime or 0},
    {name = 'Shielding', _skill = $shieldingpc, _left = _left or 0, _avgTime = _avgTime or 0, _advanceTime = _advanceTime or 0},
    {name = 'Fishing', _skill = $fishingpc, _left = _left or 0, _avgTime = _avgTime or 0, _advanceTime = _advanceTime or 0}
    }
    for ic = 1,#Config do
    for is = 1,#Skills do
    if Skills[is].name == Config[ic].name then
    if Config[ic]._skill ~= Skills[is]._skill then
    Config[ic]._traceskill = $timems - Config[ic]._starttime
    if Config[ic]._try > 0 then
    table.insert(Config[ic]._timers,Config[ic]._traceskill)
    end
    Config[ic]._starttime = $timems
    Config[ic]._skill = Skills[is]._skill
    for it = 1,#Config[ic]._timers do
    if it > 3 then
    table.remove(Config[ic]._timers,1)
    end
    end
    Config[ic]._try = Config[ic]._try + 1
    end

    Skills[is]._left = 100 - Skills[is]._skill
    Skills[is]._avgTime = table.average(Config[ic]._timers)
    Skills[is]._advanceTime = Skills[is]._left * Skills[is]._avgTime
    Skills[is]._timeLeft = math.floor(Skills[is]._advanceTime / 1000)

    end
    end
    end

    function SkillTimer(skill)
    curTime = math.floor($charactertime / 1000)
    if Skills[1]._timeLeft ~= _Tracker.lastSkillPrediction then
    _Tracker.lastSkillPrediction = Skills[1]._timeLeft
    _Tracker.timeSkillPredictionChanged = curTime
    end
    if Skills[2]._timeLeft ~= _Tracker.lastMagicPrediction then
    _Tracker.lastMagicPrediction = Skills[2]._timeLeft
    _Tracker.timeMagicPredictionChanged = curTime
    end
    if Skills[3]._timeLeft ~= _Tracker.lastShieldingPrediction then
    _Tracker.lastShieldingPrediction = Skills[3]._timeLeft
    _Tracker.timeShieldingPredictionChanged = curTime
    end
    if Skills[4]._timeLeft ~= _Tracker.lastFishingPrediction then
    _Tracker.lastFishingPrediction = Skills[4]._timeLeft
    _Tracker.timeFishingPredictionChanged = curTime
    end
    if skill == 'Weapon' then
    return math.max(math.round(Skills[1]._timeLeft - curTime + _Tracker.timeSkillPredictionChanged), 1)
    elseif skill == 'Magic' then
    return math.max(math.round(Skills[2]._timeLeft - curTime + _Tracker.timeMagicPredictionChanged), 1)
    elseif skill == 'Shielding' then
    return math.max(math.round(Skills[3]._timeLeft - curTime + _Tracker.timeShieldingPredictionChanged), 1)
    elseif skill == 'Fishing' then
    return math.max(math.round(Skills[4]._timeLeft - curTime + _Tracker.timeFishingPredictionChanged), 1)
    end
    end

    if time(SkillTimer('Weapon')) ~= '1' then
    showWeapon = time(SkillTimer('Weapon'))
    else
    showWeapon = 'Calculating'
    end

    if time(SkillTimer('Magic')) ~= '1' then
    showMagic = time(SkillTimer('Magic'))
    else
    showMagic = 'Calculating'
    end
    if time(SkillTimer('Shielding')) ~= '1' then
    showShielding = time(SkillTimer('Shielding'))
    else
    showShielding = 'Calculating'
    end
    if time(SkillTimer('Fishing')) ~= '1' then
    showFishing = time(SkillTimer('Fishing'))
    else
    showFishing = 'Calculating'
    end


    HUD Code
    init start
    -- DO NOT EDIT BELOW THIS LINE
    local HUD = {
    Restart = -1,
    Position = {$clientwin.left, $worldwin.bottom},
    Auxiliar = {0, 0},
    ColumnWidth = {125, 12},
    Moving = false,
    Blue = {0.0, color(90, 12, 15, 20), 0.23, color(98, 13, 17, 20), 0.76, color(52, 6, 9, 20)},
    Black = {0.0, color(75, 75, 75, 20), 0.23, color(45, 45, 45, 20), 0.76, color(19, 19, 19, 20)},
    Orange = {0.0, color(120, 120, 120, 20), 0.23, color(100, 100, 100, 20), 0.76, color(35, 35, 35, 20)},
    Green = {0.0, color(65, 96, 12, 20), 0.23, color(67, 99, 13, 20), 0.76, color(36, 52, 6, 20)},
    Red = {0.0, color(90, 12, 15, 20), 0.23, color(98, 13, 17, 20), 0.76, color(52, 6, 9, 20)},
    }
    showWeapon = showWeapon or 0
    showShielding = showShielding or 0
    showMagic = showMagic or 0
    showFishing = showFishing or 0
    local tempPos = $chardb:getvalue('SkillTimer.TH', 'POSITION')

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

    Time = Time or tosec(os.date("%X"))

    filterinput(false, true, false, false) setfontstyle('Tahoma', 8, 75) setfillstyle('gradient', 'linear', 2, 0, 0, 0, 14) setfontstyle('Tahoma', 8, 75, 0xFFFFFF, 1, color(0, 0, 0, 20))

    function inputevents(e)
    if e.type == IEVENT_RMOUSEDOWN or e.type == IEVENT_MMOUSEDOWN then
    HUD.Moving, HUD.Auxiliar = true, {$cursor.x - HUD.Position[1], $cursor.y - HUD.Position[2]}
    elseif e.type == IEVENT_RMOUSEUP or e.type == IEVENT_MMOUSEUP then
    HUD.Moving = false
    elseif e.type == IEVENT_LMOUSEUP then
    if e.elementid == HUD.Restart then
    SkillTable = {}
    CalculateTry = 0
    ShieldingTable = {}
    ShieldingCalculateTry = 0
    MagicTable = {}
    MagicCalculateTry = 0
    end
    end
    end

    local function displaytext(text, x, y, c)
    addgradcolors(unpack(c))
    local w, h = measurestring(text)
    HUD.ColumnWidth[1], HUD.ColumnWidth[2] = math.max(HUD.ColumnWidth[1], w or 0), math.max(HUD.ColumnWidth[2], h or 0)
    local t = drawroundrect(x, y, HUD.ColumnWidth[1] + 7, HUD.ColumnWidth[2], 2, 2)
    drawtext(text, x + 2, y + math.floor(HUD.ColumnWidth[2] / 4) - 2.55)
    return t
    end

    init end

    if HUD.Moving then
    auto(10)
    HUD.Position = {$cursor.x - HUD.Auxiliar[1], $cursor.y - HUD.Auxiliar[2]}
    $chardb:setvalue('SkillTimer.TH', 'POSITION', table.concat(HUD.Position, ':'))
    end

    local x, y = 0, 0
    displaytext(" Skill Timer", x, y, HUD.Blue)
    addgradcolors(unpack(HUD.Green))
    w, h = measurestring("RESET")
    HUD.Restart = drawroundrect(x - w + HUD.ColumnWidth[1], y, w + 7, h, 2, 2)
    drawtext("RESET", 5 + x - w + HUD.ColumnWidth[1], y + math.floor(h / 4) - 2.4)
    y = y + 16
    displaytext(' Weapon Timer: '..showWeapon, x, y, HUD.Black)
    y = y + 16
    displaytext(' Shielding Timer: '..showShielding, x,y, HUD.Black)
    y = y + 16
    displaytext(' Magic Level Timer: '..showMagic, x,y, HUD.Black)
    y = y + 16
    displaytext(' Fishing Timer: '..showFishing, x,y, HUD.Black)
    setposition(unpack(HUD.Position))


    Thanks

    I would like to thanks @Leonardo, @Lucas Terra and @Raphael for the assistance and for being awesome guys haha

    Notes
    Code:
    Version 2.0.1:
    - fix on table.average()
    
    Version 2.0.0:
    - code completely remade
    - hud adapted
    - added fishing
    
    Version 1.0.0:
    - initial release
    Last edited by Dehan; 01-11-2015 at 11:17 PM. Reason: update 2.0.1

    Level Latest Scripts by Dehan
    250+
    [EK & ED & MS & RP] [Navigation] Prison -1
    200+
    [EK & ED & MS] [Navigation] Asura Palace
    200+
    [EK & ED] [Navigation] Lower Roshamuul Softcore

  2. #2
    Moderator SuNe's Avatar
    Join Date
    Dec 2013
    Location
    Sweden
    Posts
    2,881
    Reputation
    186
    Rep Power
    27
    Awesome mate!
    กิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิ ิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิ ิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิ ิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิ ิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิ ิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิ ิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิ ิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิก ิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิ ิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิ ิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิ ิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิ ิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิ ิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิ ิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิ ิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิ ิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิ ิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิ ิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิ ิิิิิิิิิิิิิิิิกิิิิิิิิิิิิิิิิิิิิกิิิิิิิิิิิิ ิิิิิิิิ

  3. #3
    Moderator mistgun's Avatar
    Join Date
    Dec 2013
    Location
    Lodz, Poland
    Posts
    1,821
    Reputation
    220
    Rep Power
    26
    great job Dehan :-)

  4. #4
    Free User Justx's Avatar
    Join Date
    Jun 2014
    Posts
    192
    Reputation
    19
    Rep Power
    20
    Awesome, mate!
    Rep+, I was waiting for this

  5. #5
    Free User
    Join Date
    May 2014
    Posts
    61
    Reputation
    10
    Rep Power
    20
    Nice Job dude!

    Just a question, How can I move it? It is above the chats for me.. Thanks!

  6. #6
    Free User
    Join Date
    Jun 2014
    Posts
    13
    Reputation
    10
    Rep Power
    0
    Same for me, would need to move it up a bit, otherwise seems awesome dude!

    Quote Originally Posted by Guhb View Post
    Nice Job dude!

    Just a question, How can I move it? It is above the chats for me.. Thanks!

  7. #7
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    Quote Originally Posted by Guhb View Post
    Nice Job dude!

    Just a question, How can I move it? It is above the chats for me.. Thanks!
    Quote Originally Posted by shaggydoo View Post
    Same for me, would need to move it up a bit, otherwise seems awesome dude!
    Right/Middle mouse click did you ever tried ?

  8. #8
    Free User
    Join Date
    May 2014
    Posts
    61
    Reputation
    10
    Rep Power
    20
    Quote Originally Posted by Leonardo View Post
    Right/Middle mouse click did you ever tried ?
    Haven't.

    Works!
    Thanks!

  9. #9
    Free User Borges's Avatar
    Join Date
    Feb 2014
    Location
    Brazil
    Posts
    1,469
    Reputation
    205
    Rep Power
    25
    @Dehan this is amazing... can you add fishing?
    I'll be glad to see this.

    thanks
    Helped you? REP+

  10. #10
    Free User Justx's Avatar
    Join Date
    Jun 2014
    Posts
    192
    Reputation
    19
    Rep Power
    20
    @Dehan, fishing would be nice, as mentioned before.
    Thanks.

 

 

Posting Permissions

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