Jump to content
Sign in to follow this  
lucilk

onButtonDown issue

Recommended Posts

can someone help me with a simple script line that say "if you press left mouse button then do this command"

I know its something to do with "onButtonDown" but cant find any example right.

It should be something like this:

while {..........onButtonDown Comand ......} then {hint "the command works"};

Edited by lucilk

Share this post


Link to post
Share on other sites

Familiarize yourself with the following : http://community.bistudio.com/wiki/User_Interface_Event_Handlers

What you are trying to do has to be done with UI Eventhandlers.

It isn`t as easy as you pointed out as an argument in a while statement that can be run from a script.

You have to setup an UI element and define in its config what action the Eventhandler is supposed to execute when the mousebutton is pressed.

Share this post


Link to post
Share on other sites

It should be something like this:

while {..........onButtonDown Comand ......} then {hint "WUPEEEEEEEEEEEEEEEEEEEEE"};

i hope not. :p

this is whay you want to use. "displayAddEventHandler"

X = (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "hint str(_this)"];  

So you make it like

X = (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call YOURFUNCTION"];  


YOURFUNCTION = { hint "i pressed the mouse button" } ;

X = (findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call YOURFUNCTION"];  

hope this can help you on your way :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×