delta
Contributors
Posts: 29
|
Post by delta on Mar 26, 2021 0:01:24 GMT
Is it possible to draw script timer and run count on screen?
I know it could toast it but wondering if there's other options.
|
|
|
Post by AnkuLua on Mar 26, 2021 2:36:41 GMT
|
|
ikk
New Member
Discord: Oof#2074
Posts: 16
|
Post by ikk on Apr 21, 2021 5:13:46 GMT
This is how I create paints / debug text and info: --Only initialize t / timer ONCE during script! t = Timer()
--color scheme & font size (size 6 font for my 1440p phone resolution works well for me). Only use this line once at the top of your script. setHighlightTextStyle(0x96666666, 0xf8ffffff, 6) --Initialized as 0 to start, I update these manually throughout the script upon action completion. Only showing these because my function calls for it XP_GAINED = 0 XP_HOUR = 0 XP_PER_SECOND = 0
--These 3 lines are where your paint / debug info will be displayed on your screen REG_PAINT_LINE1 = Region(1934, 210, 342, 34) REG_PAINT_LINE2 = Region(1934, 243, 342, 34) REG_PAINT_LINE3 = Region(1934, 276, 342, 34)
function paint() local seconds = t:check() REG_PAINT_LINE1:highlightOff() REG_PAINT_LINE2:highlightOff() REG_PAINT_LINE3:highlightOff() XP_PER_SECOND = XP_GAINED / seconds local xpm = XP_PER_SECOND * 60 local xph = math.floor(xpm * 60) XP_HOUR = xph REG_PAINT_LINE1:highlight("Time Ran: " .. secondsToClock(seconds) .. "") REG_PAINT_LINE2:highlight("XP/h: " .. XP_HOUR) REG_PAINT_LINE3:highlight("TTL: " .. getTimeUntilLevel()) end
--function to convert seconds to easier-to-read string: function secondsToClock(seconds) local seconds = tonumber(seconds) if seconds <= 0 then return "00:00:00"; else hours = string.format("%02.f", math.floor(seconds/3600)); mins = string.format("%02.f", math.floor(seconds/60 - (hours*60))); secs = string.format("%02.f", math.floor(seconds - hours*3600 - mins *60)); return hours..":"..mins..":"..secs end end
I write my scripts for old school runescape which is why I'm displaying XP/H but you can replace these lines with other things for your usage. However, these numbers DO NOT update in real-time so you need to call the paint() function when you want to display the up-to-date info. I recommend not doing this too often because it takes a few milliseconds to re-display the paint / highlights. Which will slow your script down if called too often. If anyone else knows how to get the information to update dynamically I would greatly appreciate it. Image of how it looks: i.imgur.com/c7LToKU.png
|
|