Adding Mouse Click as a bindable action

Creez

Member
I'm relatively new to GML so I apologize for what is most likely a stupid question, however even after looking through the documentation I've hit a wall.

I am looking to bind the left mouse click to an action called 'interact_key'. I tried something like this and it doesn't work. Any help would be greatly appreciated!

GML:
if(instance_number(obj_textevent)>1 or instance_number(obj_textbox)>1){ instance_destroy(); exit; }

//-----------Customise (FOR USER)
interact_key        = mouse_check_button_pressed(mb_left);
up_key                = vk_up;        //for dialogue choices
down_key            = vk_down;        //for dialogue choices
 

Nidoking

Member
You can't store a function that way. You'd have to do the check wherever you want to know whether interact_key has been activated. Maybe consider putting that in a script where you can do some logic to check whether you're looking for a keypress, mouse button, or whatever, and check the appropriate thing.
 

Jorg Gjer

Member
You say you want to bind mouse click to an action.
In your code , interact_key is used as a variable.
If you realy want it to work this way , when you want the action to happen , just check if interact_key is true.

Kaizen
 
Top