From 052b141a1055cd507106372c879c54013dc3e374 Mon Sep 17 00:00:00 2001 From: Dibasic Date: Tue, 7 Aug 2018 20:23:15 -0500 Subject: [PATCH] Small display support and fix directional look bug --- majamoo.trigger | 225 +++++++++++++++++++++++++++--------------------- 1 file changed, 127 insertions(+), 98 deletions(-) diff --git a/majamoo.trigger b/majamoo.trigger index 56657d0..3631038 100644 --- a/majamoo.trigger +++ b/majamoo.trigger @@ -355,21 +355,14 @@ end - Detect room entry - + Capture chat + 0 - 4 - 4 + 0 + 0 #ff0000 @@ -378,19 +371,33 @@ newroom() #000000 #000000 - ^(.{10})\s{2}(.+) \((.+)\) (\d{1,2}:\d{1,2}[ap]m)$ + ^\[.{1,6}net\] + ^\[ [A-Z]{1,6} \]: 1 + 1 + + + Minimap + + 0 + 0 + 0 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + - Detect map - + Override for directional look + 0 0 0 @@ -402,18 +409,28 @@ appendBuffer("room") #000000 #000000 - ^(.{10}) + ^(?:To the \w+|Through it), you see: 1 - - Detect end of map - + + Detect room entry + 0 - 0 - 0 + 4 + 4 #ff0000 @@ -422,38 +439,58 @@ appendBuffer("room") #000000 #000000 - ^\s{10} + ^(.{10})\s{2}(.+) \((.+)\) (\d{1,2}:\d{1,2}[ap]m)$ 1 - - - - Capture chat - - 0 - 0 - 0 - - - #ff0000 - #ffff00 - - #000000 - #000000 - - ^\[.{1,6}net\] - ^\[ [A-Z]{1,6} \]: - - - 1 - 1 - - +appendBuffer("room") + + 0 + 0 + 0 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + ^(.{10}) + + + 1 + + + + Detect end of map + + 0 + 0 + 0 + + + #ff0000 + #ffff00 + + #000000 + #000000 + + ^\s{10} + + + 1 + + + + MCP @@ -1024,7 +1061,7 @@ function handleWindowResize() setMiniConsoleFontSize("chat", chat_font_size) position_status_window() - setMiniConsoleFontSize("status", determine_font_size(sidebar_width - minimap_width, status_height, 75, 8, 4)) + setMiniConsoleFontSize("status", determine_font_size(sidebar_width - minimap_width, status_height, 45, 8, 4)) end function position_room_window() @@ -1034,7 +1071,7 @@ end function position_status_window() createMiniConsole("status", 0, 0, (sidebar_width - minimap_width - scroll_width), status_height) - moveWindow("status", sidebar_width, 0) + moveWindow("status", window_width - sidebar_width, 0) end function position_chat_window() @@ -1054,14 +1091,6 @@ function determine_font_size(width, height, charwidth, charheight, min_size) if (width >= x * charwidth) and (height > y * charheight) then return i end end return -1 -end - -function determine_vert_size(pixels, min_size) - local max_size = 96 - for i = max_size,min_size,-2 do - if (pixels >= calcFontSize(i) * 2) then return i end - end - return -1 end @@ -1187,7 +1216,7 @@ end function update_status() local ammo_display = "" - if (get_ammo_display) then ammo_display = "<reset>\n\n" .. get_ammo_display() end + if (get_ammo_display) then ammo_display = "<reset>\n" .. get_ammo_display() end clearWindow("status") cecho("status", "\n<yellow>" .. room .. "<reset> (<dark_goldenrod>" .. area .. "<reset>) <white>" .. time .. ammo_display @@ -1198,25 +1227,25 @@ function update_status() end function get_health_display() - local hp = tonumber(mcp["hp"]) - local maxhp = tonumber(mcp["maxhp"]) + local bars = math.floor(tonumber(mcp["hp"])/2) + local spaces = 30 - bars local result = "<white>[<green:green>" - for i = 1,hp do + for i = 1,bars do result = result .. "|" end result = result .. "<reset>" - for i = hp,(maxhp-1) do + for i = 1,spaces do result = result .. " " end - result = result .. "<white>] [ " .. hp .. "/" .. maxhp .. " ]<reset>" + result = result .. "<white>] [ " .. string.format("%2d", tonumber(mcp["hp"])) .. "/" .. mcp["maxhp"] .. " ]<reset>" return result end function get_thirst_display() local thirst = tonumber(mcp["thirst"]) local result = "<white>[<blue:blue>" - local bars = math.floor(thirst * 60 / 500) - local spaces = 60 - bars + local bars = math.floor(thirst * 30 / 500) + local spaces = 30 - bars for i = 1,bars do result = result .. "|" end @@ -1231,8 +1260,8 @@ end function get_hunger_display() local hunger = tonumber(mcp["hunger"]) local result = "<white>[<red:red>" - local bars = math.floor(hunger * 60 / 500) - local spaces = 60 - bars + local bars = math.floor(hunger * 30 / 500) + local spaces = 30 - bars for i = 1,bars do result = result .. "|" end @@ -1247,8 +1276,8 @@ end function get_stress_display() local stress = tonumber(mcp["stress"]) local result = "<white>[<yellow:yellow>" - local bars = math.floor(stress * 60 / 500) - local spaces = 60 - bars + local bars = math.floor(stress * 30 / 500) + local spaces = 30 - bars for i = 1,bars do result = result .. "|" end @@ -1346,14 +1375,14 @@ end function get_ammo_display() local output = "\n<DarkSlateGray>[<yellow>" - if (tonumber(magsize) < 61) then + if (tonumber(magsize) < 31) then for i = 1,ammo_remaining do output = output .. "|" end for i = ammo_remaining+1,magsize do output = output .. " " end - elseif (tonumber(magsize) < 121) then -- DOUBLE STACK DISPLAY + elseif (tonumber(magsize) < 61) then -- DOUBLE STACK DISPLAY for i = 1,math.floor(ammo_remaining / 2) do output = output .. ":" end @@ -1411,21 +1440,9 @@ end - ammo - 4 - hand-loaded 5.56mm clip - 4 - - - ammo_count - 4 - 387 - 3 - - - ammo_remaining + weapon 4 - 40 + FN SCAR-L rifle 4 @@ -1441,9 +1458,21 @@ end - weapon + ammo_remaining 4 - FN SCAR-L rifle + 40 + 4 + + + ammo_count + 4 + 387 + 3 + + + ammo + 4 + hand-loaded 5.56mm clip 4 @@ -1460,7 +1489,7 @@ end thirst 4 - 27 + 74 4 @@ -1484,14 +1513,14 @@ end hunger 4 - 103 + 34 4 time 4 - 5:34am + 11:25am 4