From 93def956f5c9e8ad4252a697157d316a29e22645 Mon Sep 17 00:00:00 2001 From: Peridexis Errant Date: Sun, 21 Dec 2014 21:03:44 +1100 Subject: [PATCH] finish position.lua It would be great to report the name of the Age, and the position of the fort within the world, but aside from those it's finished. --- Readme.rst | 4 ++-- scripts/position.lua | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Readme.rst b/Readme.rst index 52c966742..465037cea 100644 --- a/Readme.rst +++ b/Readme.rst @@ -2401,8 +2401,8 @@ Example:: position ======== -Reports the current date, time, month, and season. Location reporting is a -work in progress. +Reports the current time: date, clock time, month, and season. Also reports +location: z-level, cursor position, window size, and mouse location. putontable ========== diff --git a/scripts/position.lua b/scripts/position.lua index e4521cb69..8c3dbe72a 100644 --- a/scripts/position.lua +++ b/scripts/position.lua @@ -25,16 +25,19 @@ local day = julian_day % 28 local time_of_day = math.floor(df.global.cur_year_tick_advmode / 336) local second = time_of_day % 60 -local minute = (time_of_day / 60) % 60 +local minute = math.floor(time_of_day / 60) % 60 local hour = math.floor(time_of_day / 3600) % 24 print('Time:') print(' The time is '..string.format('%02d:%02d:%02d', hour, minute, second)) print(' The date is '..string.format('%05d-%02d-%02d', df.global.cur_year, month, day)) print(' It is the month of '..months[month]) +--TODO: print(' It is the Age of '..age_name) print('Place:') -print(' Local window is at x='..df.global.window_x - ..' y='..df.global.window_y..' z='..df.global.window_z) - ---TODO: add cursor, regional/embark square co-ords, window size? +print(' The z-level is z='..df.global.window_z) +print(' The cursor is at x='..df.global.cursor.x..', y='..df.global.cursor.y) +print(' The window is '..df.global.gps.dimx..' tiles wide and '..df.global.gps.dimy..' tiles high') +if df.global.gps.mouse_x == -1 then print(' The mouse is not in the DF window') else +print(' The mouse is at x='..df.global.gps.mouse_x..', y='..df.global.gps.mouse_y..' within the window') end +--TODO: print(' The fortress is at '..x, y..' on the world map ('..worldsize..' square)')