Jump to content
Sign in to follow this  
Angelo Cosma

Any advanced FSUIPC Users here? .lua Event?

Recommended Posts

The Saitek lever is an axis. When I pull back to the 1st stop that is idle and the end of the axis range. Pulling back into the detent presses the button for reverse. When done, moving it forward out of the detent releases the button into idle and in theory kills reverse. Simple as that.

Share this post


Link to post
Share on other sites

The Saitek lever is an axis. When I pull back to the 1st stop that is idle and the end of the axis range. Pulling back into the detent presses the button for reverse. When done, moving it forward out of the detent releases the button into idle and in theory kills reverse. Simple as that.

That's my point exactly -- so when you move out of reverse you are immediately asking for idle -- so why send any control codes, the engine should return to idle, shouldn't it? That is how I handle reverse with a number of a/c I use -- including the PMDG 737NGX.

Share this post


Link to post
Share on other sites

Negative, it's not until ur out of the detent and actually advance the thrust lever forward. Right now what happens is I command reverse. It activates, I move the lever out of the detente and the engine stays at max rev. It will stay there until the plane runs out of fuel.

Share this post


Link to post
Share on other sites

Angelo,

Try this. Forget the Lua script for a minute. In the FSUIPC Button+Switches tab, instead of using Throttle Idle 3 when you come out of the reverse detent, use Throttle Cut 3 from the drop down list (with repeat). Throttle Cut is what I use and the engines go back to idle. See if that works.

Al

Share this post


Link to post
Share on other sites

Angelo,

Try this. Forget the Lua script for a minute. In the FSUIPC Button+Switches tab, instead of using Throttle Idle 3 when you come out of the reverse detent, use Throttle Cut 3 from the drop down list (with repeat). Throttle Cut is what I use and the engines go back to idle. See if that works.

Al

 

Al thanks again for all your help I really appreciate it, wow. 

 

Yes I know that works, that was my method a few years back. My Idle1-4.luas work now, and achieve a GRADUAL reduction of max rev to idle. My goal is to simulate a smooth reduction to idle instead of full reverse and immediate cut / slam to idle where the plan accelerates for a bit. 

 

Problem now is, fly a quad jet, too many button release instructions happen at once and they dont all get seen at the same time vs a 737 or 777 with 2 engines. This is why I contacted Pete and he advised what you have been helping me with thus far. 

Share this post


Link to post
Share on other sites

 

My Idle1-4.luas work now

 

Al thanks again for all your help I really appreciate it, wow. 

 

Yes I know that works, that was my method a few years back. My Idle1-4.luas work now, and achieve a GRADUAL reduction of max rev to idle. My goal is to simulate a smooth reduction to idle instead of full reverse and immediate cut / slam to idle where the plan accelerates for a bit. 

 

Problem now is, fly a quad jet, too many button release instructions happen at once and they dont all get seen at the same time vs a 737 or 777 with 2 engines. This is why I contacted Pete and he advised what you have been helping me with thus far. 

 

OK, great. With the 737 I find the return to idle is reasonably gradual, but perhaps the 747 is different. So what did you have to do to get the Lua scripts to finally work?

Al

Share this post


Link to post
Share on other sites

The ones that work are old ones from years ago, the ones we made still don't do anything

That's interesting. Could you post just one of the old scripts, I'm interested to see what works for the future.

Al

Share this post


Link to post
Share on other sites

This was my Idle1.lua

 

 

while true do        
          throttle1 = ipc.readSW(0x088c)         
          if throttle1 >= 0 then                  
                    break --exit when no more reverse        
          end        
          ipc.control(65964) --65964 = throttle1 incr. Use 65965 for smaller increment        
          ipc.sleep(300) -- adjust for speed of increase. 10mSecs = 100 per second
end
 
 
That lua was then commanded as a button release instruction in the buttons assign area in fsuipc under command to send when button release. 

Share this post


Link to post
Share on other sites

 

This was my Idle1.lua

 

 

