From c347a4fd6e94010e055d311a65bab0755ae41a24 Mon Sep 17 00:00:00 2001 From: zomo Date: Mon, 21 Jun 2021 23:35:14 -0500 Subject: [PATCH] update --- autoexec.lua | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/autoexec.lua b/autoexec.lua index 9839cbd..3cfa7f5 100644 --- a/autoexec.lua +++ b/autoexec.lua @@ -46,18 +46,60 @@ function coords_partial_to_screenwriter(pos_px, scale_px, anchor) end -local disable_bg = menu.add_feature("disable background", "toggle") +local bgcolor = '000000' +local bgopacity = '000000' + +local menu_options = menu.add_feature('session info', 'parent') + +local options_textshadow = menu.add_feature('text shadow', 'toggle', menu_options.id) +local options_disablebg = menu.add_feature('disable background', 'toggle', menu_options.id) +local options_bgcolor = menu.add_feature('background color', 'action', menu_options.id, function(f) + local resp, str = input.get('background color', bgcolor, 6, 2) + while (resp ~= 0) do system.wait(0) end + + local r = Regex('^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$') + local m = r:search(str) + + if m.count > 0 then + str = m.matches[1] + + if (str:len() == 3) then + str = str:sub(1,1)..str:sub(1,1)..str:sub(2,2)..str:sub(2,2)..str:sub(3,3)..str:sub(3,3) + end + + bgcolor = str + + ui.notify_above_map(str, 'set background color to #' .. str, 140) + + end + +end) +local options_opacity = menu.add_feature('background opacity', 'action_value_i', menu_options.id) +options_opacity.min_i = 0 +options_opacity.max_i = 100 +options_opacity.value_i = 100 + menu.create_thread(function() while true do local base = v2(320, 20) - if (not(disable_bg.on)) then + if (not(options_disablebg.on)) then local pos, scale = coords_partial_to_screenwriter(base, v2(200, 200), 4) - scriptdraw.draw_rect(pos, scale, 0xFF000000) + local opacity = string.format('%x', math.floor(options_opacity.value_i * 2.55)) + while opacity:len() < 2 do + opacity = '0'..opacity + end + print('0x'..opacity..bgcolor) + scriptdraw.draw_rect(pos, scale, tonumber('0x'..opacity..bgcolor)) end - --scriptdraw.draw_text(scale, v2(0, 0), v2(1, 1), 1, 0XFFFFFFFF, 0) + local textFlags = 0 + if options_textshadow.on then + textFlags = 2 + end + + --scriptdraw.draw_text(scale, v2(0, 0), v2(1, 1), 1, 0XFFFFFFFF, textFlags) system.wait(0) end end, nil) \ No newline at end of file