🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Certain gml functions unrecognised

A topic by OneSlightWeirdo created 206 days ago Views: 130 Replies: 3
Viewing posts 1 to 2

Hey, I'm having problems with certain GML functions not being recognised upon compilation of mod scripts. I was wondering if there is anything I am doing wrong here, or if this is just due to the version of game maker NT is made in or some other limit on the capabilities of modmaking?

The functions I have found so far that do not work are:
keyboard_key_press
keyboard_check
keyboard_check_pressed
surface_exists
surface_create

These, and I'm sure other related functions, return "(name) is not a function or script" when loaded into NTT. If anyone could help with this issue it'd be really appreciated.

Developer(+1)

Keyboard functions are not supported because the game polls and synchronizes only a number of inputs, as well as handling keyboard<->gamepad mapping (see Input API). I may add keyboard_check alias for these in future just for convenience, but they would only work for the existing keys, which would be confusing.

keyboard_key_press probably isn't going to be implemented, since the game polls multiple physical inputs (as mentioned) for every virtual input, so I'd have to add hacks for that.

Surface functions are not supported because surfaces are volatile (can vanish anytime), therefore are not something that would work consistently when playing online (where each player has their own things)

In general, scripting system supports functions that are deterministic by nature (math, data structures, etc.) or could be forced to work in a deterministic way. The list of supported functions can be found in %LOCALAPPDATA%/nuclearthrone/api/api.gml after doing /gmlapi. There might be some additions in future, but these are generally time-consuming to implement, and there are already too many things to do as-is.

Deleted post

Thanks for the reply, I feel silly for not having checked the input API page more thoroughly. Would there be any method or function for simulating a player pressing a button virtually, in the manner of having a keyboard_key_press in that player object? Thanks once again!

Developer

Depends on what exactly you are trying to do - e.g. for movement you could just adjust hspeed\vspeed and clamp it to (0, maxspeed) range like the game does. For shooting weapons, there's player_fire() function. Swapping weapons is just exchanging values of "wep" and "bwep" (and a few other variables like "reload", "breload" - see fields.gml).