Journal.nextline

From OpenEUO
Jump to: navigation, search

Calling Pattern

Call

local j = sl.journal()

later

local r1,r2,r3 = j.nextline([split])

Argument

split (optional) is a boolean, defaults to false

Results

r1 is a string, the next unread line of the journal
r2 is a number, the color
iff split is true then
r3 is the name split from the beginning of the line, if any

Example

local j = sl.journal()
local e,line,col,name = "","",0,""
local start,color = 3,946
while true do
  local new,total,unread = j.refresh()   
  if unread > 0 then
    line = ""
    local tot,ur = j.count()
    print(tostring(tot)..' '..tostring(ur))
    while ur > 0 do
      line,col,name = j.nextline(true)
      print(tostring(name)..'|'..tostring(line)..'|'..tostring(col))
      tot,ur = j.count()
    end
    print(sl.exkeyvalstr(j.gmatchcolor(start, color, 'c(ur)')))
    start = tot + 1
  end
  wait(50)
end
-> 8 8
   |Login confirm on RunUO TC|55
   |Welcome to Ultima Online!|0
   |Welcome, ximansu! There is currently 1 user online, with 100021 items and 2419 mobiles in the world.|946
   |Queuing action request 2... 1.6 seconds left.|173
   |Chat is not currently supported.|946
   |Finished 3 queued actions in 1.4 seconds.|173
   |The world is saving, please wait.|53
   |World save complete. The entire process took 0.2 seconds.|53
   table keys:values = {
   1:table keys:values = {
    1:ur,
    },
   2:table keys:values = {
    1:ur,
    },
   linenums:table keys:values = {
    1:3,
    2:5,
    },
   count:2,
   }

Description

Nextline checks to see if there are more journal messages, and if so, copies them to the internal store. If any of the messages in the internal store haven't been previously been read by nextline (or skipped over via mark), then nextline returns the next unread message.

Nextline, along with clear and refresh, are the only methods which force an update to the internal store.

See Also