Solarus-Games English Forum

Solarus => Development => Topic started by: lefthandedhero on May 12, 2024, 08:14:33 PM

Title: Game Command Override Isn't Being Called
Post by: lefthandedhero on May 12, 2024, 08:14:33 PM
In my code, I wrote the "game:on_command_pressed(command)" event to override the built-in behaviour of the sword command. However, when I run my game, the "game:on_command_pressed(command)" event is never called and the built-in behaviour is used.

I put the event in its own metatable called "game_meta.lua" (which is in a file called "meta") and, in features.lua, I wrote, "require("scripts/meta/game_meta")".

Why is the engine not calling the event, and how do I get the engine to call the event?


EDIT: It turns out that I accidentally wrote the wrong variable name in my code; I accidentally wrote "if action == "attack"" instead of "if command == "attack"".