Jump to content
The simFlight Network Forums

event.button( ) problem


Recommended Posts

  •  
  •  
  •  
  • Members
  • 5
  • 213 posts
  • LocationColorado, USA

I can't get the simple Lua test script  below to work. I have assigned a key to load the script, and IF I comment out the event.button line, the script at least loads and I get the "Loaded" message. However, with the event.button line in, apparently the script does not even load since I do not get the "loaded" message, and there is no response to a button push. The event.button joystick arguments of 1, 1 are the joy# and button# I get in the FSUIPC6 Button and Switches window when the corresponding button is pushed. I have also tried replacing the first 1 argument with its joy letter in quotes, "J", but that does not seem to make any difference. Below are the joystick assignments from the FSUIPC6.ini file. I cannot figure out what I'm doing wrong. Thanks for any ideas.

Al

Win10/64 P3D4.5HF3 FSUIPC6.08


[JoyNames]
AutoAssignLetters=No
J=Logitech Extreme 3D
J.GUID={EC24C380-3676-11E3-8001-444553540000}
R=Saitek Pro Flight Rudder Pedals
R.GUID={F5D4F4C0-FF57-11E5-8001-444553540000}
Y=Saitek Pro Flight Yoke
Y.GUID={F5D4F4C0-FF57-11E5-8002-444553540000}
B=BU0836A Interface
B.GUID={D89CA0A0-B3FD-11E6-8001-444553540000}
1=Logitech Extreme 3D
1.GUID={EC24C380-3676-11E3-8001-444553540000}
2=Saitek Pro Flight Rudder Pedals
2.GUID={F5D4F4C0-FF57-11E5-8001-444553540000}
3=Saitek Pro Flight Yoke
3.GUID={F5D4F4C0-FF57-11E5-8002-444553540000}
4=BU0836A Interface
4.GUID={D89CA0A0-B3FD-11E6-8001-444553540000}

Lua Test Script

function Taxi_Test(a,b,c)                                                                                      
 ipc.writeSTR(0x3380, " TAXI ");                                    
 ipc.writeSW(0x32FA, 4);
 ipc.sleep(4000)
 return   
 end
  -- Main program
 ipc.writeSTR(0x3380, " Loaded ");                                    
 ipc.writeSW(0x32FA, 3);
 ipc.sleep(3000)  
event.button(1,1,3, “Taxi_Test”)

Link to comment
Share on other sites

You should try lua debug/trace logging to find errors in your lua scripts.

The problem is in the quotes you are using:
    event.button(1,1,3,Taxi_Test”)
should be
    event.button(1,1,3, "Taxi_Test")

Also, you can drop the ';':

function Taxi_Test(a,b,c)                                                                                      
   ipc.writeSTR(0x3380, " TAXI ")                                
   ipc.writeSW(0x32FA, 4)
   ipc.sleep(4000)
   return   
end
-- Main program
ipc.writeSTR(0x3380, " Loaded ")                                    
ipc.writeSW(0x32FA, 3)
ipc.sleep(3000)  
event.button(1,1,3, "Taxi_Test")

 

Link to comment
Share on other sites

2 hours ago, John Dowson said:

The problem is in the quotes you are using:
    event.button(1,1,3,Taxi_Test”)
should be
    event.button(1,1,3, "Taxi_Test")

That was it, and I don't even know where those particular quotes came from -- I only have one quote key on my keyboard. I guess it was the font I was using at the time.

Thank You, John! 

Al

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.