Jump to content
The simFlight Network Forums

Glenn Weston

Members
  • Posts

    57
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Glenn Weston

  1. Ah OK Pete, What I was trying to do was to build an Annunciator Script that had Multi-Coloured Text labels in a Line. If it was achievable or you can supply the facility, this would be beneficial for building small Annunciator panels. I can think of many different pits where this could be done. With the price of small USB screens these days it would definitely be beneficial to pit builders, and it is a way to get screen based annunciators without the need to Undock aircraft panels costing frame rates. I have already built one for the VRS SuperBug that ties into the virtual Caution Panel, However this panel is all one colour so it works great, but this aircraft has two Brow panels that are multi-coloured and this facility would allow me to re-create those ones too over WideFS. Anyhow I would appreciate it if you could take a look, but if it is too complex then I guess it may not be worth it. Thankyou, Glenn.
  2. -- Create window and define title, font, size and colours w1 = wnd.open("TEST PANEL", 0,0,200,140) wnd.font(w1, WND_ARIAL, 24.0, WND_BOLD) --Font, Size and Properties wnd.backcol(w1, 0x000) -- background colour while 1 do ipc.sleep(1000) wnd.textcol(w1, 0xF00) wnd.text(w1 , "RED") wnd.textcol(w1, 0x0F0) wnd.text(w1 , "GREEN") wnd.textcol(w1, 0x00F) wnd.text(w1 , "BLUE") wnd.textcol(w1, 0xFFF) wnd.text(w1 , "WHITE") ipc.sleep(1000) wnd.clear(w1) end Hi Pete, Hope you are well.... I just would like to ask a small question in regards to the WND Library. I have inserted a little test script which draws 4 words of text in the display window which will all be different colours. However the wnd.text command always seems to insert a CRLF and when called again after changing the colour will draw the NEW text on a NEW line. What I would really like to do is mix the colours of text on the same line, Like this: RED GREEN BLUE WHITE instead of: RED GREEN BLUE WHITE which is what the above code currently does. Can you point me in the right direction to achieve this, I have gone over the WND library command reference but I cannot see a way to do it, but that would not be the first time I have missed something like this. Thankyou for your help. Regards Glenn.
  3. No problems Pete, If there is nothing to gain then you are right, just leave it as it is. It works quite well anyhow, I was just posing the question to see if it might be something that was worth looking into. Thankyou Glenn.
  4. Thankyou for the Reply Pete, OK I guess what I am asking then is an extension to the com library that can initiate a socket sort of something like sockethandle = com.open ("port", "host") Then something like this ......... event.com(sockethandle, max, min, term, "function-name") to process the incoming data when data arrives. I hope that makes sense and you and can understand what I am asking. I am thinking in terms of the way we can do event driven scripts to handle Serial data, is it possible to do it in a similar way with TCP/UDP data. I have been looking at your Server/Slave Lua example which I modified for my own use but kept the loop at the end of the example that is used to read the data and maintain the connection. Cheers Glenn.
  5. Hi Pete, Just quick question on the Lua Sockets Library. I have been tinkering with Socket Comms to FSUIPC and have made some great progress. I realise the Sockets Library is one of the Standard Libraries included in Lua, Over the past few years playing with your Lua implementation in FSUIPC I have re-trained my head to do things using events due to efficiency and so forth. So I would like to ask the question if it is possible to create some event driven commands in the com library for socket communications. I may be asking way too much here and I am not at all familiar with how much work that would involve, it may not be worth the effort but would be a nice feature. With everything communicating these days over IP networks I could see some advantages for developers. I have a little project that I am trying to develop at the moment and it is beautiful not having to worry about baud rates etc, Also TCP connections are fully error checked too, so there is nothing to worry about once a connection is established. Anyhow I would be interested if there is any chance I could put in a feature request for that but it's not a critical one, I am quite happy to continue to use a Loops. I just thought I might give you something to do after coming back from Holidays !! Cheers Glenn.
  6. OK no problems Pete, I had already thought about defining variables as you described. I just wanted to make sure I was not doing something wrong, I will simply stick with the control numbers and ipc.control commands in that case. Thankyou for the quick reply. Cheers Glenn.
  7. Hi Pete, Just a quick question. I understand how to call the pulldown items with their associated control number using the ipc.control(n) and ipc.control(n, param) from within a Lua script, but is there a way to call them by their descriptive pulldown name. For example if I wanted to call (Zoom In) and (Zoom Out) from Lua, Can I do something like ipc.macro("Zoom In") or ipc.macro("Zoom Out") I have tried this using the macro command but it doesn't seem to work, However it does not say in the manual that it would do that, I was just thinking that the pulldown items might have been like a macro in nature. Anyhow have I missed something or is the only way to do this via the ipc.control(n) command, It would be a nice feature to be able to call them from Lua by descriptive names. Regards Glenn.
  8. Cheers Pete, I will make good use of that. I'm having a ball with the lua scripting, it's truly amazing the possibilities it unleashes. Glenn.
  9. Thanks so much Pete, Truly OUTSTANDING support as always. Cheers Glenn.
  10. Thankyou for the reply Pete. I think it is well worth documenting. I have on a few occasions wanted to change the Text colour mid script to highlight a message. So going by your reply if I wanted a Red message for 10 Seconds then it would look like this: ipc.display("Test 123", 10) If I wanted a White Message for 10 Seconds then I would do this: ipc.display("Test 123", 16394) --(16384 + 10) I am not sure if it is possible but it would be really nice to have a flag that could set the colour in the display function. Something like: ipc.display("Test 123",0, 10) --Gives us Red for 10 Seconds ipc.display("Test 123",1, 10) --Gives us White for 10 Seconds If that’s not possible then its fine the other way. It certainly is beneficial to have with the display function I think. I know I have seen the question asked before about colour changes, so I am not the only one. Cheers Glenn.
  11. FSX Deluxe Ver. 10.0.61637.0 FSUIPC Ver. 4.90 Hi Pete, I use the ipc.display command extensively in my scripts. I have looked back through the forums and seen that controlling the colour of the presented text cannot be controlled via any script commands. I know we can change the colour of the text within the FSUIPC Miscellaneous TAB option “Non-Scrolling FS msgs to be white” and that this then makes all ipc.display messages white. That is all OK. However I have just found a little bug that may help you track down a way to switch from red to white programmatically. I only recently updated FSUIPC to Ver. 4.90 and have only just noticed this little issue. Prior to this I was on Ver. 4.86, I cannot tell you definitely whether 4.86 had the problem but I certainly did not notice it before. Anyhow, try these two commands: ipc.display("Test 123", 16383) (This one displays red) ipc.display("Test 123", 16384) (This one displays white) Also if the commands are used sequentially and alternatively you can then make the text flash the two alternate colours of red and white. Like So: ipc.display("Test 123", 16383) ipc.sleep(1000) ipc.display("Test 123", 16384) ipc.sleep(1000) ipc.display("Test 123", 16383) ipc.sleep(1000) ipc.display("Test 123", 16384) ipc.sleep(1000) And in case you are wanting to know why I would want to display a message for 16384 seconds. I don’t, it was a mistake I had made in one of my scripts thinking the delay was in milliseconds and I noticed the behaviour, so I thought I would track down the exact cut off figure for you. An interesting figure it is too !! Cheers Glenn.
  12. Testing here shows it to be now working PERFECTLY with 4859t Thankyou Pete, Just Outstanding support mate !! Cheers Glenn.
  13. Thats Great Pete, My suspicion is probably that it has never been reported as there just may be no other Addons for FS that use those Key Combinations. I will Download now and do some tests for you... Cheers Glenn.
  14. Hi Pete, Thanks for your time and response to the issue. This problem has been discussed in a few different threads over on the VRS boards and Chris Tracy(From the VRS Development team) asked if I could take a closer look at the problem here on your support forum due to the fact I had written Lua scripts to support their Key Command shortcuts. I only discovered what was really hapening the other night just by playing around on the actual Keyboard itself and then carrying out the same tests with NUMLOCK and my script, which also gave the same results. I also had to wait for some feedback from the other posters to confirm I was indeed on the right track before coming here, I didn't want to cause any further confusion to the thread. Anyhow after confirmation that it wasn't just happening with my script that's when I dropped in otherwise I would have done it sooner. It's not an extremely urgent matter as we now know the root of the problem and can deal with the NUMLOCK key as required but it would be great to have it fixed, nonetheless. I am happy to supply any info or testing that you require from this point, including logs and feedback, I obviously have the VRS SuperBug and TacPack here that the Key Codes in question can be tested on. So I will keep a close eye on this thread for you and carry out any requests that you make. I am in Australia so there is some time difference between you and me, so just keep that in mind. I am off to bed in the next hour or so.... Thanks Pete. Glenn.
  15. Hello Once again Pete, I will Jump in here as I think I now understand what the problem is that is being reported. I am really not sure if it can at all be fixed by changes in FSUIPC but maybe there could be some type of work around put together. First up , I am the Author of the "SuperScript_VRS" Lua script that has actually been posted in the user contributions forum and also known on the VRS Forums as Tripod, so thats how I am involved. The Script that I wrote for the VRS Superbug was written as a one stop shop to control all the switches and knobs in the aircraft, it also includes the full Keyboard Shortcut reference that is supplied by VRS. So in my script I have a list of "if ipcPARAM ==" statements that carry out the "ipc.keypress" commands that relate to their Key Command Shortcuts. I have found that the particular Key Codes that I am calling with reference to the FSUIPC for Advanced Users guide are being affected by the status of the NUMLOCK key and looking at the table I would have thought the NUMLOCK key would not have any affect. Here is a snippet from my script where the problem occurrs: --Radar Elev Up if ipcPARAM == 4003 then ipc.keypress (38,1) end --Radar Elev Down if ipcPARAM == 4004 then ipc.keypress (40,1) end --Radar Azm Left if ipcPARAM == 4005 then ipc.keypress (37,1) end --Radar Azm Right if ipcPARAM == 4006 then ipc.keypress (39,1) end [/CODE] So what is happening is that if the NUMLOCK is OFF the the SHIFT is recognised OK, but if the NUMLOCK is ON then the SHIFT is ignored completely. It's almost as though the Key Codes being used are for the Keys on the NUMBER PAD and not for the individual ARROW keys next to the PAD as I, and others have thought. I have confirmed with Georgefitz that he is not using my Lua script at all, but trying to use the key codes via Macro's and getting the same results. Are there any other Key Codes available for the Individual Arrow keys or are we stuck with this problem, or is there a way that we can programattically make sure NUMLOCK is in an OFF state when sending the Key Code and then return it to it's previous state. I would appreciate any help you can Provide, Thanks Pete. Regards Glenn.
  16. Thankyou Pete, I will investigate the com library functions as suggested and have little play around. Thankyou for your time. Cheers Glenn.
  17. Hi Pete, in relation to this topic, I also would like to somehow sync my switches automatically at startup. The only way I can currently see to do it is via a lua script that reads all button states on a device and then sets the virtual switch in the sim. Is there any possible way that lua could have some sort of a command to toggle a real switch, (by software), on a real device to trigger a "change" and then you would get a sync with the sim, as long as the switch was assigned discrete ON/OFF values for pressed and released and not a toggle function. Another way would be to maybe parse the FSUIPC.INI file and determine the switches that have assignments, then get their actual state from the device and then set the sim state to match...... Am I approaching that the right way ? This is something that's been bothering me and I am not sure the best way to handle it, there are quite a few switches to twiggle in a superhornet for which I have written a massive switch script for and I do think I need to address this somehow. I know I could make sure the switch positions match the sim at shutdown and will come back the same way but what about when I startup a different saved flight that may not be in sync, there must be a better way. I will look forward to any ideas that you could suggest. Thanks Glenn.
  18. Hi Everyone, I have made many changes to the original version of this script posted above, that was Version 1.0 It is now at Version 1.04 I have written a 30 page PDF User Manual with assignment examples including screen shots, the manual also contains a complete change log from version 1.00 to 1.04. I also have created a Parameter Map in a seperate PDF file to make switch assignments easier to lookup. Something unique I have introduced is the ability to use analogue AXIS' to control knobs in the VRS aircraft, in fact I have written a Knob script for every rotary type knob in the cockpit that calls on the main script to command knobs to discrete positions via L:Vars. The Knob scripts are event driven and contain full on screen diagnostic facilities to assist in setup. The Knob scripts also have error trapping built into them in cases where the user does not setup the predefined AXIS parameters for individual knobs correctly, all explained in the manual. I would eventually like to make the main script event driven too, so that it does not have to re-compile every time it is called, that will probably be the case in a future version and will make it all much more efficient but it works very well just the way it is at he moment. I feel it is a good example of just basic capabilities of lua scripting in FSUIPC and worth studying for anyone interested or starting out with lua scripts in FSUIPC, you should get a fairly good idea of how it works even if you do not have the VRS model because of the documentation I have written up. Here is some links for download, I am hosting the file on Google Drive and Dropbox as I was having some issues with Google Drive that seems to have cleared up now. Here http://bit.ly/SlEQIm Or Here http://bit.ly/VdnAFM Please let me know what you think. Cheers Glenn.
  19. Hi Pete, I just wanted to come back and finish of this thread and say thankyou for your guidance. It has actually taken me this long to get my head around event driven scripts, I must have read your answer here 50 times trying to make sense of it all but I think I have finally got a handle on functions & events and how to make it all work, for somebody that has never dealt with anything other than loop type programming and really I have not done a great deal of that either, it's a little hard get the brain into gear. However I think I have got now, I recently re-wrote an Annunciator script for the VRS Superbug that was originally a massive loop, I could see the problems starting to arise as the loop got bigger and bigger & it also handles Flashing lamps that really just pushed me over the edge, So I sat down and rebuilt the Annuciator script on events and functions after slowly understanding how they work. Then when I came back here I realised what you were trying to guide me to. So Here is what I ended up with, it is not an exact copy of what you coded for me. I didn't come to the forum to get code written for me, I just wanted some guidance and that you did VERY WELL, It's just the answer was over my head at the time. function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end function contrast(value) axis = value level = round (axis/53.84, 0) ipc.display ("Axis Value = "..axis.."\nLevel Value = "..level) ipc.sleep(100) ipc.runlua("SuperScript_VRS", (120 + level)) end event.param("contrast") [/CODE] It basically takes the Axis Value divides it into 20 ranges, rounds off the the calculation at the same time Throws the values on screen for verification Has a little sleep, just seems a little bit more stable with that there. Then calls my main script that has all the LVars etc. that turns the virtual knob. I do understand about putting the code from the main script into here but it seems to work fine like this so I am happy. Thankyou once again for your help. Glenn.
  20. Hi Sagal, Hi Pete, The script he is referring to is the exact same script I posted here in the user contributions forum named SuperScript_VRS.lua Just for you reference Pete, he was trying to assign the micro stick which was being recognized fine as an X and Y AXIS to the UP, DOWN, LEFT , RIGHT Arrow keys on the keyboard, this controls a radar cursor in the VRS superbug that designates targets, you basically move a little cursor around the screen up, down, left or right on the radar, put the cursor on top of the target you want and hit enter to designate and track/lock that target. My script simply calls ipc.keypress commands for those four functions, It looks like he had some crossed assignments with his AXIS or possible corruption, I got him to delete the FSUIPC.INI file, reset all the FSX assignments and start again and it now seems to be solved. P.S. I'm still having a ball with this LUA scripting, THANKYOU so much for the facility, I have been playing with annunciators now and I can't believe the things one can achieve. Cheers Glenn
  21. Dan, I came across the very same thing. I was trying to create a lot of macro's in the modules folder, the solution to my problem was to create a single lua script to handle all my needs. The maximum number of individual macros is 128, this was confirmed for me by Pete. See here: Regards Glenn.
  22. Thanks for your Reply Pete. Yes I thought events would be the better way to do it and I could see an event for buttons but not an event for axis in the manual. So I decided to try and detect the axis change using my long winded code. Is it possible to have an event for an Axis ? Yes, The axis is just a normal Joystick Axis and I did try assigning that way, however the knob that I am working with is on a panel only addressable via L:Vars and has 20 discrete values accross it's range, if I only assign 10 which is the maximum in the axis assignment panel I lose 50% resolution of the knob, sure it would still work though. The only reason I was testing in 10's was to stop the code from executing from axis jitter or a dirty potentiometer, I noticed if I tested for a change of only 1 & the axis value was jumping between two values as axis sometimes do, it was entering the loop constantly, which I didn't want. I ran a test using the value of 51 as you said but then when I turn the potentiometer slowly there is not enough change to trigger the code to enter the loop. I tried with a value of 5 & it seems quite sensitive enough, If the pot is jumping around greater than values of 5 then it's time for a new pot !! As I had already defined the 20 individual positions in my main script I thought I would just call them up from this script, I have already defined the L:Var & associated values for that L:Var & assigned each one (20 in total) a parrameter value in the main script, so I do not ever have to look them up again. Thankyou for taking the time, I will see if I can streamline it to be a little more efficient as you have suggested. Cheers Glenn.
  23. Hi Everyone, I Would just like a crosscheck on some code I have written to turn a brightness knob in the VRS superbug. The code works quite well, I am just not real efficient at programming & am wondering if anyone can comment on a more efficient way of doing the script. This script calls on my main LUA script that I wrote for the VRS superbug found in the User Contribution Area & screams around in a loop looking for an axis change. Something I would like to know is will this loop running at full speed have an impact on frames or Flightsim ? It doesnt seem to but, thought I would ask and this is only for a single brightness knob at this stage, I am planning quite a few more knobs. If I put any pauses in the loop then the action is not smooth when turning the pot. I would really appreciate any comments. Cheers Glenn. -- read initial values for axis and create variables Value1 = ipc.axis ("E", "S") Value2 = ipc.axis ("E", "S") -- Main loop looking for axis movement while 1 do -- read axis value for comparison Value1 = ipc.axis ("E", "S") -- test for axis change in either direction, change must be greater than 10 to be recognised if Value1 - Value2 > 10 or Value2 - Value1 > 10 then -- There are 20 Values for the knob position, here I have created 20 ranges & testing for each range if Value1> -1 and Value1<51 then ipc.runlua("SuperScript_VRS", 120) elseif Value1 > 51 and Value1 < 102 then ipc.runlua("SuperScript_VRS", 121) elseif Value1 > 102 and Value1 < 153 then ipc.runlua("SuperScript_VRS", 122) elseif Value1 > 153 and Value1 < 204 then ipc.runlua("SuperScript_VRS", 123) elseif Value1 > 204 and Value1 < 255 then ipc.runlua("SuperScript_VRS", 124) elseif Value1 > 255 and Value1 < 306 then ipc.runlua("SuperScript_VRS", 125) elseif Value1 > 306 and Value1 < 357 then ipc.runlua("SuperScript_VRS", 126) elseif Value1 > 357 and Value1 < 408 then ipc.runlua("SuperScript_VRS", 127) elseif Value1 > 408 and Value1 < 459 then ipc.runlua("SuperScript_VRS", 128) elseif Value1 > 459 and Value1 < 510 then ipc.runlua("SuperScript_VRS", 129) elseif Value1 > 510 and Value1 < 561 then ipc.runlua("SuperScript_VRS", 130) elseif Value1 > 561 and Value1 < 612 then ipc.runlua("SuperScript_VRS", 131) elseif Value1 > 612 and Value1 < 663 then ipc.runlua("SuperScript_VRS", 132) elseif Value1 > 663 and Value1 < 714 then ipc.runlua("SuperScript_VRS", 133) elseif Value1 > 714 and Value1 < 765 then ipc.runlua("SuperScript_VRS", 134) elseif Value1 > 765 and Value1 < 816 then ipc.runlua("SuperScript_VRS", 135) elseif Value1 > 816 and Value1 < 867 then ipc.runlua("SuperScript_VRS", 136) elseif Value1 > 867 and Value1 < 918 then ipc.runlua("SuperScript_VRS", 137) elseif Value1 > 918 and Value1 < 969 then ipc.runlua("SuperScript_VRS", 138) elseif Value1 > 969 and Value1 < 1024 then ipc.runlua("SuperScript_VRS", 139) end end -- read axis value for comparison Value2 = ipc.axis ("E", "S") -- Displaying values to screen for diagnostics here, normally this next line will be commented out ipc.display ("Value1="..Value1.."\nValue2="..Value2) end [/CODE]
  24. Hello Everybody. Here is my LUA script I have put together that will give you access to every switch, knob and button in the VRS F/A-18E for FSX. This is my first attempt at LUA scripting, I am no programmer by any means, I simply studied alot of the fine examples here on the contribution forum & worked it out from there. Thankyou everyone for your examples & so here is my little contribution to help out others. One thing I have realised is that the LUA plugin feature available now in FSUIPC is extremely powerful, it is open to all sorts of possibilities limited only by the imagination & your programming skills, I feel I have made an incredible discovery. I used LINDA to assist with tracking down & confirming which L:Vars to work with. The script utilises a mixture of L:Vars, FSUIPC offsets, FSUIPC Controls & Keypresses to get the job done. It could probably be written a little more efficiently using IF, THEN, ELSE Statements but I wanted to define each and every switch position to an FSUIPC parameter value, so I strictly used just IF statements for all switch positions. A rather simple approach but it seems to get the job done, so I am happy !! You will find full instructions commented into the script itself, I have referenced a PDF file in the instructions which does not exitst at this point. I will eventually create a PDF file with some screenies that will demonstrate how to assign switches for those not aware of how to do it, but for most users familiar with FSUIPC my commented instructions will get you going. Cheers Glenn. SuperScript_VRS.zip
  25. No worries, thanks for the answers Pete. Regards Glenn
×
×
  • 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.