Jump to content

Sign in to follow this  
jcgam

reading joystick button

Recommended Posts

I swear I searched this forum for hours but couldn't find a definitive answer. How do I read a joystick button in a script? Here's what I added to a helicopter initialization script:

while{true}do{

if(inputAction "fire" != 0)then{hint "fire button pressed!"};

};

Nothing happens when I press the fire button. Is inputAction the correct function to use? Where should I put the script?

Share this post


Link to post
Share on other sites

I just tested it, the Fire command does not appear to be working correctly, I could get the other commands to work but fire would not return 1 even when pressed.

I would add a small sleep command to your script though:

while{true}do{ 
if(inputAction "fire" != 0)then{hint "fire button pressed!"};
[color="Red"]sleep .01;[/color] 
};

But if your looking at doing something when the pilot fires you would always use an Fired eventhandler.

http://community.bistudio.com/wiki/ArmA:_Event_Handlers#Fired

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  

×