Results 1 to 2 of 2

Thread: @AUTO_ALERTS, stop alert spam for private messages from 1-8 lvl chars (changeable)

  1. #1
    Focus Group szwedolecko's Avatar
    Join Date
    Apr 2012
    Location
    Poland
    Posts
    142
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    44
    Rep Power
    5

    @AUTO_ALERTS, stop alert spam for private messages from 1-8 lvl chars (changeable)

    Hi,
    as a topic says I release a simply Action Hotkey that stops your bot spam (sound alerts) from characters between 1 to 8 lvl (changeable).

    Now you shouldn`t hear anymore alerts for private message, messages for example with advertising sent by characters with lvl 1.



    Lua Code:
    local CONFIG = {
     
        MINIMUM_LEVEL = 8,              --  It'll play alarm with people that are highest than this level
    }
     
     
    --[[ DON'T EDIT BELOW THIS LINE --]]
     
     
    AUTO_ALERTS = AUTO_ALERTS or {
     
        TIME_BETWEEN_RESPONCES = 2,
     
        RESPONCE_TIMER = os.time(),
     
        INITIALIZED = false
     
    }
     
     
    if not AUTO_ALERTS.INITIALIZED then
        setsettings("Settings\\Alerts\\Message\\PrivateMes  sage\\PlaySound", "no")
        print('AUTO_ALERTS: Alets for private message changed in bot.')
        AUTO_ALERTS.INITIALIZED = true
    end
     
     
    local MESSAGES = getnewmessages("Local Chat")
     
     
    for INDEX = 0, MESSAGES.count - 1 do
     
        local m = {text = MESSAGES[INDEX].text, sender = MESSAGES[INDEX].sender or '', type = MESSAGES[INDEX].type, content = MESSAGES[INDEX].text:match('%b[]: (.+)') or '', time = MESSAGES[INDEX].text:sub(1, 5), level = tonumber((tostring(string.match(MESSAGES[INDEX].text, '.+ (%b[]): .+')):gsub("[^%d]", ''))) or 0}
     
        if m.sender:lower() ~= name:lower() and table.find({6}, m.type) and m.level >= CONFIG.MINIMUM_LEVEL and os.difftime(os.time(), AUTO_ALERTS.RESPONCE_TIMER) >= AUTO_ALERTS.TIME_BETWEEN_RESPONCES then
                playsound('private.wav')
        end
     
    end


    Version 1.0 Let me know if u have any problems...
    Last edited by szwedolecko; 12-25-2013 at 09:41 AM. Reason: Wrapped with LUA tags
    Tibian.eu - Najlepszy Polski Sklep do gry Tibia

  2. #2
    Normal User
    Join Date
    Jun 2012
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    5

    Works I had to remove some spaces though at "PrivateMessage" line 22: setsettings("Settings\\Alerts\\Message\\PrivateMes sage\\PlaySound", "no")

    Thx
    Last edited by Brallan; 12-24-2013 at 09:12 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
  •