YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
23 stars 8 forks source link

asset_has_tags() and others return a number, expected a boolean #6129

Open Toad06 opened 4 months ago

Toad06 commented 4 months ago

Description

Affected functions:

These functions all return 0 or 1, when the expected is false or true (as per the documentation, which makes sense). This is obviously not a big issue, but it would be nice that they return booleans rather than numbers.

Expected Change

No response

Steps To Reproduce

show_debug_message(typeof(asset_add_tags(o, "hello", asset_object))); // "number", expected "bool"
show_debug_message(typeof(asset_has_tags(o, "hello", asset_object)));
show_debug_message(typeof(asset_has_any_tag(o, "hello", asset_object)));
show_debug_message(typeof(asset_remove_tags(o, "hello", asset_object)));
show_debug_message(typeof(asset_clear_tags(o, asset_object)));

Or download the sample here: _tags.zip (then press Enter when the game runs).

How reliably can you recreate this issue using your steps above?

Always

Which version of GameMaker are you reporting this issue for?

2024.4.1 (Monthly)

Which platform(s) are you seeing the problem on?

Windows, HTML5

Contact Us Package Attached?

Sample Project Added?

ParodyKnaveBob commented 4 months ago

Dear YoYo, would it be feasible for you to perform a "Search All" in your code for how you return Boolean vs. real? I ask because, just now, I found keyboard_check() also returns a real instead of a Bool, and there's no telling how many loose ends you might have dangling (possibly due to unchecked legacy code importing?).

Test:

// separate function calls to remove concatenation's remote possibility to recast anything
draw_text(0, 0, typeof(keyboard_check(vk_right)));
draw_text(0, 32, typeof(choose(true, false)));
draw_text(0, 64, typeof(bool(keyboard_check(vk_right))));
draw_text(0, 96, keyboard_check(vk_right));

Result:

number
bool
bool
*

*and then the last line in the result is 1 or 0 as half-expected, except of course it should be true or false as fully expected

The good news is Feather is already hard-coded for the correct returns. (The bad is it's inconsistent with the actual returns, lol.)

v2024.2.0.132 (because v2024.4.x gives me motion sickness, #6108)