while true do        
          throttle1 = ipc.readSW(0x088c)         
          if throttle1 >= 0 then                  
                    break --exit when no more reverse        
          end        
          ipc.control(65964) --65964 = throttle1 incr. Use 65965 for smaller increment        
          ipc.sleep(300) -- adjust for speed of increase. 10mSecs = 100 per second
end
 
 
That lua was then commanded as a button release instruction in the buttons assign area in fsuipc under command to send when button release. 

 

Hmm... so the only real difference is the use of the Lua scripts under [Auto] and the event.button command. I still don't see what the problem was -- I'll be interested to see what Pete Dowson has to say and hopefully learn something.

Al

Share this post


Link to post
Share on other sites

The ones that work are old ones from years ago, the ones we made still don't do anything

 

Angelo,

As I was lying in bed it suddenly occurred to me what the problem likely is: the entires under the [Auto] section in the FSUIPC.ini file should be in the form of 1=Lua script name. So what we needed was:

 

 [Auto]

1=Lua Throttle_Idle_1

2=Lua Throttle_Idle_2

3=Lua Throttle_Idle_3

4=Lua Throttle_Idle_4

 

That is why "nothing happened" as you said. I'm very sorry I didn't realize this earlier.  :sad:

I let Pete Dowson know so he would not spend time looking into this until you at least had a chance to try this fix.

Al

Share this post


Link to post
Share on other sites

Angelo,

As I was lying in bed it suddenly occurred to me what the problem likely is: the entires under the [Auto] section in the FSUIPC.ini file should be in the form of 1=Lua script name. So what we needed was:

 

 [Auto]

1=Lua Throttle_Idle_1

2=Lua Throttle_Idle_2

3=Lua Throttle_Idle_3

4=Lua Throttle_Idle_4

 

That is why "nothing happened" as you said. I'm very sorry I didn't realize this earlier.  :sad:

I let Pete Dowson know so he would not spend time looking into this until you at least had a chance to try this fix.

Al

 

Okay we are getting somewhere. It still doesn't work but I am getting a green bar on top of screen with ! in it. 

 

function ThrottleToIdle_3()
throttle3 = ipc.readSW(0x09BC)
ipc.writeSW(0x3380, throttle3);             
ipc.writeSW(0x32FA, 5);     -- display
end
event.button( 0, 8 , 2, "ThrottleToIdle_3")
 
Thats for throttle 3. No response for throttle 2 which is original from before.

 

2017_2_3_15_48_34_981.jpg

Share this post


Link to post
Share on other sites

Okay we are getting somewhere. It still doesn't work but I am getting a green bar on top of screen with ! in it.

Hi Angelo,

OK, that was just a test script -- so now we know the script was activated.

So let's focus on one throttle now -- say throttle 1.

Please print the script so I can see it.

Thx,

Al

BTW, there should have been a number, the throttle value, displayed on the green bar.

Share this post


Link to post
Share on other sites

Hi Angelo,

OK, that was just a test script -- so now we know the script was activated.

So let's focus on one throttle now -- say throttle 1.

Please print the script so I can see it.

Thx,

Al

BTW, there should have been a number, the throttle value, displayed on the green bar.Yeha

 

Yeah it was just the ! mark.

 

This is number 2

 

 

function ThrottleToIdle_2()
        while true do
          throttle2 = ipc.readSW(0x088c) 
      if throttle2 >= 0 then
          break --exit when no more reverse
      end
      ipc.control(65969) -- 65969 = throttle2 incr. Use 65970 for smaller increment
      ipc.sleep(200) 
   end
end
 
event.button( 2, 6 , 2, "ThrottleToIdle_2")

Share this post


Link to post
Share on other sites

This is number 2

Are you sure the line throttle2 = ipc.readSW(0x088c) is correct? This address value will be different for each throttle. What value do you have here for throttle 2 in your "old" scripts that you said worked?

 

Also, if you go into the FSUIPC Buttons+Switches tab and activate the reverse switch at the bottom of throttle 2, is the Joy#2 and the Btn#6 like you have in this line

event.button( 2, 6 , 2, "ThrottleToIdle_2") ?

 

Al

Share this post


Link to post
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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...