KAPTEJNLN Posted July 29, 2011 Report Posted July 29, 2011 well isent it posible to use offsets like whit the lvars for increase or decrease speed, like i did for captainsim 757 whit lvars for the display where it ad 1 to the speed shown on the MCP in this case: LVarSet = "L:MCP_IAS_DSP" LVarGet = ipc.readLvar(LVarSet) + 1 end ipc.writeLvar(LVarSet, LVarGet) ---------------------------------------------------------------------------------------- it might be the same way it is set up but what should be used insted of LVarSet and LVarGet ? as far as i would think it woul be something like this but missing what there should be set infront of SET or GET: ????Set = "0x01f5" ----------------------- or should it be "01f5" ????Get = ipc.readUD(????Set) + 1 end ipc.writeLvar(????Set, ????Get)
Pete Dowson Posted July 29, 2011 Report Posted July 29, 2011 well isent it posible to use offsets like whit the lvars for increase or decrease speed If you know the offset and the format of the value, then, yes of course. There's a whole range of ipc.read and ipc.write functions for different offset types. But take case, as not all offsets can be written to. it might be the same way it is set up but what should be used insted of LVarSet and LVarGet ? as far as i would think it woul be something like this but missing what there should be set infront of SET or GET: Nothing! There is no "Set" or "Get"! The offset is needed in hexadecimal (i.e. in the format 0x????, where ???? is the offset). If you do not know the offset, you cannot use it. Obviously. The word "offset" really just means "distance from" or "set off by", and represents the original number of bytes from the Global Base in FS's variables in memory, part of its "GLOBALS.DLL". So, an offset of 0x0020 (which is the same as decimal 32) is referring to some value which starts 32 bytes from the start of all the "Global" variables. So, you now understand that an offset is a number. It is almost always expressed in hexadecimal, not decimal, and the documentation lists them that way. The system of offsets for access to FS variables started in FS95 and FS98. When I introduced FSUIPC for FS2000 I continued this, although by then it was already an illusion, a fiction made to keep compatibility. These days the term is still used and they are still numbers, but there is no "Globals.DLL" in FS and the values are not really all in memory together. FSUIPC gathers them from wherever they are, on demand. Regards Pete
KAPTEJNLN Posted July 29, 2011 Author Report Posted July 29, 2011 ok when it looks like this in the log: 135268 *** EVENT: Cntrl= 66037 (0x000101f5), Param= 140 (0x0000008c) AP_SPD_VAR_SET so i have to just type the ipc.writeUD(0x01f5) as isent the offset the 4 last decimas in the code above, (Cntrl=66037 (0x000101f5)) ? but then i just woundering about how get it changes the vaulve so i add 1 every time i use the command. EX. hdg 123 when i then press the button it should add 1 so my display changes to 124 and the othere way if it was a decrease button. isent it right observed that in the code: 135268 *** EVENT: Cntrl= 66037 (0x000101f5), Param= 140 (0x0000008c) AP_SPD_VAR_SET the first part is the offset code and the next part is prarmeter so if set 008c it would show 140 inside the plane which means i stil miss some thing that caculate the new parameter? when it adds 1 it should set a new hexidecimal as parameter to show the new HDG right?
Pete Dowson Posted July 29, 2011 Report Posted July 29, 2011 135268 *** EVENT: Cntrl= 66037 (0x000101f5), Param= 140 (0x0000008c) AP_SPD_VAR_SET so i have to just type the ipc.writeUD(0x01f5) as isent the offset the 4 last decimas in the code above, (Cntrl=66037 (0x000101f5)) ? Oh dear. No no no! Where do you get these strange ideas from? There is nothing whatsoever about offsets in that log line. That is logging an EVENT in FS -- a control. The "Ap spd var set" control is one listed in the assignments dropdowns for buttons and keys. It is number 66037 (same as hex 0x101F5), as you can see in the list of FS controls installed in your FSUIPC Documents folders. You cannot get offset details like that. You have to look them up in the offset tables which are provided in documents provided in the FSUIPC SDK, for FS, and in other documents for other add-on programs like Project Magenta and Sim-Avioincs and FlightDeck software, and so on. the first part is the offset code and the next part is prarmeter so if set 008c it would show 140 inside the plane No, the first is the control or event number. it is absolutely nothing to do with offsets, nothing at all. How do you even think that? Microsoft called them Events in its user documentation but Controls inside, hence the "CONTROLS.DLL" which is the part of FS which deals with decoding them and passing them on to the right bit of FS. Offsets are addresses of values in memory. Events are things that should happen, sent from one place (as a result of a button or mouse click) to another (like FS's sim engine or a gauge). Offsets represent data. Events and controls represent actions. See? Even the concept is completely different. It's like comparing apples to eating. One is a thing the other is an action! Pete
KAPTEJNLN Posted July 29, 2011 Author Report Posted July 29, 2011 well the reason i think it was those to codes was that 66037 was 101F5 in hexi and from the other codes i saw it was only 4 destimals so i removed the first, and the next was the parameter then it shows that parameter as hexi as i think it was matehematic, but that was dead end as you say. But i realy cant find the offset for it in the sdk dokument i can finde Ap spd var set (66037) in the dokument that was instaled together whit FSUIPC, but not in the offset manual from the SDK. the closes i could fing might be: Autopilot airspeed value, in knots which is about ap airspeed in knots, and seems to work is that good enough ?
Pete Dowson Posted July 29, 2011 Report Posted July 29, 2011 But i realy cant find the offset for it in the sdk dokument i can finde Ap spd var set (66037) in the dokument that was instaled together whit FSUIPC, but not in the offset manual from the SDK. There is NOT necessarily any correspondence at all between an event and a alue in FS in any case, and they certainly won't follow the weird names that Microsoft adopted for the events, like "AP spd var set". You need to apply a bit of intelligence and think about what value it is you are looking for. In this case it is to do with the Autopilot, right? So, search for the word Autopilot. the closes i could fing might be: Autopilot airspeed value, in knots which is about ap airspeed in knots And isn't the autopilot airspeed value in knots the thing that the control "ap spd var set" would set? What else do you think it might be? How many airspeed values do you think the autopilot has? Pete
KAPTEJNLN Posted July 29, 2011 Author Report Posted July 29, 2011 it seems to be 07E2 Autopilot airspeed value, in knots as i tested it by set it to the display and it shows it corectly and when button is rotated inside the plane the display follows it. now i miss how to use a button whit that offset to get it increase in crease the vaulve. as it might be a parameter thing right? as test i assigned a button whit the name AP spd var set and set parameter to 100 when pressed it turns to 100. and how to get it show the right on the display as only speed is shown right as some you should use math as for HDG:07CC Autopilot heading value, as degrees*65536/360 does that mean like for the captainsim: hdg = math.floor(ipc.readUD(0X07CC) * 65536) / 360
Pete Dowson Posted July 29, 2011 Report Posted July 29, 2011 it seems to be 07E2 Autopilot airspeed value, in knots Well, since that's exactly what it says in the document, I suspect that's a good guess! ;-) now i miss how to use a button whit that offset to get it increase in crease the vaulve. as it might be a parameter thing right? The controls for AP speed can be found by clicking the airspeed up and down on the autopilot speed adjust knob whilst logging Events. I think you'll find they are named AP SPD VAR INC and AP SPD VAR DEC. Why don't you just look through the list? You already knew about AP SPD VAR SET. It wouldn't have been too hard to look for yourself, would it? and how to get it show the right on the display as only speed is shown right as some you should use math as for HDG:07CC Autopilot heading value, as degrees*65536/360 does that mean like for the captainsim: hdg = math.floor(ipc.readUD(0X07CC) * 65536) / 360 Why on Earth do you want to do such computations? It says it's in knots! What sort of speed value do you want, kilometers per hour? What's wrong with knots, that's what pilots use after all! Why not just accept it? Pete
KAPTEJNLN Posted July 30, 2011 Author Report Posted July 30, 2011 about: The controls for AP speed can be found by clicking the airspeed up and down on the autopilot speed adjust knob whilst logging Events. I think you'll find they are named AP SPD VAR INC and AP SPD VAR DEC. I have been throu that but it dosent include or any othere: AP SPD VAR INC or AP SPD VAR DEC as then it was easy but they are not there as i can see only: AP SPD VAR SET is there. no other for speed or something close to that About: Why on Earth do you want to do such computations? It says it's in knots! What sort of speed value do you want, kilometers per hour? What's wrong with knots, that's what pilots use after all! Why not just accept it? well no problem at spd display i was talking of heading. altitude also dont show right. as lets say heading in the plane shows 130 but on the mcp-pro i get a reading of 236.
Pete Dowson Posted July 30, 2011 Report Posted July 30, 2011 I have been throu that but it dosent include or any othere: AP SPD VAR INC or AP SPD VAR DEC as then it was easy but they are not there as i can see only: AP SPD VAR SET is there. no other for speed or something close to that Where are you looking? The INC and DEC controls are listed in the List of Controls installed in your FSUIPC Documents folder. They appear in the Buttons and Keys assignments dropdowns. You can send them from a Lua program by using the ipc.control function, with the control number as listed in the List of controls document. Well no problem at spd display i was talking of heading. altitude also dont show right. as lets say heading in the plane shows 130 but on the mcp-pro i get a reading of 236. Oh, heading. Yes, but not math.floor(ipc.readUD(0X07CC) * 65536 / 360) which converts degrees into FS units, obviously (360 degrees --> 65536 units). To convert the other way around it's the reverse, math.floor(ipc.readUD(0X07CC) * 360 / 65536) Don't you see? The value is documented as being the number of degrees x 65536 / 360, so to convert it to degrees you have to do the reverse, x 360 / 65536. Please do read the documentation more carefully. You are rushing along so fast you don't read things correctly. You might want to round it to the nearest integer, not round it down, so you'd need to add a half too, so: math.floor( (ipc.readUD(0X07CC) * 360 / 65536) + 0.5) Pete
KAPTEJNLN Posted July 30, 2011 Author Report Posted July 30, 2011 so for the Altitude there is noted Autopilot altitude value, as metres*65536 so now the reading is in meters as the reading was 3048 which is 3000 ft so by reversing the code it should give feet. Then it shiuld be reverse by say devide insted of multiply as the line say above: math.floor( (ipc.readUD(0X07D4) / 65536) ) but i might still miss some thing as it dosent show it right yet i also try as you say for the other by ad 0.5: math.floor( (ipc.readUD(0X07D4) / 65536) + 0.5) and about: Where are you looking? The INC and DEC controls are listed in the List of Controls installed in your FSUIPC Documents folder. They appear in the Buttons and Keys assignments dropdowns. You can send them from a Lua program by using the ipc.control function, with the control number as listed in the List of controls document. i have tryeid to assigne a button to the increase by selecting from drop down menu but nothing happens when i do so, or it would say it seems to changes on my mcp pro the first time you try after i hve assigned the button but becaus it dosent update in the plane it jumps back right after (in a split sec nerly not viseble to se the changes on the goflight mcp-pro so....
Pete Dowson Posted July 30, 2011 Report Posted July 30, 2011 so for the Altitude there is noted Autopilot altitude value, as metres*65536 Then it shiuld be reverse by say devide insted of multiply as the line say above: math.floor( (ipc.readUD(0X07D4) / 65536) ) but i might still miss some thing as it dosent show it right yet i also try as you say for the other by ad 0.5: math.floor( (ipc.readUD(0X07D4) / 65536) + 0.5) Yes, correct, but don't forget it is metres. If you want feet you need to convert it from metres, so math.floor( (ipc.readUD(0X07D4) * 3.28084 / 65536) + 0.5) because there are 3.28084 feet in a metre. i have tryeid to assigne a button to the increase by selecting from drop down menu but nothing happens when i do so, or it would say it seems to changes on my mcp pro the first time you try after i hve assigned the button but becaus it dosent update in the plane it jumps back right after (in a split sec nerly not viseble to se the changes on the goflight mcp-pro so.... So you have something else writing the MCP altitude? Those controls work perfectly with the FS 737. What aircraft is it? What simulator? Is this the "SimCheck A300B4-200" in your title? Does that use the default FS MCP? For the FS MCP test your work with a default aircraft first. Then if it doesn't work on an add-on you know they are doing something different. Log events in FSUIPC so you can see what happens? Pete
KAPTEJNLN Posted July 30, 2011 Author Report Posted July 30, 2011 You was faster then mee to type i just found by try 3.3 and it worked as i was tryeing to find the caculation so now i think i start to get the way it works as you say the meters from the offset code then you multiply to get it to feets thats logic yes. sorry my slow understanding
KAPTEJNLN Posted July 30, 2011 Author Report Posted July 30, 2011 ok i testet this in the default plane to see if it was becaus off the add-on but the same happend to the default plane by using vertical speed: 07F2 Autopilot vertical speed value, as ft/min it works as long as it is + but when it gets - it jumps to some thing diferent. -100 was shown on the Goflight mcp-pro as 65436 im just woundering why, should i make a calculation when it gets into - ?
Pete Dowson Posted July 30, 2011 Report Posted July 30, 2011 ok i testet this in the default plane to see if it was becaus off the add-on but the same happend to the default plane by using vertical speed: 07F2 Autopilot vertical speed value, as ft/min it works as long as it is + but when it gets - it jumps to some thing diferent. -100 was shown on the Goflight mcp-pro as 65436 im just woundering why, should i make a calculation when it gets into - ? Sorry, I don't understand much of that. I've no idea what you are doing with V/S. You were saying the FS AP Altitude INC/DEC controls didn't work. They certainly do here, and always have. else you have a corrpted FS and should consider reinstalling. Pete
KAPTEJNLN Posted July 30, 2011 Author Report Posted July 30, 2011 my fault it was for the display and by using the button inside the vc it show at the display the right ft when it is above -. so +100 +200 and so on works but when it should show VS as -100 it show 65436 on the goflight device it show it right inside the plane but not on my gf device when it is below 0000ft i have also tryeid whit math.floor( (ipc.readUD(0X07F2) * 3.28084 / 65536) + 0.5) but dident work as i saw that in anothere ex so i use the 3.28084
Pete Dowson Posted July 30, 2011 Report Posted July 30, 2011 i have also tryeid whit math.floor( (ipc.readUD(0X07F2) * 3.28084 / 65536) + 0.5) but dident work as i saw that in anothere ex so i use the 3.28084 Everything is wrong there. Please, you are still not thinking at all. Look: ipc.readUD(0X07F2) is reading the value as Unsigned! That's what the "U" stands for! The VS can be negative,, so it is Signed! You need SD not UD! also ipc.readUD(0X07F2) is reading a DWORD, 32-bits or 4 bytes for the value, but 07F2 is clearly documented as being 2 bytes, or 16 bits or a WORD. So you need SW not UD! Please do READ what it says and apply a little intelligence to the way you read it. Next: it clearly says it is supplied in feet per minute. It says nothing about metres, nor about being 65536 times the value. It is just the number you want, so you need no conversion! Why don't you see that? In the end it is simply ipc.readSW(0X07F2) why oh why do you make such simple things so complicated? Please slow down and THINK what you are doing. Having to correct every little thing you do is taking a lot of my time and I've really not got so much patience. I did say I'd not do any more -- I shall have to stick to my promise soon! Pete
KAPTEJNLN Posted July 30, 2011 Author Report Posted July 30, 2011 sorry pete i take all your time, i know im not the best guy for this, i realy try to understand and yes in the end you have the magic word. i just realy try to find out of the things so you dont need to help and i realy hope that whit the 737 NGX i can manege to do it by my own. the plane i did the past here was some experimental ones where i released the captainsim and pmdg j41 not for my own joy as i dont fly captainsim anymore but realy wanted to give other people the option, as i know how it was for my self some years ago. having hardware but could use it for more then the default plane and level-d. so it might be it for now, but 1 very nice thing by the codes here made it posible for me to create the display for all the displays for the default plane which i am sure could be used or should i say i know it works whit the iFly whitch is realy nice as that is a plane i fly until the pmdg 737 NGX. but due to the bug in the gf software the ifly 737 dosent work that good. now whit the displays here i can get rid of that bug whit lag on the displays, as i already tested it so might upload when done whit the files. so Pete your work is more then appreciated. and that´s also why i want to stop now whit the A300 as i realy want the abilety to ask you when the NGX gets out as that have my bigest priority, if we are gone be able to do some files for it. and yes i know there would be an sdk but i realy wants it to work throu your program as there is no lag as whit the gf driver together wit level D and ifly so far. so i dont hope you think your time have been waisted i just want to keep an helping hand when it is realy neaded. so another sorry pete for my low level of knolege.
Pete Dowson Posted July 30, 2011 Report Posted July 30, 2011 i just realy try to find out of the things so you dont need to help and i realy hope that whit the 737 NGX i can manege to do it by my own. Phew! From what I've seen of the PMDG 737NGX (I assume you mean that, not the iFly?), it is extremely comprehensive. There will be hundreds if not thousands of switch and dial actions, and I doubt that all that many will be accessible for hardware interfacing. It is not PMDG's way. If they do produce an SDK for it, that may be the only way. I might get the PMDG 737NGX, not for interfacing to my cockpit (it will most certainly not be possible), but because it would probably make a good learning aid for all the ins and outs and interactions between all the switches and controls -- especially those lesser parts of the overhead which don't generally get simulated. I already have the PMDG editions of the Boeing manuals, which I purchased last year when they came out. sorry pete for my low level of knolege. it isn't knowledge that is the problem. That can be obtained as needed by referring to documents and asking normal questions. And that's fair. I think the only problem you and I have here is that you don't seem to use much logical thought to move from one thing to another. It is thinking about what to do which would help, rather than rushing into things without thinking. I do think you'll be fine if you slow yourself down and think more carefully about things before writing code. Regards Pete
KAPTEJNLN Posted July 31, 2011 Author Report Posted July 31, 2011 well what i ment whit iFly 737 was i could use the codes from yesterday, to replace the interface from gfdriver as there is some lag which is a down side, could be seen here in the end of the film, then i think you know what i mean(i fly option was set to CRS2 so thats the lag when you normaly select ifly in the dropdown menu of goflight software): As the default variables works but whit the version 2.01 and 2.02 they made a error to the altitude and vertical speed. so i could tweak the goflight cfg file to use a mix of default and ifly commands. so this file from yesterday fix that, i just fogot the mach but would try get that working as then i know some people there would be happy :wink:
KAPTEJNLN Posted July 31, 2011 Author Report Posted July 31, 2011 well should it also look like this for a display when using the offset: stringMach = string.format("%01.2f", Mach) becaus when i try use it it dosent work whit destimals after the dot (.00) as 1.00 is shown and 2.00 when it is displayed in the plane but the 00 dosent move so i was thinking if it should be becaus F should be replaced? as logicaly when the code look like: "%01.2f" i would mean that since the first part works it might be right so far: %01. but some thing in the last part needs to be changesed
KAPTEJNLN Posted July 31, 2011 Author Report Posted July 31, 2011 the reason i ask was this part of a post you gave: f says the number is in floating point form (all numbers in Lua are floating point, but can be uses as integers too, losing the fraction). But what for the offset ?
Pete Dowson Posted July 31, 2011 Report Posted July 31, 2011 f says the number is in floating point form (all numbers in Lua are floating point, but can be uses as integers too, losing the fraction).Correct.but what for the offset ? Sorry? This question seems to have no meaning. what offset where? Please, if you are going to ask a question, supply more relevant information. Pete
KAPTEJNLN Posted July 31, 2011 Author Report Posted July 31, 2011 Here is the code i was refering to (this works but whit out("%01.2f", Mach) as i tryeid your other option to test if i did it right) but miss the 0.00 as now it is shown whit out the . Mach = math.floor( (ipc.readUD(0X07E8) / 655.36) + 0.5) if (Mach ~= prevMach) then stringMach = string.format("%03d", Mach) gfd.setDisplay(GFMCPPRO,0,1,stringMach) prevMach = Mach end It have some looks at the explanation you gave the other day and tryeid to edit the part f but i dont know to what i understand that that 2 is = 2 signs but is there any difference whit this when i use it whit offsets for the mach any changes there should be made in order to work: ("%01.2f", Mach)?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now