Signup Now
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Loot Logger

  1. #1
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,441
    Reputation
    309
    Rep Power
    28

    Loot Logger

    Loot Logger


    Description

    Saves all your loot messages to a file on your WindBot/files folder.


    Configuration

    Edit the hideEmpty variable to tell the script whether empty loot messages should not be logged. Also, optionally, change the filename variable to choose the name of the file the log will be saved on.


    Code

    init start
    -- local SCRIPT_VERSION = '1.1.0'

    local filename = 'Loot - ' .. $name .. '.txt'
    local hideEmpty = false

    -- DO NOT EDIT BELOW THIS LINE --
    init end

    auto(1000)

    local handler = nil
    foreach newmessage m do
    if m.type == MSG_INFO then
    local _, loot = m.content:match(REGEX_LOOT)

    if loot and (not hideEmpty or loot ~= 'nothing') then
    if handler == nil then
    handler = io.open(filename, 'a+')
    end

    handler:write(os.date('%H:%M') .. ' ' .. m.content .. '\n')
    end
    end
    end

    if handler ~= nil then
    handler:close()
    end

    Git


    Example

    Code:
    10:15 Loot of a ghoul: a ghoul snack, 5 gold coins, a pile of grave earth
    10:15 Loot of a crypt shambler: 21 gold coins
    10:15 Loot of a crypt shambler: 24 gold coins
    10:16 Loot of a crypt shambler: nothing
    10:16 Loot of a ghoul: nothing
    10:16 Loot of a ghoul: 4 gold coins
    10:17 Loot of a crypt shambler: 8 gold coins, 7 worms
    10:17 Loot of a ghoul: 24 gold coins
    10:17 Loot of a ghoul: nothing
    10:17 Loot of a ghoul: 16 gold coins, a life ring
    10:18 Loot of a ghoul: 8 gold coins, a worm
    10:18 Loot of a crypt shambler: nothing
    10:18 Loot of a crypt shambler: nothing
    10:18 Loot of a ghoul: 13 gold coins
    10:19 Loot of a ghoul: 2 worms
    10:19 Loot of a ghoul: a ghoul snack, 10 gold coins
    10:19 Loot of a ghoul: 29 gold coins
    10:19 Loot of a ghoul: 7 gold coins
    10:20 Loot of a crypt shambler: a bone
    10:20 Loot of a ghoul: nothing
    10:20 Loot of a ghoul: 27 gold coins
    10:20 Loot of a ghoul: 7 gold coins
    10:20 Loot of a crypt shambler: 2 gold coins
    10:21 Loot of a ghoul: nothing
    10:21 Loot of a crypt shambler: nothing
    10:21 Loot of a ghoul: 27 gold coins
    10:22 Loot of a ghoul: 8 gold coins, a torch
    10:22 Loot of a ghoul: a gold coin, a pile of grave earth
    10:22 Loot of a crypt shambler: nothing
    10:22 Loot of a ghoul: 27 gold coins
    10:22 Loot of a ghoul: 8 gold coins, a rotten piece of cloth
    10:23 Loot of a crypt shambler: nothing
    10:23 Loot of a crypt shambler: 27 gold coins
    10:23 Loot of a ghoul: nothing
    10:24 Loot of a ghoul: 23 gold coins, 2 worms
    10:24 Loot of a ghoul: nothing
    10:24 Loot of a crypt shambler: nothing
    10:24 Loot of a crypt shambler: 19 gold coins, a half-digested piece of meat
    10:25 Loot of a ghoul: 18 gold coins, a rotten piece of cloth
    10:25 Loot of a ghoul: nothing
    10:25 Loot of a crypt shambler: 32 gold coins
    10:25 Loot of a crypt shambler: nothing
    10:25 Loot of a ghoul: 10 gold coins
    10:26 Loot of a ghoul: 28 gold coins
    10:32 Loot of a ghoul: 24 gold coins, a torch
    10:32 Loot of a ghoul: nothing
    10:32 Loot of a crypt shambler: nothing
    10:33 Loot of a crypt shambler: 20 gold coins
    10:33 Loot of a crypt shambler: nothing
    10:33 Loot of a crypt shambler: 14 gold coins
    10:33 Loot of a crypt shambler: a bone sword
    10:34 Loot of a ghoul: nothing
    10:34 Loot of a ghoul: 4 gold coins, a skull
    10:34 Loot of a ghoul: nothing
    10:34 Loot of a ghoul: nothing
    10:35 Loot of a crypt shambler: 12 gold coins, rotten meat
    Last edited by Raphael; 07-15-2014 at 01:38 PM.

  2. #2
    Free User Emma's Avatar
    Join Date
    Dec 2013
    Posts
    37
    Reputation
    10
    Rep Power
    0
    Thats nice Raphael, keep making some scripts!

  3. #3
    Moderator mistgun's Avatar
    Join Date
    Dec 2013
    Location
    Lodz, Poland
    Posts
    1,821
    Reputation
    220
    Rep Power
    26
    wow, keep goin raph

  4. #4
    Moderator Leonardo's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    758
    Reputation
    77
    Rep Power
    22
    An alternate version to choose between showing or not empty loots. I'll post here if you don't mind.

    init start
    local filename = 'Loot - ' .. $name .. '.txt'
    local showNothing = false
    init end

    auto(1000)

    local handler = nil

    foreach newmessage m do
    if m.type == MSG_INFO and (showNothing or m.content:match("Loot of .+: (.+)") ~= 'nothing') then
    if handler == nil then
    handler = io.open(filename, 'a+')
    end

    handler:write(os.date('%H:%M') .. ' ' .. m.content .. '\n')
    end
    end

    if handler ~= nil then
    handler:close()
    end

  5. #5
    Free User jakub's Avatar
    Join Date
    Dec 2013
    Location
    Poland
    Posts
    132
    Reputation
    32
    Rep Power
    21
    Is it healthy for HDD to open and close file each 1000 ms?
    I know for a while it won't hurt, but if these scripts will run few months or more it might hurt I think

  6. #6
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,441
    Reputation
    309
    Rep Power
    28
    Quote Originally Posted by Leonardo;n279
    An alternate version to choose between showing or not empty loots. I'll post here if you don't mind.

    init start
    local filename = 'Loot - ' .. $name .. '.txt'
    local showNothing = false
    init end

    auto(1000)

    local handler = nil

    foreach newmessage m do
    if m.type == MSG_INFO and (showNothing or m.content:match("Loot of .+: (.+)") ~= 'nothing') then
    if handler == nil then
    handler = io.open(filename, 'a+')
    end

    handler:write(os.date('%H:%M') .. ' ' .. m.content .. '\n')
    end
    end

    if handler ~= nil then
    handler:close()
    end
    Thanks, I'll add the option on the main post. No need for regexes here though.

    Quote Originally Posted by jakub;n290
    Is it healthy for HDD to open and close file each 1000 ms?
    I know for a while it won't hurt, but if these scripts will run few months or more it might hurt I think
    There's nothing in opening or closing a file that damages the Hard Disk. That's what it was made for, there's not like a limited number of accesses.

  7. #7
    Free User smithaux's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    30
    Reputation
    6
    Rep Power
    0
    nice dude

  8. #8
    Free User
    Join Date
    Mar 2014
    Posts
    7
    Reputation
    10
    Rep Power
    0
    it is showing potions used too

  9. #9
    Wind Tester
    Join Date
    Dec 2013
    Location
    Warsaw, Poland
    Posts
    2,579
    Reputation
    149
    Rep Power
    27
    Nice, i always loved to put looting statistics on tibia.wikia.com on neo times, now i can do it again Thanks.

  10. #10
    Moderator Raphael's Avatar
    Join Date
    Dec 2013
    Location
    raphseller.com
    Posts
    2,441
    Reputation
    309
    Rep Power
    28
    Updated the script, it was broken somewhere between now and the time it was released.
    Fixed now.

 

 

Posting Permissions

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