I made a plugin that plays funny sounds whenever you get an error

Hello,
I found a funny meme sound effect which sounds like FAHH, I thought it’s the same sound my soul makes when I get an error.Soo! that’s it! I made a plugin! it plays the Fahh sound whenever you get an error!

How it works?
It depends on the godot.log file, but it’s not possible to read it, because Godot blocks it at runtime for some reason. Soo I have to run a batch file every second that will read the godot.log file and dump it into a godot_log_fahh.log file which is readable. And yeah! running a batch file was not a thing(Malwares are easy :> )

Let me know what you think : D
Thanks

9 Likes

This is true art.

2 Likes

Post this to r/Godot and you’ll get 1k upvotes.

2 Likes

Thanks : )

I don’t have enough karma lol xD

1 Like

Here we go:

I cooked my ear while using debugging it …FAHHHH
Just to let you guys know that you have to convert this batch file to a Linux batch(do they even exist? lol)

@echo off
setlocal

if "%~1"=="" (
    echo Usage:
    echo   read_godot_log.bat "C:\Path\To\Godot\logs"
    exit /b 1
)

set "LOG_DIR=%~1"

set "INPUT_FILE=%LOG_DIR%\godot.log"
set "OUTPUT_FILE=%LOG_DIR%\godot_fahh.txt"

if not exist "%INPUT_FILE%" (
    echo File not found:
    echo   %INPUT_FILE%
    exit /b 1
)

copy /y "%INPUT_FILE%" "%OUTPUT_FILE%" >nul

if exist "%OUTPUT_FILE%" (
    echo Log copied successfully:
    echo   %OUTPUT_FILE%
) else (
    echo Failed to copy log.
)

endlocal
1 Like

wait, its not?

I do read the log file from within Godot in my plugin:

func read_recent_logs_from_file(config: SRConfigHandler.Config) -> Array[String]:
	# ...

	var log_file_path: String = ProjectSettings.get("debug/file_logging/log_path")
	var log_file: FileAccess = FileAccess.open(log_file_path, FileAccess.READ)
	var log_lines: Array[String] = []

	while log_file.get_position() < log_file.get_length():
		var next_line: String = log_file.get_line()
		if next_line.strip_edges().is_empty():
			continue
		if log_lines.size() == config.max_log_lines:
			log_lines.pop_front()
		log_lines.append(next_line)
	
	return log_lines

(from SpatialRemarks / sr_creation.gd)

I don’t read it constantly though, and also did not test it in exported builds.

1 Like

Ohhh, is it possible? It didn’t worked when I tried xD