Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Anonymous Methods Issue

A topic by Angelo1810 created 32 days ago Views: 72 Replies: 3
Viewing posts 1 to 4
(1 edit)

Hi! I was wondering if using anonymous methods is possible with GMLive, this is specific but I could't find a solution to my problem. Most of my objects are coded like this:

///Create event  
step_script = function(){
     //code here
}
draw_script = ...  
///Step event 
step_script();  
///Draw event 
draw_script();

When I make changes inside step_script or draw_script while the game is running, GMLive doesn't reload them. How do I correctly use live_call() for variables created this way?

Developer

You can

  • Put live_name + live_call inside the method so that GMLive updates it
  • Temporarily copy the method assignment into the Step event so that it gets replaced with a new one

I wish there was a better way to work with scripts. The current way is quite tedious and requires extra steps.

Developer

I too wish there was a better way to work with anonymous functions, but debug_get_callstack() returns things like gml_Script_anon@32@scr_test@scr_test:3 at best.