Results 1 to 6 of 6

Thread: Ghastly Dragon attack alert

  1. #1
    Normal User
    Join Date
    Feb 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    236
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    5

    Ghastly Dragon attack alert

    I need an action like this, if my char get hitted by ghastly dragon play alert.

  2. #2
    Normal User blakw's Avatar
    Join Date
    Mar 2012
    Location
    www.blakw.com
    Posts
    815
    Mentioned
    221 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    345 Post(s)
    Reputation
    462
    Rep Power
    10
    Try:

    PHP Code:
     
    local msgs = getnewmessages("Server Log")
     
    if (msgs.count > 0)
    then
    local qtd = msgs.count-1
     
    for i = 1, 3 
    do
        if msgs[qtd].text:find(".+ due to an attack by a ghastly dragon.")
        then
            flashclient()
            wait(1000, 1500)
            playsound("alert.wav")
        end
    end


    ------------------------------------Latest Releases:------------------------------------
    Vocations:
    Darashia Lions Rock
    Oramond Seacrest Serpents X1

    For a better iBot!

    (◣_◢)

  3. #3
    Normal User
    Join Date
    Feb 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    236
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    5
    Quote Originally Posted by blakw View Post
    Try:

    PHP Code:
     
    local msgs = getnewmessages("Server Log")
     
    if (msgs.count > 0)
    then
    local qtd = msgs.count-1
     
    for i = 1, 3 
    do
        if msgs[qtd].text:find(".+ due to an attack by a ghastly dragon.")
        then
            flashclient()
            wait(1000, 1500)
            playsound("alert.wav")
        end
    end
    does it alert if someone else get attacked but me?

  4. #4
    Normal User Balbek's Avatar
    Join Date
    May 2012
    Location
    LDZ
    Posts
    554
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    4 Post(s)
    Reputation
    84
    Rep Power
    6
    ye it will also play the alert if someone else on your screen gets attacked by ghastly dragon

  5. #5
    Normal User Boget's Avatar
    Join Date
    Nov 2012
    Posts
    152
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    22
    Rep Power
    5
    Quote Originally Posted by blakw View Post
    Try:

    PHP Code:
     
    local msgs = getnewmessages("Server Log")
     
    if (msgs.count > 0)
    then
    local qtd = msgs.count-1
     
    for i = 1, 3 
    do
        if msgs[qtd].text:find(".+ due to an attack by a ghastly dragon.")
        then
            flashclient()
            wait(1000, 1500)
            playsound("alert.wav")
        end
    end
    I haven’t tested it, but this code looks buggy…

    for i = 1, 3 looks wrong there. Shouldn’t you be using the `qtd` value to get the upper limit? Else you will only check three messages, even if there are more.

    Also, with the code you posted, if msgs[qtd].text:find(".+ due to an attack by a ghastly dragon.") will search the exact same message string (msgs[qtd].text) three times, as the value of qtd is never changed.

    Am I misunderstanding something?

  6. #6
    Normal User
    Join Date
    Feb 2013
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Code:
    local msgs = getnewmessages("Server Log")
     
    if (msgs.count > 0)
    then
        local qtd = msgs.count-1
     
        for i = 0, qtd 
        do
        if msgs[qtd - i].text:find("You .+ hitpoints due to an attack by a ghastly dragon.")
            then
                flashclient()
                wait(1000, 1500)
                playsound("alert.wav")
            end
        end
    end
    Just edited blakw's code and the above should work.

Posting Permissions

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