Jump to content
The simFlight Network Forums

cellular55

Members
  • Posts

    301
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by cellular55

  1. Hi Peter, thanks again for the clarifications. Unfortunately the lua I wrote seemed to be ok, but in real it is not running well: i'm able to set the offsite byte in the keys setting (let say to 1),but I'm not able to reset it to the original status (let say to 0 to intercept it again when I need to execute another time the actions I want). To do that I use the command ipc.writeUB ("offset",0) in the lua, but that seems to not have any effect BR Joe
  2. Hi Peter, probably the misunderstanding is due to the fact that english is not my first language. Anyway I assumed that reading these paragraphs: Unlike the FSUIPC facilities, WideClient automaticaly runs all Lua programs (files with filetype ".lua") which it finds in the same folder as its own WideClient.EXE program. There are no facilities to start and stop specific Lua programs. With one exception they are all started as soon as WideClient connects successfully to FSUIPC. The exception is a Lua file named initial.lua. If such a file is found it is run almost immediately after WideClient starts up, irrespective of any connections. Naturally it cannot obtain any details from FSUIPC at this time, but it can do other local setting up operations in anticipation. It can be used to run other Lua programs—not by the ipc.macro function, which will want to run them on the FS PC, but using the newer ipc.runlua function. If this is used at all it should refer to Lua programs in other folders, such as a subfolder, not in the main Wideclient.exe folder because otherwise those will be restarted automatically when FSUIPC connection is successful. The facility is designed to run one-off set-up programs, or continuous loop or event-driven programs which run for the duration of the session. By the way I have created the initial lua (below an extract of it) and it does swhat I expected: ipc.set("Cinture",0) ipc.set("Turbo",0) ipc.set("Aiuto",0) function Turbulence(offset,value) if value == 1 then ipc.runlua("c:\\widefs\\lua\\turbbelt.lua") end end function Captain(offset,value) if value == 1 then gs, tas, ias = ipc.readStruct(0x02B4, "3UD") -- ground speed nalt=ipc.readSD(0x0574) * 3.28084 -- altitude in meters and convert in feet gs = (gs * 3600) / (65536 * 1852) tt=string.sub(gs,1,2) at=string.sub(nalt,1,2) sound1 = "c:\\mysound\\1\\"..at..".wav" sound2 = "c:\\mysound\\1\\"..tt.."0.wav" a=sound.play("c:\\mysound\\paxsign.wav") while sound.query(a) do ipc.sleep(1) end a=sound.play("c:\\mysound\\1\\Wat.wav") while sound.query(a) do ipc.sleep(1) end a=sound.play(sound1) while sound.query(a) do ipc.sleep(1) end a=sound.play(sound2) while sound.query(a) do ipc.sleep(1) end a=sound.play("c:\\mysound\\1\\Wp.wav") while sound.query(a) do ipc.sleep(1) end end end function Seat(offset,value) if value == 1 then ipc.runlua("c:\\widefs\\lua\\seatbelt.lua") end end function Attendant(offset,value) if value == 1 then ipc.runlua("c:\\widefs\\lua\\attendant.lua") end end function Music(offset,value) if value == 1 then ipc.runlua("c:\\widefs\\lua\\musicnew.lua") end end function SOS(offset,value) if value == 1 then ipc.runlua("c:\\widefs\\lua\\SOS.lua") end end event.offset(0x66c0,"UB","Turbulence") event.offset(0x66c1,"UB","Captain") event.offset(0x66c2,"UB","Seat") event.offset(0x66c3,"UB","Attendant") event.offset(0x66c4,"UB","Music") event.offset(0x66c5,"UB","SOS") Once again thanks a lo for your support and the great tools. BR Joe
  3. Hi Peter, thanks a lot for your reply. I have created the initial.lua because reading the widefs docs I have undesrtood that this is the only way to have it active in a loop during the FSX session. If i have correctly understood: 1. should assign to the keys/buttons the command 'offset byte set' (without any param?) 2. I should put in the initial.lua the commands 'event.offset' (forf each of the buttons/keys) to detect if the byte has been changed (button or key pressed) and run the related functions with the action I want executedin FSX. Another question: can the functions contain the command ipc.macro to run macros recordered in the PC wherr there is FSX? Is the LUA on the client able to read the variables defined with the command ipc.set in the ipcready.lua on the FSX PC? Thanks again for your support and patience Best regards Joe
  4. Hi, I have just created, on the client PC where I have Wideclient, a LUA file called initial.lua and, as mentioned in the widefs manua,l I would use it to lanch other three LUAs (that I have put in another folder in the client) when I press specific buttons or keys. The problem is that I do not see the entries of the initial.lua (or of the other 3 LUAs) in the list of the controls to couple them to the buttons or the keys. What am I missing? How can assign these LUAs to the buttons or the keys I would use to launch them? Thanks a lot and best regards Joe
  5. Hi Peter, thanks a lot for the support Joe
  6. Hi, I would automatically send to different add-ons, that I have on a networked PC, seveal keystrokes through the SendKey definitions I put in the wideclient.ini file. Is it possible to send all them out at the same time through a LUA file that I could assign to a button? Thanks for th help and best regards Joe
  7. Hi Pete, I have tried with other letters, but the result is the same. The macros runs if assigned to buttons, but not with key press. Joe
  8. Hi, I'm facing a strange bad issue building mouse macros for PMDG 737 NGX. If I assign a mouse macro to a button/swith everything runs well, but if I assign the same macro to a key (i.e. SHIFT Y or ALT SHIFT Y or to any other combination of keys) nothing happens. I would understand what I eventually do wrong. Thanks in advance for the support Joe
  9. Hi Pete, thanks for the prompt reply. I forgot to mention that I'm trying to do that for the Qualitywings 757 and looking around the forum I have discovered that also other pepole had troubles reading variables with this plane and seems that the only way to do that is to set the variables from macros. I will do some more experiments Thanks and kind regards Joe
  10. Hi Peter, may be I got a possible solution: 1. I have executed the command to have all the panel's LVARs listed in the FSUIPC log file 2. Now I will create the macros with the special command for the LVARS (If I correctly understand the advanced guide I can put in the macro the commands only for a single LVAR) 3. If I need to execute more commands at the same time I can create a LUA executing in sequence all the macros I need (i.e. open the battery button shield, switch on the battery, close the battery button shield). Can you please confirm that this is the correct and best approach? Thanks again Joe
  11. Hi Pete, I hope you will be to support me like you have already done in the past. Here my problem: I'm tring to manage through LUAs an XML gauge to be able to use the scripts to program my devices for the fligts simulating the aircraft's buttons and switches (for example to start from dark and cold config). For aircrafts having GAU files I have no problems doing that through macros. For the XML I have used your LUA example 'log vars' to see the LVAR names and their values when I click on the different gauges, but when I create the LUA with the command 'ipc.writeLVar("varname",value)' nothing happens. What am I doing wrong? Thanks in advance for your help Kind regards Joe
  12. Hi Pete, is there a way to understand if the engines reverse are engaged? I have tried checking if the offsets 088C or 0B00 are equal -4096, but that does not seem to work. Thanks and best regards Joe
  13. Hi Pete, thanks a lot.. your support is amazing as always Joe
  14. Hi Pete, is there a way to store in memory a variable declared in a LUA script? Are there specific offsets that could be used for that? Could be useful if you need to run another script using the variable(s) set by another LUA or to recall the same script, originating the variable(s), to eventually do different actions depending by that value. Thanks in advance for your help Joe
  15. Hi, yes sorry... it was my mistake pasting the script here: one '-' is missing in the comment
  16. This is my first attempt to build a LUA script and it intends to manage sound in particular situations during the flight. Feedbacks are more than welcome as I am interested to know about your satisfaction with it and to receive suggestions for future improvements and new features. First I would say a big, big thanks to Pete, for how he has supported me in this attempt with his competence, passion and patience and for his incredible and amazing tool. Prerequisites: The script is done for FSX and needs FSUIPC 4.644 or superior where Pete has put special offsets allowing some functions of the script. Installation: copy and paste the script (located at the end of this post) in a file called ipcready.lua and put it in the module directory of FSX (where also FSUIPC is). To install the wav files look the notes below. With that name the script will be active when you are ready to flight and until you close FSX. Features Turbulence sound: the script plays a looping sound when a turbulence is detected at the altitude where the aircraft is. The sound is stopped when the turbulence is no more present. Sounds advising to fasten the seat belts or to unfasten them are also in the routine Seats belt advises: 4 different sounds are here to be played in the following sequence (in FSUIPC assign a key to toggle the seatbelt switch): 1. BELT SIGN ON 1st time: normally before to leave the gate to play a welcome on board message 2. BELT SIGN OFF 1st time: normally after the climbing to play the message regarding to unfasten the seat belt 3. BELT SIGN ON 2nd time: normally during the descent to play the message to fasten seat belt before the approach 4. BELT SIGN OFF 2nd time: normally parked at the arrival gate to play the message of ended flight Note: at the moment no controls are in place regarding the fact that the flight is in the right condition to play the messages and no controls are in place to avoid simulaneous sounds if you click on the sign more than once at the same time. ATC Chatter: ATC conversations are played on a random base (every 1 minute plus another random interval) if you tune the COM2 radio on 118.10 and 118.20. As is the routine is built to have 70 radio files in two directories (one for each radio-frequence). General Notes: The script is built for my environment (sound directories, wav filenames). Even if you are not experts of LUA scripting (like me) is anywhere easy to understand which are the parts you need to modify. I do not attach any wav file as the mine are for the most part coming from payware add-ons and I do not think I can distribute them, but similar files (crew announcements, radio chatters) are availble as freeware in several sites (like flightsim.com or avsim.com). The WAV filenames are free, in the sense that you can change them in the script. Only exception are the ATC radio files (the name is expected to be 1,2,3,.. and so on until 70). Hope the info are enough clear (i'm not native english speaker). I'm not responsible of any problem, damage you could have using the script, even if I think the biggest possible issue you could face is only to have the script doing nothing (like during some of my first tests). Have fun and good flights Here start the script ------------------------------------------------------------------------------ -- Turbulence looping sound -- Seat Belts Messages -- ATC Radio Chatter -- Initializing flags -- sndflg=0 -- turbulence sound flag seatfl=0 -- seat belt flag -- Function to play sound if and until turbulence is detected -- function turbulence(offset,value) ground=ipc.readUW(0x366) if (value > 0) and (sndflg == 0) and (ground == 0) then ref=sound.playloop("c:\\mysound\\turb.wav") sndflg=1 ipc.sleep(1000) if (seatfl == 2) or (seatfl == 4) then sound.play("c:\\mysound\\paxsign.wav") ipc.sleep(1000) end sound.play("c:\\mysound\\fastenwind.wav.wav") end if (value == 0) and (sndflg == 1) then sound.stop(ref) sndflg=0 if (seatfl == 2) or (seatfl ==4) then sound.play("c:\\mysound\\paxsign.wav") ipc.sleep(1000) sound.play("c:\\mysound\\unfastenseatbelt.wav") end end end -- Function to manage messages when seat belts sign changes - welcome on board -- descent --- on cruise ---- parked at the arrival gate function seatbelt(offset,value) if (value == 1) and (seatfl == 0) then sound.play("c:\\mysound\\paxsign.wav") ipc.sleep(1000) sound.play("c:\\mysound\\welcomeonboard.wav") seatfl=1 end if (value == 1) and (seatfl == 2) then sound.play("c:\\mysound\\paxsign.wav") ipc.sleep(1000) sound.play("c:\\mysound\\descent.wav") seatfl=3 end if (value == 0) and (seatfl == 1) then sound.play("c:\\mysound\\paxsign.wav") ipc.sleep(1000) sound.play("c:\\mysound\\levelautobelt.wav") seatfl=2 end if (value == 0) and (seatfl == 3) then sound.play("c:\\mysound\\paxsign.wav") ipc.sleep(1000) sound.play("c:\\mysound\\atgate.wav") seatfl=4 end end -- Function to play ATC chatter - COM2 freqs 118.10 and 118.20 - 70 wavs for each freq - y var to make the frequency of chat random - x var to make the messages random function ATC_Radio() -- Radio squelch if a valid freq is selected n = ipc.readUW(0x3118) if (n == 0x1810) or (n == 0x1820) then if (n1 ~= n) then sound.play("c:\\mysound\\Radio.wav") n1=n end end -- Radio chatter play routine y= math.random(1,5) if (y == 2) or (y == 4) then if (n == 0x1810) then x=math.random (1,70) suono = "c:\\mysound\\11810\\"..x..".wav" sound.play(suono) end if (n == 0x1820) then x=math.random (1,70) suono = "c:\\mysound\\11820\\"..x..".wav" sound.play(suono) end end end -- FSUIPC LUA calls for the different events -- timer to exec the ATC function every 1 min event.offset(0x0E88,"UW","turbulence") event.offset(0x0E98,"UW","turbulence") event.offset(0x341D,"UB","seatbelt") event.timer(60000,"ATC_Radio") ------------------------------------------------------------------------
  17. Hi Pete, I have done several flights for test and... everything goes great and wonderfully !!!! Those offsets you added are fantastic and detect the turbulence in a perfect way (the sound starts to play exactly when I notice the shaking of the aircraft in the turbulence). I had only to add a control to check if the aircraft is on the ground to avoid the sound in case of turbulence at level of terrain that is quite unrealistic. I really thank you more and more for the support and patience you showed supporting me in this. I was asking myself if you think possible to attach in a post here my work in case other guys are interested with it and for eventual adds I could do in the script. Thanks.. thanks again
  18. Hi Pete, I do not know how to thank you !!!!! You are simply exceptional.. by the way like your tool. I'm going to try that and I will let you know soon about the result. By the way I'm getting passionate of these LUA scripts and I'm extending what I'm doing to include ATC radio chatters, several crew messages in different situations... and it is just the beginning !!! Thanks again
  19. Hi Pete, thanks for the explanation... a little complicated and scaring me. Aniway the script is for FSX (and I use ASE). The reason to try is that this capability(that I find really realistic and nice) is in an add-on I have, but causing crashes on my FSX (despite several reinstallations). So the idea is to replicate it by myself . For the moment from the sript I have done, I will try to read in the function the info regarding the aircraft altitude to activate the sound only if I'm in the middle of a turbulence area (confronting the base and the ceiling of the layers). I will let you know the result. For Fabio: let me do some more test, after I will put it here for who interested (without the sounds .. coming from a payware add-on I don't think I can publish them).
  20. Hi Pete, thanks, thanks, thanks !!! After your last suggestion now the sound is played and stopped as that should be. Now the only point I have to understand is how to activate the sound only if a turbulence is active at the altitude of the aircraft Joe
  21. Hi Pete, I have done the change you suggested, below the new script with the flag declaration: -- Turbulence looping sound -- -- Initializing sound flag -- sndflg=0 -- Function to play sound if and until turbulence is detected -- function turbulence(offset,value) if (value > 0) and (sndflg == 0) then sound.playloop("c:\\mysound\\turb.wav") sndflg=1 end if (value == 0) and (sndflg == 1) then sound.stop("c:\\mysound\\turb.wav") sound.play("c:\\mysound\\noturbadvise.wav") sndflg=0 end end -- FSUIPC different layers turbulence wind and clouds are changing? If so exec function -- event.offset(0x0ED2,"UW","turbulence") event.offset(0x0EDE,"UW","turbulence") event.offset(0x0EEA,"UW","turbulence") event.offset(0x0EFC,"UW","turbulence") event.offset(0x0F02,"UW","turbulence") event.offset(0x0F08,"UW","turbulence") event.offset(0x0F54,"UW","turbulence") event.offset(0x0F60,"UW","turbulence") event.offset(0x0F6C,"UW","turbulence") event.offset(0x0F76,"UW","turbulence") event.offset(0x0F7E,"UW","turbulence") event.offset(0x0F84,"UW","turbulence") event.offset(0x0F8A,"UW","turbulence") and things are changed: now I can hear the sound I want... the only problem is that now I hear it also without any turbulence (if I stop all the turbulence I hear the sound I have put to advise that the turbulence is finished, but after a moment the turbulence noise is back). sigh Effectively I think I should check only the turbulence offset where the aircraft is, but I have no idea how to do that Thanks again Joe
  22. Hi Pete, .. and thanks for your support and patience. What I would get with the script is to play a looping sound, simulating the shaking cabin noise of the aircraft, in case of turbulence and until that is active. To test it I have loaded a saved flight without any turbulence and after some minutes i have changed in FSX the weather to have the strongest turbulence from 1000 ft up to 36000 ft (my FL is 32000). As mentioned nothing has happened. What I can see is that the turbulence is surely active (the aircraft is badly shaked), but no sound. Joe
  23. Hi, thanks for the support. I have tried to build the lua file naming it ipcready as suggested and following your inputs. Here the script: function turbulence(offset,value) if (value > 0) and (sndflg == 0) then sound.playloop("c:\\mysound\\turb.wav") sndflg=1 end if (value == 0) and (sndflg == 1) then sound.stop("c:\\mysound\\turb.wav") sndflg=0 end end -- FSUIPC different layers turbulence wind and clouds -- event.offset(0x0ED2,"UW","turbulence") event.offset(0x0EDE,"UW","turbulence") event.offset(0x0EEA,"UW","turbulence") event.offset(0x0EFC,"UW","turbulence") event.offset(0x0F02,"UW","turbulence") event.offset(0x0F08,"UW","turbulence") event.offset(0x0F54,"UW","turbulence") event.offset(0x0F60,"UW","turbulence") event.offset(0x0F6C,"UW","turbulence") event.offset(0x0F76,"UW","turbulence") event.offset(0x0F7E,"UW","turbulence") event.offset(0x0F84,"UW","turbulence") event.offset(0x0F8A,"UW","turbulence") The script is executed (I see the log in the module dir), but nothing is happening. Could you please to be so patient to address me to the possible errors i'm doing? Thanks in advance
  24. Thanks from the prompt reply. I will try with the LUA script . Please allow me two more question: - calling the lUA script as soon as FSUIPC is connected (calling it ipcintit.lua) does this men that the turbulence offsets are constantly monitored during the FSX session/flight? - I am not able to find in the lua docs I have which are the parameters to have the sound looping (if the turbulence is on) or stopped (when the turbulence is off) Thanks again
  25. Hi, I would implement a looping sound until a weather turbulence is on. I have tried to do that reading the differen turbulence offsets with the free tool PMSounds (Project Magenta) but without any success. I think the reason is due to the fact that PMSounds reads only if a particular offset is on or off and, for what I have understood, the different turbulence offsets have not an on/off status but values from 0 to 255. Do you have any suggestion about how I could solve this? Is there any offest that I'm missing simply saying if the weather turbulence is on or off? Thanks in advance for the help best regards Joe
×
×
  • 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.