mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.26k stars 1.76k forks source link

`console.log` not working in scripts #4037

Closed bendmorris closed 3 months ago

bendmorris commented 3 months ago

I recently updated from a pretty old version of Tiled to the latest, and console.log used to show up in the editor console, but no longer does. This is really convenient and often the most practical way to debug a script, and currently I'm using throwing an error as a substitute :sweat_smile: which obviously is not nearly as convenient. I checked some old versions and this seems to have not worked for a while, but does work way back in 1.4.0:

Screenshot from 2024-08-18 17-04-38

vs. latest:

Screenshot from 2024-08-18 17-04-52

(I didn't bisect this and don't know exactly when it stopped working.)

eishiya commented 3 months ago

This is a known issue with no satisfactory fix. You should use tiled.log instead. image

bjorn commented 3 months ago

Yeah, I think the problem was that I couldn't find a way to route console.log to the Console view without also routing all other console output there, and it was causing confusing or irrelevant warnings to be shown in some cases (see 04a64700a3d6ed850ad21a17f77cbcc6768e647c).

So, console.log works, but only for printing to the actual console (standard out), not to Tiled's Console view.