I've been trying to write a procedure that will center text within a specified textwidth but I'm having trouble with some spacing, which may of been present in some of my examples provided earlier.
There seems to be an extra space or two and I think I'm just doing my math or script wrong, I'd like a helpers opinion on how to do this, or if a script already exists like this where it accommodates for max width input then I would like to be directed there instead of re-inventing the wheel.
https://paste.denizenscript.com/View/112205 - Relevant debug
https://paste.denizenscript.com/View/112206 - Relevant script
Content of Server Log Paste #112205: Denizen Debug Logs From &cDevelopment Server... pasted 2023/07/12 14:32:23 UTC-07:00, Paste length: 18576 characters across 187 lines, Content: Java Version: 17.0.7Up-time: 2m 11s
Content of Denizen Script Paste #112206: Unnamed Denizen Script Paste... pasted 2023/07/12 14:32:47 UTC-07:00, Paste length: 687 characters across 15 lines, Content: text_testing: type: procedure