Emanuele Posted June 21, 2015 Report Share Posted June 21, 2015 Hi Paul, I write to you because i'm not able to understand how works payloads' function on new DLL. I read this ' Get a reference to save so much typing...Dim ps As PayloadServices = FSUIPCConnection.PayloadServices ' Get the latest data from FSUIPC ps.RefreshData() But in my development PC i haven't FSX and FSUIPC. FSX runs in another one PC. So, how can i test the program in development status? Continuing reading, i see this: You also have access to the individual payload stations and fuel tanks. Here is an example of iterating through each payload station. ' Go through each station and get the name and weightFor Each (payloadStation As FsPayloadStation In ps.PayloadStations)Dim name As String = payloadStation.NameDim weight As Double = payloadStation.WeightLbsNext payloadStation So I don't understand how DLL can get the name payload stations using this cycle. Probably it's a my mind fault... i'm so confusing because i'll works with 16 payloads stations and for each one i'll have a precise wheight to load station_load.0 ="0, 16.6853104911779, 0.0, 0.0, Cabin 0A" station_load.1 ="0, -1.12441769194083, 0.0, 0.0, Cabin 0B" station_load.2 ="0, -19.4743461611827, 0.0, 0.0, Cabin 0C" station_load.3 ="0, 19.1162117787317, 0.0, 0.0, cargo11" station_load.4 ="0, 14.5385770624704, 0.0, 0.0, cargo12" station_load.5 ="0, -8.29051211254223, 0.0, 0.0, cargo41" station_load.6 ="0, -14.5070357176912, 0.0, 0.0, cargo42" station_load.7 ="0, -22.8196489747242, 0.0, 0.0, cargo51" station_load.8 ="0, 35.2358280372542, 0.0, 0.0, Pilot/copilot" station_load.9 ="0, 32.9187924962841, 0.0, 0.0, Trainers" station_load.10 ="0, 28.5715924813225, 0.0, 0.0, Crew1" station_load.11 ="0, -28.074409744078, 0.0, 0.0, Crew2" station_load.12 ="0, -31.4506615323471, 0.0, 0.0, Crew3" station_load.13 ="0, 28.9467315689077, 0.0, 0.0, Crew4" station_load.14 ="0, 4.93782996344077, 0.0, 0.0, PantryA" station_load.15 ="0, -15.9676482810941, 0.0, 0.0, PantryB" Finally, what are the differences between Process() and WriteChanges() Thank for your help, regards Emanuele Link to comment Share on other sites More sharing options...
Paul Henty Posted June 21, 2015 Report Share Posted June 21, 2015 But in my development PC i haven't FSX and FSUIPC. FSX runs in another one PC. So, how can i test the program in development status? You need to have FSX running on the same PC. Or, if you have a WideFS licence, you can run WideClient.exe instead. This will connect to the FSX computer and is a tiny program compared to FSX. So I don't understand how DLL can get the name payload stations using this cycle You cannot get a payload station by name because Flight Sim allows duplicate names for payload stations. For example the stock Cessna C172 has two payload stations called 'Rear Passenger'. If you want to load (update) all the payload stations at once, use a 'select' statement. This example loads the station weights from text boxes on the form. I've only shown two stations to keep it short. Dim ps As PayloadServices = FSUIPCConnection.PayloadServices ps.RefreshData() For Each payloadStation As FsPayloadStation In ps.PayloadStations Select Case payloadStation.Name Case "Cabin 0A" payloadStation.WeightKgs = txtCabinA.Text Case "Crew1" payloadStation.WeightKgs = txtCrew1.Text End Select Dim weight As Double = payloadStation.WeightLbs Next payloadStation ps.WriteChanges() If you want to access payload stations individually then you use the index, not the name. This example updates the Crew1 station - the index of this station is 10: station_load.10 ="0, 28.5715924813225, 0.0, 0.0, Crew1" ps.RefreshData() ps.PayloadStations(10).WeightKgs = txtCrew1.Text ps.WriteChanges() Finally, what are the differences between Process() and WriteChanges() Process() is on the FSUIPCConnection class. This will read or write the data in all the offsets you have declared in your application. It does nothing for PayloadServices. WriteChanges() is on the PayloadServices() class. This will write any changed to payload information you have made. It does not write any offsets you have declared. When you use PayloadServices you don't need to use Process(). Paul Link to comment Share on other sites More sharing options...
Emanuele Posted June 23, 2015 Author Report Share Posted June 23, 2015 Thanksssssssssssssssssssssssssss! Emanuele Link to comment Share on other sites More sharing options...
Emanuele Posted June 25, 2015 Author Report Share Posted June 25, 2015 Paul, one question: during ps.RefreshData() ps.PayloadStations(10).WeightKgs = txtCrew1.Text ps.WriteChanges() the connection must be open? Thanks Link to comment Share on other sites More sharing options...
Paul Henty Posted June 25, 2015 Report Share Posted June 25, 2015 Yes you need an open connection. Paul Link to comment Share on other sites More sharing options...
Emanuele Posted June 25, 2015 Author Report Share Posted June 25, 2015 Yes you need an open connection. Paul ok thanks Link to comment Share on other sites More sharing options...
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