Catspeak Reference


struct CatspeakForeignInterface

GameMaker Language (.gml)
Copyfunction CatspeakForeignInterface() constructor { self.exposeEverythingIDontCareIfModdersCanEditUsersSaveFilesJustLetMeDoThis; // 3 fields omitted }

Used by Catspeak code generators to expose foreign GML functions, constants, and properties to the generated Catspeak programs.

§ addBanListtop ^

GameMaker Language (.gml)
Copystatic addBanList = function( ban : String, )

Bans an array of symbols from being used by this interface. Any symbols in this list will be treated as though they do not exist. To unban a set of symbols, you should use the addPardonList method.

If a symbol was previously banned, this function will have no effect.

Arguments

  • ban

    The symbol to ban the usage of from within Catspeak.

§ addPardonListtop ^

GameMaker Language (.gml)
Copystatic addPardonList = function( pardon : String, )

Pardons an array of symbols within this interface.

If a symbol was not previously banned by addBanList, there will be no effect.

Arguments

  • pardon

    The symbol to pardon the usage of from within Catspeak.

§ existstop ^

GameMaker Language (.gml)
Copystatic exists = function( name : String, ) -> Bool

Returns whether a foreign symbol is exposed to this interface.

Arguments

  • name

    The name of the symbol as it appears in Catspeak.

Returns Bool

§ exposeAssettop ^

GameMaker Language (.gml)
Copystatic exposeAsset = function( name : String, )

Exposes a GameMaker asset from the resource tree to this interface.

Arguments

  • name

    The name of the GM asset that you wish to expose to Catspeak.

§ exposeAssetByTagtop ^

GameMaker Language (.gml)
Copystatic exposeAssetByTag = function( tag : Any, )

Exposes a set of tagged GameMaker assets to this interface.

Arguments

  • tag

    The name of a tag, or array of tags, of assets to expose to Catspeak.

§ exposeConstanttop ^

GameMaker Language (.gml)
Copystatic exposeConstant = function( name : String, value : Any, )

Exposes a constant value to this interface.

📝 Note

You cannot expose GML functions using this method. Instead you should use one of exposeDynamicConstant, exposeFunction, or exposeMethod.

Arguments

  • name

    The name of the constant as it will appear in Catspeak.

  • value

    The constant value to add.

§ exposeDynamicConstanttop ^

GameMaker Language (.gml)
Copystatic exposeDynamicConstant = function( name : String, func : Function, )
🔬 This is an experimental feature. It may change at any moment.

Exposes a "dynamic constant" to this interface. The value provided for the constant should be a script or method. When the dynamic constant is evaluated at runtime, the method will be executed with zero arguments and the return value used as the value of the constant.

Arguments

  • name

    The name of the constant as it will appear in Catspeak.

  • func

    The script ID or function to add.

§ exposeEverythingIDontCareIfModdersCanEditUsersSaveFilesJustLetMeDoThistop ^

GameMaker Language (.gml)
Copyself.exposeEverythingIDontCareIfModdersCanEditUsersSaveFilesJustLetMeDoThis
🔬 This is an experimental feature. It may change at any moment.

Whether to expose every symbol available to Catspeak programs. This will attempt to expose all functions, assets, constants, and global properties available in the GameMaker language (with a few exceptions).

📝 Note

Does not support the physics capabilities of GameMaker because of some weird quirks with how functions are bound.

⚠️ Warning

Potentially extremely slow, since every global variable will iterate over a massive list of constants and functions in order to find a reference.

⚠️ Warning

This turns off sandboxing in Catspeak, and as a result modders will be able to access everything about your game state, its global variables, user save files (and potentially corrupt them), unlock achievements, cheat, access sensitive information such as API keys (if they are stored in variables), and much more that I can't think of right now.

If this sounds okay with you, set this property to true, and all bets are off. You will meet God.

§ exposeFunctiontop ^

GameMaker Language (.gml)
Copystatic exposeFunction = function( name : String, func : Function, )

Exposes a new unbound function to this interface. When passed a bound method (i.e. a non-global function), it will be unbound before it is added to the interface.

📝 Note

If you would prefer to keep the bound self of a method, you should use the exposeMethod method instead.

Arguments

  • name

    The name of the function as it will appear in Catspeak.

  • func

    The script ID or function to add.

§ exposeFunctionByNametop ^

GameMaker Language (.gml)
Copystatic exposeFunctionByName = function( func : Function, )

Behaves similarly to exposeFunction, except the name of definition is inferred. There are three ways this name will be inferred:

  • If the value is a script resource, script_get_name is used.

  • If the value is a method and a name field exists, then the value of this name field will be used as the name.

  • If the value is a method and a name field does not exist, then script_get_name will be called on the underlying bound script resource.

📝 Note

If you would prefer to keep the bound self of a method, you should use the exposeMethodByName method instead.

Arguments

  • func

    The script ID or function to add.

§ exposeFunctionByPrefixtop ^

GameMaker Language (.gml)
Copystatic exposeFunctionByPrefix = function( namespace : String, )

Exposes many user-defined global GML functions to this interface which share a common prefix.

Arguments

  • namespace

    The common prefix for the set of functions you want to expose to Catspeak.

§ exposeMethodtop ^

GameMaker Language (.gml)
Copystatic exposeMethod = function( name : String, func : Function, )

Exposes a new bound function to this interface.

📝 Note

If you would prefer to ignore the bound self value of the function, and treat it as a global script, you should use the exposeFunction method instead.

Arguments

  • name

    The name of the method as it will appear in Catspeak.

  • func

    The script ID or method to add.

§ exposeMethodByNametop ^

GameMaker Language (.gml)
Copystatic exposeMethodByName = function( func : Function, )

Behaves similarly to exposeMethod, except the name of definition is inferred. There are three ways a name will be inferred:

  • If the value is a script resource, script_get_name is used.

  • If the value is a method and a name field exists, then the value of this name field will be used as the name.

  • If the value is a method and a name field does not exist, then script_get_name will be called on the underlying bound script resource.

📝 Note

If you would prefer to ignore the bound self value of the function, and treat it as a global script, you should use the exposeFunctionByName method instead.

Arguments

  • func

    The script ID or method to add.

§ gettop ^

GameMaker Language (.gml)
Copystatic get = function( name : String, ) -> Any

Returns the value of a foreign symbol exposed to this interface.

Arguments

  • name

    The name of the symbol as it appears in Catspeak.

Returns Any

§ isDynamicConstanttop ^

GameMaker Language (.gml)
Copystatic isDynamicConstant = function( name : String, ) -> Bool
🔬 This is an experimental feature. It may change at any moment.

Returns whether the foreign symbol is a "dynamic constant". If the symbol hasn't been added then this function returns false.

Arguments

  • name

    The name of the symbol as it appears in Catspeak.

Returns Bool