Signup Now
Results 1 to 3 of 3
  1. #1
    Free User
    Join Date
    Oct 2014
    Posts
    8
    Reputation
    10
    Rep Power
    0

    Get numbervalue from a server log message

    Hello! I'm working on something where I need to get a value from server log.

    I have managed to run a certain action if the message I have selected appears, using newmessage. My question is this, is there any way to save damage I do to a certain monster as an persistent int perhaps?

    03:29 A scorpion loses 43 hitpoints due to your attack.

    For example here I want to save the value 43 which I will use for counting purposes later on

    This is what I got so far:

    PHP Code:
    init start
    local check 
    = {
    example = {'A scorpion loses'}, 
    }

    table.lower(check)
    init end

    auto
    (200)

    foreach 
    newmessage m do
    for 
    _v in pairs(check) do
    for 
    kvv in ipairs(v) do
    if 
    m.content:lower():find(vv:lower()) then
    --ACTION HERE
    end
    end
    end
    end 
    Any help is appreciated!!
    Thanks
    Last edited by eliasu; 01-16-2015 at 03:21 AM.

  2. #2
    Free User Balbek's Avatar
    Join Date
    Dec 2013
    Posts
    167
    Reputation
    31
    Rep Power
    21
    @eliasu

    string.match(m.content, '%d+')


    This will get the int value from the string message.

  3. #3
    Free User
    Join Date
    Oct 2014
    Posts
    8
    Reputation
    10
    Rep Power
    0
    Wow, quick and clean reply

    Thanks alot, +rep!

 

 

Posting Permissions

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