lucilk 10 Posted August 30, 2009 (edited) 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 August 30, 2009 by lucilk Share this post Link to post Share on other sites
charon productions 10 Posted August 30, 2009 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
nuxil 2 Posted August 30, 2009 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