Results 1 to 3 of 3

Thread: If depot has more than X items, do Y (get value from "Your depot contains ? items.")

  1. #1
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5

    If depot has more than X items, do Y (get value from "Your depot contains ? items.")

    From the Server Log:

    Your depot contains 1313 items.
    It goes like this: if depot has more than 950 items, gotolabel("abc").
    Last edited by john86; 01-03-2014 at 07:34 PM.

  2. #2
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Kinda tricky.

    This should work, but only if you have more than 100 items, because it will get confused with the time (Eg It could take 12:30 and think you have 30 items). Because of this, I've made it parse for numbers higher than 3 digits.

    I didn't test it with more than 999, but it should work.

    PHP Code:
    local alarmValue 100


    local serverLog 
    getnewmessages("Server Log")
    local serverLogLine serverLog.count 1
    for 0serverLogLine do
        if 
    serverLog[serverLogLine i].text:find("Your depot contains"then
            
    for j in string.gmatch(serverLog[serverLogLine i].text"%d%d%d+") do
            if 
    tonumber(j) >= alarmValue then 
                gotolabel
    ("abc")
                
    end
            end
        end
    end 
    This should be an action, not an action wpt.
    Last edited by pink_panther; 01-04-2014 at 08:46 AM.

  3. #3
    iBot User
    Join Date
    Sep 2012
    Posts
    239
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    46 Post(s)
    Reputation
    23
    Rep Power
    5
    Thanks, it worked fine.

Posting Permissions

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