Thetan-ILW / Noesis

A rhythm game, soundsphere distribution
GNU General Public License v3.0
3 stars 0 forks source link

Crash occurs when I try to bind RAlt #1

Closed Asuri4 closed 2 hours ago

Asuri4 commented 3 hours ago

I am unable to bind RAlt inside the input window for any key count without the game crashing with this error:

_attempt to compare number with string stack traceback: errhand.lua:105: in function 'handler'

[C]: in function 'sort'
thetan/skibidi/models/ActionModel.lua:66: in function 'getComboString'
thetan/skibidi/models/ActionModel.lua:195: in function 'getDownModAction'
thetan/skibidi/models/ActionModel.lua:227: in function 'inputChanged'
thetan/skibidi/views/GameView.lua:154: in function 'receive'
sphere/ui/UserInterface.lua:64: in function 'receive'
sphere/controllers/GameController.lua:184: in function 'receive'
aqua/Observable.lua:37: in function 'resend_transformed'
loop.lua:263: in function 'keypressed'
loop.lua:124: in function <loop.lua:96>
[C]: in function 'xpcall'
[love "boot.lua"]:377: in function <[love "boot.lua"]:344>_

I attempted to swap skins and then enter the INPUT menu and try to bind RALT, it didn't work. I also attempted to try with and without VIM motion enabled, as with it on, my ESC key does not work inside the menus but that also didn't work and as I mentioned before I also tried with different keycounts. Another random thing I noticed is that using the Iyase skin, the keyboard overlay that the skin has lights up LALT when I press RALT and since I forget to say, LALT works just fine. It's worth mentioning that RALT is able to be bound and utilized inside vanilla soundsphere.

Lastly I tried asking ChatGPT4o about the error and it said this:

_

The error you're encountering, attempt to compare number with string, suggests that somewhere in your code, you're trying to compare a number to a string value. The error is likely occurring when you attempt to bind the Right Alt key in your game.

Here are a few steps to help you troubleshoot and fix the issue:

Locate the Root Cause:

The error appears to occur in thetan/skibidi/models/ActionModel.lua on line 66 in the function getComboString, which is likely involved in handling keybindings or input. Since it works with the Left Alt but not the Right Alt, it could be that the Right Alt key is being interpreted as a string or handled differently in your input system. Check Keybinding Logic:

In Lua, different keys might be represented as strings or numbers, depending on how they're stored or handled. Check if Right Alt is being assigned a string representation (e.g., "Right Alt") while Left Alt might be stored as a number or vice versa. Ensure that your keybinding function consistently handles both Alt keys in the same format (either as strings or numbers). Fix the Comparison:

In thetan/skibidi/models/ActionModel.lua, check for any comparison involving keys (such as key codes) that may be mismatching types. Example: If you're comparing a key to a predefined set of keys, make sure both sides of the comparison are either numbers or strings. lua Copy code -- Example fix: Convert all key codes to strings before comparison if tostring(keyCode) == "Right Alt" then -- Handle Right Alt end Debugging Steps:

Add a debug print before the problematic line in ActionModel.lua:66 to see what values are being compared: lua Copy code print(type(key1), key1, type(key2), key2) -- Print types and values before comparison This can help you figure out which value is a string and which is a number.

Keycode Mapping:

Look into how your game engine (LOVE2D, in this case) handles Right Alt. Some engines treat Right Alt differently (it might be AltGr on certain keyboard layouts), so double-check your keycode mappings in the engine's documentation. Once you've pinpointed the issue, make sure all key comparisons are of the same type. If the Right Alt key is causing problems specifically, you might need to adjust how your system handles modifiers like Alt or AltGr.

_

Asuri4 commented 2 hours ago

Fixed by disabling the threaded input option inside the INPUT menu.