if event.channel=="clock" then local yard_id = event.msg local info = S.yards[yard_id] digiline_send("rwt_clock","Rwt Now:\n"..rwt.to_string(rwt.now())) if not S.yards[yard_id] then digiline_send(yard_id.."_1",yard_id.." -- Not In Service") digiline_send(yard_id.."_2"," ") digiline_send(yard_id.."_NOTIFY"," ") return end local function getN(t) local count = 0 for _ in pairs(t) do count = count+1 end return count end local txt = {} local txt2 = {} txt[#txt+1] = yard_id.." --"..info.yard_name.." Yard--" txt[#txt+1] = "Active: " .. tostring(F.indicator(info.active_indicator_pos)) txt[#txt+1] = "Direction: " .. tostring(F.indicator(info.dir_indicator_pos)) txt[#txt+1] = "Last Train: " .. tostring(info.last_id).." ("..tostring(info.arrival_length).."-"..tostring(info.departure_length)..")" txt2[#txt2+1] = "Time: "..tostring(rwt.to_string(info.arrival_time)).."+"..tostring(rwt.to_string(rwt.diff(info.arrival_time,info.departure_time))) digiline_send(yard_id.."_1",table.concat(txt,"\n")) txt2[#txt2+1] = "RTS: "..tostring(info.rts) txt2[#txt2+1] = "Error: ".. tostring(F.indicator(info.error_indicator_pos)) txt2[#txt2+1] = "" digiline_send(yard_id.."_2",table.concat(txt2,"\n")) local notifications = "" if info.notify then local nt = "" if getN(info.notify) > 0 then nt = "Notify: " for k in pairs(info.notify) do nt = nt..k..", " end else nt = "Notify: No Notifications" end local st_len = 26 if nt:len() > st_len then nt = nt:sub(1,st_len).."\n"..nt:sub(st_len+1) end notifications = nt else notifications = "Notify: Not Enabled" end digiline_send(yard_id.."_NOTIFY",notifications) return end