suggestions for engine control quadrant in pure AM

Help and techniques for creating Air Manager Instrument Graphics

Moderators: Ralph, russ

Message
Author
Roxus
Posts: 57
Joined: Wed Sep 02, 2020 7:30 pm

Re: suggestions for engine control quadrant in pure AM

#11 Post by Roxus » Tue Jun 08, 2021 10:54 pm

Ah yeah, thats a good idea! When it hits the "notch" I have to get a released event before it will start moving again !!

JackZ
Posts: 1925
Joined: Mon Feb 22, 2016 1:02 pm

Re: suggestions for engine control quadrant in pure AM

#12 Post by JackZ » Wed Jun 09, 2021 4:18 pm

Try this, it seems to achieve the effect that you're looking for:

Code: Select all

-- Background and text
img_add("slider.png",-10, -12, 200,342)
txt_add("OFF", "font: arimo_bold.ttf; size:20; color: white; halign:left;", 140, 30, 100, 200)
txt_add("DIR", "font: arimo_bold.ttf; size:20; color: white; halign:left;", 140, 127, 100, 200)
txt_add("XFD", "font: arimo_bold.ttf; size:20; color: white; halign:left;", 140, 225, 100, 200)


old_lever_pos=0
new_lever_pos=0

-- Called when user drags slider to certain position
function pos_callback(position)
if  new_lever_pos==old_lever_pos then --blocks the lever once it has changed position until the lever is released
   if position>=0.75 then  -- Set the slider position to the very end
	slider_set_position(slider_id, 1)
	new_lever_pos=1
   elseif position >=0.25 then -- between 0.75 and 0.25 we consider that the center notch is reached
   	slider_set_position(slider_id, 0.5)
	new_lever_pos=0.5
    elseif position>=0 then  -- below0.25 we consider that the first notch is reached
	slider_set_position(slider_id, 0)
	new_lever_pos=0
    end
end
end

function pressed_callback()
	-- empty function
end

function released_callback()
	old_lever_pos=new_lever_pos -- updates the lever position
end

-- Create a new slider
slider_id = slider_add_ver(nil, 0, 0, 200,320, "thumb.png", 137, 143, pos_callback,pressed_callback,released_callback)
Last edited by JackZ on Wed Jun 09, 2021 4:42 pm, edited 1 time in total.
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

JackZ
Posts: 1925
Joined: Mon Feb 22, 2016 1:02 pm

Re: suggestions for engine control quadrant in pure AM

#13 Post by JackZ » Wed Jun 09, 2021 4:40 pm

Roxus wrote:
Tue Jun 08, 2021 6:59 pm
Yes, doing touchscreen, and I do expect to use the code to make it "jump" to the middle notch. I was more thinking about how I stop myself from just keeping on sliding passed the notch, and having to do it in 2 phases, like I imagine RL is with these controls. But IDK
Even though I never piloted a BlackHawk, in the A320 I fly IRL, the flaps lever can be set directly from position 2 to Full for example without stopping at position 3 if you keep the lever lock up while translating it.
There is a protection that prevents you to go directly from 0 to 2 though.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests