Journal

From OpenEUO
Jump to: navigation, search

Calling Pattern

Call

local j = sl.journal()

Results

j is a journal closure

Closure Methods


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

Use journal to generate a journal tracking/searching object. Journal takes no arguments and returns a closure with numerous methods simplifying journal access. All methods work on a passive internal copy of the UO journal, with the exception of refresh, nextline, and clear. Those all cause the internal copy of the journal to be updated with any new data from the associated client journal. For more information, see the associated member methods.

Journal is inspired by and partially modeled upon Kal In Ex's journal library.

See Also