View Issue Details

IDProjectCategoryView StatusLast Update
0028860RunnerMacrosPublic2018-05-09 14:58
ReporterStewart BishopAssigned ToMike Dailly 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionNo Change Required 
Product Version 
Fixed in Version 
Summary0028860: Macros: [GMS2] Using macros to override mouse_x/mouse_y doesn't work as expected
DescriptionCode
--------
#macro _mouse_x mouse_x
#macro _mouse_y mouse_y

// Example 1, can't override mouse_x/mouse_y with ternary, gets recursive macro expansion
#macro mouse_x (global.__ir_is_playback_mode == false ? _mouse_x : global.__ir_mouse_x)
#macro mouse_y (global.__ir_is_playback_mode == false ? _mouse_y : global.__ir_mouse_y)

// Example 2, can't override mouse_x with script, causes recursive ir_mouse_get_x() calls
//#macro mouse_x ir_mouse_get_x()
//#macro mouse_y ir_mouse_get_y()

// Example 3, can't wrap mouse_x / mouse_y values with themselves idiomatically, recursive macro expansion is not supported, this should be a fairly easy feature to implement
//#macro mouse_x (global.__ir_is_playback_mode == false ? mouse_x : global.__ir_mouse_x)
//#macro mouse_y (global.__ir_is_playback_mode == false ? mouse_y : global.__ir_mouse_y)

Expected Result:
----------------------------
- All instances of mouse_x/mouse_y are replaced with the ternary (or script)
- All uses of _mouse_x /_mouse_y use the original mouse_x/mouse_y variables untainted.
Steps To Reproduce1) Within the macros script comment out one example
2) Run it
3) See that this fails
4) Repeat for all 3 examples
5) See that none of these work
1.4 Found In
2.x Runtime Found In2.1.3.189
2.x Runtime Verified In

Activities

Stewart Bishop

2018-02-09 10:31

Adminstrator  

macro_mouse.zip (20,950 bytes)

Mike Dailly

2018-02-12 10:15

Manager   ~0057678

Not a bug. There's a circular reference, so it'll throw away the macro and it won't be used.

i.e.
#macro mouse_y (global.__ir_is_playback_mode == false ? mouse_y : global.__ir_mouse_y)

will expand infinitely to ...
#macro mouse_y (global.__ir_is_playback_mode == false ? (global.__ir_is_playback_mode == false ? (global.__ir_is_playback_mode == false ? (global.__ir_is_playback_mode == false ? ***INF*** : global.__ir_mouse_y) : global.__ir_mouse_y): global.__ir_mouse_y) : global.__ir_mouse_y)

As mouse_y is a macro, you can not use it in a macro, or it'll expand again.

Daniel Cleaton

2018-05-09 14:58

Adminstrator   ~0059164

Agreed. Closing.