Jump to content

Damlimey

Donor
  • Content Count

    61
  • Donations

    $0.00 
  • Joined

  • Last visited

Everything posted by Damlimey

  1. Okay, I see what you mean. Thank you, I'll try all of that! Cheers
  2. Hi all, Me again... Would anyone be so kind as to tell me why this doesn't work? I have taken the joystick and button number straight from the 'buttons + switches ' tab in FSUIPC. The code is straight out of the Lua Library doc. The sound file is in FSX/sound. The code is in the aircraft user file. function LibUserTimer1Hz() function set8000 () x = ipc.testbutton(0, 11) if x == TRUE then sound.play("MRSDAHL") else end event.timer(1000, "set8000") end end What dum mistake have I made this time? Thanks in advance!
  3. Thank you for this though I do have one final question; how do I represent the maths in the .Lua file? Would it be: if (ht/19980) <= 65 then..? Thanks in advance.
  4. Hi all, I am attempting to read the Radio Altitude offset (0x31E4) and used the tracer to look at the output values. However, for any given altitude, the output values vary by tens of thousands as they scroll up the console. This variation suggests that it will be very difficult for me to read a value and instigate an action at a given altitude. The offset status list shows this offset as a 4 bit value. Is there a solution to this? Is there a better offset I can use? I'm very puzzled. Thanks in advance.
  5. I got it working by luck rather than maths. I found that 0x1400, 200 would write 200lbs to station 1 (station.0 in FSX) and just started adding numbers until I could add it to station 2. the magic number in this case was 30. So, 1430=2, 1460=3, 1490=4 etc. I did study the Offsets status doc but no matter how many times I read it, the only penny that dropped was that each station was a value of 1400+ something. The document also says that the result needs checking in FSX which I assume somebody has done ages ago but in case not; ipc.writeDBL(0x1430, 3000) puts 3000lbs into the second payload station, it appears as that in the FSX payload menu and switching it in makes my helicopter drop like a stone so it definately works. I tried the same with: ipc.writeDBL(0x1448, 3000) but that didn't work although I think that is probably because I haven't coded it correctly? Thank you for getting back to me on this, yet again you have taught me something new.
  6. I was wrong! 'ipc.writeDBL(0x1400, 200)' does write 200 lbs into payload station 1 so, what I am asking now is how do I write to station 2 or 3? Yippee!
  7. Hi all, I had a crazy thought the other day about using LINDA to change the weight value of a particular payload station in FSX. The offsets list has an entry (0x1400) and using the tracer, I could read by default the value of the weight at station 1. However, reading from the offets list, I do not understand how to interogate any subsequent station so my first question is how do I trace 0x1400 station 2 or 3 etc? Then I thought about using 'ipc.write' to change that weight value but 'ipc.writeDBL(0x1400, 200)' didn't work. I get the feeling that actually, you can't write values into FSX using this method but I wonder if there is a way that someone here has either used or thinks might work. It strikes me that this is probably a dead end idea but if I don't ask...
  8. Hi all, I think this is a simple question for all you experts out there. I would like to have an 'initial state' which presets several switch/variable conditions when I load specific aircraft. Because this will not be triggered by a switch preferably, I am assuming that this should be done by the user.lua file. If that is the case, could somebody please tell me how to code this, let's say it's a one off toggle of a fuel valve. The only way I have achieved this as a proof of theory was to use the LibUserTimer but obviously, that just kept repeating the toggle on/off. So, my question is specifically; how do I code the user file to perform the function once only when it is loaded? Big thanks in advance to you all, D
  9. That seems to have fixed it, I will finess it as you suggest so thank you very much FDEev!
  10. Thanks for this. Are you referring to MOI?
  11. Hi all, I hope someone can help... I am building a flight model and I am seeing a problem when I start to use a real world 'dry weight' in the aircraft cfg file. The model shakes and 'trembles' when it is not running and just sitting on the tarmac. This problem goes away when I reduce the dry weight but everything else is built around that weight so I would rather use it correctly. Any ideas as to where else the fix for this might be?
  12. Thank you once again, that was the issue, lower case not caps. It is expressed as caps in the .lua library document so that's my excuse this time around. Thanks again, G
  13. Hi all, And this week's question is: If I am testing a button state and I am using x = ipc.testbutton(2, 11) and as the library says, the return will be either TRUE or FALSE, would I then put... if (x == TRUE) then or if (x == "TRUE") then or, am I asking the wrong question? Here's the whole chunk... function switchcon () x = ipc.testbutton(2, 11) if (x == TRUE) then function fuelchecka () function fuelcheckb () end if (x == FALSE) then sound.stop("Warning_Fuel_Tone") sound.stop("Warning_Fuel") end end Thanks in advance, G
  14. Hi all, I'm not sure this is the right place for this question but it does involve the tracer and editor so I'm here for now. Is it true that the Lvars listed in the lefthand column of the 'hunting' console, are the only outputs from FSX that can have a value in LINDA? I ask this because in calling an event.Lvar, in this case "fuel total quantity" the editor returns a 'nil value' error. Sure enough, in the hunter Lvars list, there is no sign of any fuel related Lvars. This is curious because I can examine the fuel total quantity with an event.offset (0x1264, "UD") etc but I would prefer to use an event.Lvar because of the timer. I am using an add on aircraft here but am I really chasing a ghost or is there another way of interogating FSX that is so far, a mystery to me? Is it something I need FSUIPC to do for me? Thanks in advance, G
  15. Hi all, Success! Of sorts... I have taken on board guidence from ScottFlieger and example code from Masterius and came up with this, which works albeit on a basic level: function LibUserTimer1Hz() ipc.sleep(5000) fuelcheck () end function fuelcheck () i = ipc.readUD(0x1264) if (i <=30) then fuelwb=sound.play("Warning_Fuel_Tone") sound.adjust(fuelwb, -100) --alarm_enable () else end end event.offset(0x1264, "UD", "fuelcheck") I will build on this and I am grateful to you both for your time. Many thanks, G
  16. Hi Masterius, Thanks for this. I sort of boiled it down to suit my ship, which has only one tank and engine and tried to compensate for your Lvars with those that you will see herein. LINDA doesn't like the event.Lvar line claiming that the Lvar is a nil value. This is how I ended up, it's apprent that I'm missing something somewhere else but obviously, I don't know what it is: function fuelcheckAll () fuelcheck () end function fuelcheck () i = ipc.readLvar("L:FUEL TOTAL QUANTITY") n = ipc.readLvar("L:FUEL VALVE ENG1") if(0 < i and i <=30) then alarm_enable () else end end event.Lvar("L:FUEL TOTAL QUANTITY", 1000, "fuelcheck") function alarm_enable () if n==1 then fuelwb=sound.play("Warning_Fuel_Tone") sound.adjust(fuelwb, -100) else end end My previous approach was this: function LibUserTime10Hz () checkfuel () end function checkfuel () if ipc.readUD(0x1264) <=30 then fuelwb=sound.playloop("Warning_Fuel_Tone") sound.adjust(fuelwb,-100) end end That didn't work either but I do know that the ipc.readUD... line works if I place the function under a switch such as the master battery. I think my understanding of 'event' calls is very primitive. Thank you for your help so far, G
  17. Thanks ScotFlieger, I'll pursue this and no, I won't benefit from having someone code for me but a little coaching, like this, goes a long way. Thanks again, G
  18. I apologise for how clumsy this must look and it doesn't work but am I close? (In the .user file)... function Init () LibUserTime1Hz=chkf function checkfuel() chkf=ipc.readUD(0x1264) if chkf<=30 then fuelwa=sound.play("Warning_Fuel") fuelwb=sound.playloop("Warning_Fuel_Tone") sound.adjust(fuelwa,-25) sound.adjust(fuelwb,-25) end end end
  19. Okay, so would a piece of code looking like this, placed in the user.lua file do the trick? event.offset() if ipc.readUD(0x1264)<=30 then fuelwb=sound.playloop("Warning_Fuel_Tone") end Or is that me being too simplistic? btw, the ipc.read offset does the job under a switch function but like I said, only once when the switch is activated. Thanks, G
  20. Hi all, My question is this; is a LINDA actions file purely reacting to a change in a switch condition when it happens or, is LINDA monitoring the actions file repeatedly looking for a change in status? I ask this because as I am building up my code for various switches and knobs on my panels, all is going well but where I am looking for LINDA to react to a change in a variable (say, 0x1264, TOTAL FUEL QUANTITY) it seems only to react to a change in that variable (i.e. quantity less than 30 gallons) if the code is embedded in a switch function. What I am looking for is a way of placing the code that monitors the status of the variable constantly so LINDA detects the change in real time and not just on the prompt of a switch. Is there a place where this sort of code can be placed so that LINDA checks it regularly or, is there something other than a 'function' call that I could use? Otherwise, totally happy camper! Thanks in advance, G
  21. Thanks Nuno Pinto for the suggestion. Unfortunately, it hasn't fixed it. I'm thinking that maybe this function should be under one of my switch functions, like the battery on/off function in the actions file. I'll try that. D
  22. Hi all, Slowly getting to grips with using LINDA for custom actions with switches etc but still having a problem getting my head into reading Lvars and getting returned values to trigger other things like a sound etc. I think I know enough to know that the code below is wrong but it would help me enormously if someone could correct it. This would lead me onto a greater use of LINDA, even if it just helps the penny to drop. I have a module file that works well for switches but somehow, I have it in my head that this sort of code should be in the 'user' file and so that is where I have put this... -- Fuel Alarm -- function Fuel_Alarm() ftq=readLvar("FUEL_TOTAL_QUANTITY",gallons) if ftq<=(30) then alarmf=sound.play("BingoFuel") sound.adjust(alarmf,-100) else end end Thanks in advance, D
  23. Thanks for the clues guys, I'll have a look at these suggestions and see what happens. Don't worry MaDDogz, we all have our moments... Just ask my ex!
  24. Hi all, Sorry for the delay in saying thank you for your help. To answer ccb777, the code resides within a function triggered by a fuel pump switch. Fuel pump is switched on by a .lua function in the action file and then the 'fuel alarm' code sits in the same actions file. I thought the .lua would just keep running so the code would test the fuel level all the time. But it ain't working. However, at least now you guys think the code is good, I'll look elsewhere. Thanks all! D
×
×
  • Create New...