Aleph-One-Marathon / alephone

Aleph One is the open source continuation of Bungie’s Marathon 2 game engine.
https://alephone.lhowon.org/
GNU General Public License v3.0
654 stars 99 forks source link

Feature request: `print` in HUD scripts #450

Closed SolraBizna closed 1 year ago

SolraBizna commented 1 year ago

Since Aleph One doesn't (and shouldn't) have an integrated Lua debugger, we must often resort to the age-old technique known as "printf debugging". In regular scripts, this is easily achieved either through printing (to screen or to log) or through overlays. HUD scripts don't have access to any such machinery. One could add plumbing to the HUD script to display some stuff on screen, but sometimes that's not as useful as getting a big text file you can scroll and grep through.

While it is obviously a good idea to prevent HUD scripts from randomly writing to the filesystem, and (less obviously, but no less truly) a good idea to prevent HUD scripts from being able to send information to regular scripts, allowing print seems harmless enough. A malicious HUD script could create an explosively huge log file by spamming explosively huge print, but it can already do that by spamming explosively huge error calls… and since HUD scripts can only come from plugins, the risk of running a malicious HUD script is considerably less than that of running a malicious netscript.

treellama commented 1 year ago

I just added a print statement to the Basic HUD and it works fine?

SolraBizna commented 1 year ago

I just added print statements to the Enhanced HUD and every single one worked fine, too. Sorry for the spurious issue.