Jump to content
The simFlight Network Forums

A2A Spitfire Radiator assigned to Axis?


Recommended Posts

Hi,

 

I have been trying to assign the Radiator Flap for the A2A Spitfire to the mixture lever for the Saitek throttle quadrant (I don't really use it for this plane)

 

However, I cannot seem to find anything that allows this, does anyone have a way to do this through FSUIPC? I have disabled all controllers in FSX as there was a clash so the input config isn't an option.

 

Many Thanks in advance.

Dan

P.S I am not great at programming etc....

Link to comment
Share on other sites

I have been trying to assign the Radiator Flap for the A2A Spitfire to the mixture lever for the Saitek throttle quadrant (I don't really use it for this plane)

 

However, I cannot seem to find anything that allows this, does anyone have a way to do this through FSUIPC? I have disabled all controllers in FSX as there was a clash so the input config isn't an option.

 

"Radiator flap"? I've never heard of such a thing. Is it possibly the same as the "cowl flap"? If so, assign to the cowl flaps axis.

 

One other thing you can try -- assuming it does actually use an FS axis -- enable axis event (and possibly alse the normal event) logging in FSUIPC's logging tab, then operate the on-screen flap control, and see what control, if any it actually uses by examining the log file saved in the FS Modules folder.

 

If it isn't equated to any aspecific standard axis or control in FS, then you might have to resort to other methods. I'm afraid you'll need A2A Spitfile documentation and possible support for that.

 

Pete

Link to comment
Share on other sites

"Radiator flap"? I've never heard of such a thing. Is it possibly the same as the "cowl flap"? If so, assign to the cowl flaps axis.

 

One other thing you can try -- assuming it does actually use an FS axis -- enable axis event (and possibly alse the normal event) logging in FSUIPC's logging tab, then operate the on-screen flap control, and see what control, if any it actually uses by examining the log file saved in the FS Modules folder.

 

If it isn't equated to any aspecific standard axis or control in FS, then you might have to resort to other methods. I'm afraid you'll need A2A Spitfile documentation and possible support for that.

 

Pete

Hi Pete,

 

Thanks for the very quick reply... I had tried the Cowl Flap Axis with no success, I will try again tonight, and will try the logging idea.  

 

Someone had mentioned the L: Variable? I think this might be too complicated for me though if it is even an option...

 

Thanks again,

Dan

Link to comment
Share on other sites

Hello,

 

here is a LUA script:

-- Assignments valid for P40 and Spitfire



-- rounds the integer
function round(num)
	num = tonumber(num)
	if num == nil then return 0 end
    if num >= 0 then return math.floor(num+.5) 
    else return math.ceil(num-.5) end
end

function round2 (num, idp)
  num = tonumber(num)
  if num == nil then return 0 end
  local mult = 10^(idp or 0)
  return math.floor(num * mult + 0.5) / mult
end



acftname = ipc.readSTR("3D00", 35)

------------------------------------------------------------- Spitfire


elseif string.find(acftname,"Spitfire",0,true)
then

	var = round(((ipcPARAM+16384)/32768*10)/2)
	--ipc.display(var)
	--ipc.sleep(50)
	ipc.writeLvar("L:Eng1_RadiatorLeverPos", var)



------------------------------------------------------------- P40


elseif string.find(acftname,"P-40",0,true)
then

	var = (ipcPARAM+16384)/32768*100
	--ipc.display(var)
	--ipc.sleep(50)
	ipc.writeLvar("L:Eng1_RadiatorLeverPos", var)

end

Copy that code, insert it into Notepad (Editor) - NOT Word etc.!

Save it into your Modules folder, name it as you like, e.g. Radiator.LUA

 

Simply open FSUIPC and choose "send to FSX axis" and select "lua Radiator"

 

that's it!

 

 

 

EDIT: as you can see, that code is valid for P40 and Spitfire

Link to comment
Share on other sites

Thanks for that, I will try that later!

 

Will this only work for the Spitfire and P-40 as I use the mixture lever for the Mustang. I do use it for the P-40 but it wouldn't be a problem if I wasnt able to.

 

Sorry if I sound silly... not really that good with PC technicals...

 

Thanks again!!

Dan

Link to comment
Share on other sites

Hello,

 

here is a LUA script:

-- Assignments valid for P40 and Spitfire



-- rounds the integer
function round(num)
	num = tonumber(num)
	if num == nil then return 0 end
    if num >= 0 then return math.floor(num+.5) 
    else return math.ceil(num-.5) end
end

function round2 (num, idp)
  num = tonumber(num)
  if num == nil then return 0 end
  local mult = 10^(idp or 0)
  return math.floor(num * mult + 0.5) / mult
end



acftname = ipc.readSTR("3D00", 35)

------------------------------------------------------------- Spitfire


elseif string.find(acftname,"Spitfire",0,true)
then

	var = round(((ipcPARAM+16384)/32768*10)/2)
	--ipc.display(var)
	--ipc.sleep(50)
	ipc.writeLvar("L:Eng1_RadiatorLeverPos", var)



------------------------------------------------------------- P40


elseif string.find(acftname,"P-40",0,true)
then

	var = (ipcPARAM+16384)/32768*100
	--ipc.display(var)
	--ipc.sleep(50)
	ipc.writeLvar("L:Eng1_RadiatorLeverPos", var)

end

Copy that code, insert it into Notepad (Editor) - NOT Word etc.!

Save it into your Modules folder, name it as you like, e.g. Radiator.LUA

 

Simply open FSUIPC and choose "send to FSX axis" and select "lua Radiator"

 

that's it!

 

 

 

EDIT: as you can see, that code is valid for P40 and Spitfire

Hi,

 

I have done as instructed and I can see the LUA Radiator as an option, however when I assign this it doesn't seem to move the Radiator Flap lever?

 

Any help would be very much appreciated!

Dan

Link to comment
Share on other sites

Looking in the FSUIPC Log there seems to be an error with the LUA??

 

1126062 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126094 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126281 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126328 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126374 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126421 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126452 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126499 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126546 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126593 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126655 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
  1126702 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'
Link to comment
Share on other sites

Looking in the FSUIPC Log there seems to be an error with the LUA??

 

 1126702 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\Radiator.lua:27: '<eof>' expected near 'elseif'

 

It looks like some other aircraft possibilities were removed. I think the first 'elseif' should just be 'if'.

 

Pete

Link to comment
Share on other sites

There appears to be a missing "end" in the Spifire section.

------------------------------------------------------------- Spitfire


elseif string.find(acftname,"Spitfire",0,true)
then

	var = round(((ipcPARAM+16384)/32768*10)/2)
	--ipc.display(var)
	--ipc.sleep(50)
	ipc.writeLvar("L:Eng1_RadiatorLeverPos", var)


 end   <----------- This is the missing 'end'
Link to comment
Share on other sites

oh, yes...

 

copy and paste error from myself!

sorry!!!!!

:oops: 

 

Bad,boy, Günter, bad boy!   :)

 

Dan, glad you are up and running. Last evening I created an addition to my Spitfire Lua script to add the

Radiator Lever axis assignment code just to insure that it was easily done, as I use the Input Configurator

normally to assign that function. The main difference between my code and Günter's is an attempt to

reduce the 'jumping back and forth' when going from one setting to the next due to any 'noise' on the

axis. I also assign the axis to write to one of the user-defined offsets and then use an event.offset  to trigger

the lua function.

 

Here is waht I came up with:


  function Rad_Flap(control, dummy)

	Rad_Lever_in = ipc.readSW(0x66C6)

    Rad_Lever = round(round((Rad_Lever_in+16384)/32768*10)/2)

	ipc.writeLvar("L:Eng1_RadiatorLeverPos", Rad_Lever)

--  ipc.display("Rad Flap = "..Rad_Lever, 1)  -- this line for testing only

  end


-- rounds the integer
  function round(num)
	num = tonumber(num)
	if num == nil then return 0 end
    if num >= 0 then return math.floor(num+.5)
    else return math.ceil(num-.5) end
  end

event.offset(0x66C6,"SW", "Rad_Flap")

The 'double use' of the 'round' function seemed to reduce the 'stuttering' but did not completely eliminate it.

 

Günter and I use slightly different approaches to arrive at the same result :)

 

   Paul

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.