Jump to content
The simFlight Network Forums

BoXon

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by BoXon

  1. Sorry, I don't know about the mismatch (doesn't the compiler or debugger even tell you which line or variable has such a mismatch?), but your code is really enormously inefficient! Why are you calling FS for each little item of data separately? Please do all the FSUIPC_Reads, then one FSUIPC_Process at the end. The reads and writes cost nothing in PC terms, but every process call is swapping to Flight Sim, processing your requests, then swapping back to you. That's really dreadful! :-( The whole point of separating the actual request to FS from all the individual items is to enable you to write efficient programs. Think of the Reads and Writes being your shopping list, with the Process call being the check-out. Pete I agree, the code is not best... :roll: I have removed some Process calls now as you see bellow. :wink: Do you meen like this? Dim fuel_l_lvl, fuel_l_cap, fuel_w As Long Call FSUIPC_Read(&HB7C, 4, VarPtr(fuel_l_lvl), dwResult) Call FSUIPC_Read(&HB80, 4, VarPtr(fuel_l_cap), dwResult) Call FSUIPC_Read(&HAF4, 2, VarPtr(fuel_w), dwResult) Call FSUIPC_Process(dwResult) Dim fuel_left As Long fuel_left = fuel_l_cap * ((fuel_l_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924 ' Fuel on board --> Center tank Dim fuel_c_lvl, fuel_c_cap As Long Call FSUIPC_Read(&HB74, 4, VarPtr(fuel_c_lvl), dwResult) Call FSUIPC_Read(&HB78, 4, VarPtr(fuel_c_cap), dwResult) Call FSUIPC_Process(dwResult) Dim fuel_center As Long fuel_center = fuel_c_cap * ((fuel_c_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924 ' Fuel on board --> Right tank Dim fuel_r_lvl, fuel_r_cap As Long Call FSUIPC_Read(&HB94, 4, VarPtr(fuel_r_lvl), dwResult) Call FSUIPC_Read(&HB98, 4, VarPtr(fuel_r_cap), dwResult) Call FSUIPC_Process(dwResult) Dim fuel_right As Long fuel_right = fuel_r_cap * ((fuel_r_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924 But i'm still getting the same error... :(
  2. Hi! I'm trying to read the fuel in my aircaft, but i'm getting the error "Type missmatch". I cannot find anything wrong in the code, can anybody help? :? Dim dwResult As Long Dim fuel_l_lvl, fuel_l_cap, fuel_w As Long Call FSUIPC_Read(&HB7C, 4, VarPtr(fuel_l_lvl), dwResult) Call FSUIPC_Process(dwResult) Call FSUIPC_Read(&HB80, 4, VarPtr(fuel_l_cap), dwResult) Call FSUIPC_Process(dwResult) Call FSUIPC_Read(&HAF4, 2, VarPtr(fuel_w), dwResult) Call FSUIPC_Process(dwResult) Dim fuel_left As Long fuel_left = fuel_l_cap * ((fuel_l_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924 ' Fuel on board --> Center tank Dim fuel_c_lvl, fuel_c_cap As Long Call FSUIPC_Read(&HB74, 4, VarPtr(fuel_c_lvl), dwResult) Call FSUIPC_Process(dwResult) Call FSUIPC_Read(&HB78, 4, VarPtr(fuel_c_cap), dwResult) Call FSUIPC_Process(dwResult) Dim fuel_center As Long fuel_center = fuel_c_cap * ((fuel_c_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924 ' Fuel on board --> Right tank Dim fuel_r_lvl, fuel_r_cap As Long Call FSUIPC_Read(&HB94, 4, VarPtr(fuel_r_lvl), dwResult) Call FSUIPC_Process(dwResult) Call FSUIPC_Read(&HB98, 4, VarPtr(fuel_r_cap), dwResult) Call FSUIPC_Process(dwResult) Dim fuel_right As Long fuel_right = fuel_r_cap * ((fuel_r_lvl * 100 / (128 * 65536)) / 100) * (fuel_w / 256) * 0.4535924
  3. I don't know VB at all. sorry. Is the correct hexadecimal format "&0AEC" or "$0AEC", or even "&H0AEC"? Seems different in different reports. You need to check the VB reference manuals I think. Pete Thank you too! :)
  4. Thank you very much! :D
  5. Hi! I'm new at VB, so this probkem may be very easy. :D But, what i'm trying to do is to get the numbers of engines at the aircraft. But when i try to make the EXE or testdrive the program i get "Complie error: Expected: list separator or )"! Private Sub Command1_Click() Dim numbersOfEng As Long Dim dwResult As Long Call FSUIPC_Read(&0AEC, 2, VarPtr(numbersOfEng), dwResult) Call FSUIPC_Process(dwResult) lblnumbersOfEng.Caption = numbersOfEng End Sub It seems like it don't liek the "AEC" part in the FSUIPC_Read(). What to do about it?
×
×
  • 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.