diff --git a/Audio/voice/ch-fc1.wav b/Audio/voice/ch-fc1.wav new file mode 100644 index 0000000..25b8cc0 Binary files /dev/null and b/Audio/voice/ch-fc1.wav differ diff --git a/Audio/voice/ch-fc2.wav b/Audio/voice/ch-fc2.wav new file mode 100644 index 0000000..0208b3e Binary files /dev/null and b/Audio/voice/ch-fc2.wav differ diff --git a/Audio/voice/ch-fc3.wav b/Audio/voice/ch-fc3.wav new file mode 100644 index 0000000..87bbc82 Binary files /dev/null and b/Audio/voice/ch-fc3.wav differ diff --git a/Audio/voice/ch-fc4.wav b/Audio/voice/ch-fc4.wav new file mode 100644 index 0000000..19ade3f Binary files /dev/null and b/Audio/voice/ch-fc4.wav differ diff --git a/Audio/voice/ja-fc1.wav b/Audio/voice/ja-fc1.wav new file mode 100644 index 0000000..3659563 Binary files /dev/null and b/Audio/voice/ja-fc1.wav differ diff --git a/Audio/voice/ja-fc2.wav b/Audio/voice/ja-fc2.wav new file mode 100644 index 0000000..e0b3d74 Binary files /dev/null and b/Audio/voice/ja-fc2.wav differ diff --git a/Audio/voice/ja-fc3.wav b/Audio/voice/ja-fc3.wav new file mode 100644 index 0000000..37a6b20 Binary files /dev/null and b/Audio/voice/ja-fc3.wav differ diff --git a/test.lua b/test.lua new file mode 100644 index 0000000..a04c042 --- /dev/null +++ b/test.lua @@ -0,0 +1,69 @@ +local target = peripheral.find("create_target") + +if not target then + print("Error: Target block not found! Please check if Wired Modem is connected and activated (red ring).") + return +end + +pcall(target.resize, 80, 10) + +-- A helper function to parse the Create station summary line +-- Example input: "1 ?? [Local]1123 HC-02 2" +local function parseTrainLine(line) + -- Format we are parsing: + -- " " + -- Example: "1 ?? [Local]1123 HC-02 2" + -- Example: "现在 ?? [Local]1123 HC-02 2" (assuming "现在" might replace the number and unit) + + local timeValue, timeUnit, trainName, destination + + -- Try parsing format with a number first (e.g., "1 ?? ...") + timeValue, timeUnit, trainName, destination = string.match(line, "^(%d+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$") + + -- If that fails, it might be the "Now" (现在) format which might not have digits at the start + if not trainName then + timeValue, timeUnit, trainName, destination = string.match(line, "^([^%s]+)%s+(.-)%s+(%[.-%][^%s]*)%s+(.*)$") + end + + -- Fallback for extremely weird formatting + if not trainName then + timeValue, timeUnit, trainName, destination = string.match(line, "^([^%s]+)%s+(.-)%s+([^%s]+)%s+(.*)$") + end + + return { + eta_value = timeValue or "N/A", + eta_unit = timeUnit or "N/A", + trainName = trainName or "N/A", + destination = destination or "N/A", + raw = line + } +end + +while true do + term.clear() + term.setCursorPos(1,1) + print("=== Receiving Station Data ===") + + local lines = target.dump() + local hasData = false + + for i, lineText in pairs(lines) do + if lineText and lineText ~= "" and lineText:match("[%w%?%[]") then + print("--- Line " .. i .. " ---") + print("Raw: " .. lineText) + + local parsed = parseTrainLine(lineText) + print(" Train Name : " .. parsed.trainName) + print(" Destination: " .. parsed.destination) + print(" ETA Value : " .. parsed.eta_value) + print(" ETA Unit : " .. parsed.eta_unit) + hasData = true + end + end + + if not hasData then + print("No active trains incoming/departing...") + end + + os.sleep(1) +end \ No newline at end of file