Changeset 32:22525b9438b5 in xplra for test
- Timestamp:
- 02/09/13 10:28:16 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/basictest.py
r31 r32 51 51 print "Querying the aircraft's description as a string, with an offset of 3..." 52 52 result2 = xplane.getString("sim/aircraft/view/acf_descrip", offset = 3); 53 print "Got: '" + result2 + "'" 53 print "Got: '" + result2 + "' (" + `len(result2)` + ")" 54 print result2=="h 8 Q400" 54 55 print 55 56 … … 64 65 print 65 66 67 print "Setting the number of the engines to", numEngines + 1 68 xplane.setInt("sim/aircraft/engine/acf_num_engines", numEngines + 1) 69 numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines") 70 print "The new number of engines:", numEngines 71 print 72 73 acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up") 74 print "Setting the aircraft elevator up control from %f to %f..." % \ 75 (acfElevUp, acfElevUp + 15.0) 76 xplane.setFloat("sim/aircraft/controls/acf_elev_up", acfElevUp + 15.0) 77 acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up") 78 print "The aircraft elevator up control set to", acfElevUp 79 print 80 81 localX = xplane.getDouble("sim/flightmodel/position/local_x") 82 print "Setting the aircraft's local X-coordinate from %f to %f..." % \ 83 (localX, localX + 15.0) 84 xplane.setDouble("sim/flightmodel/position/local_x", localX + 15.0) 85 localX = xplane.getDouble("sim/flightmodel/position/local_x") 86 print "The aircraft's local X-coordinate set to", localX 87 print 88 89 numBlades = xplane.getFloatArray("sim/aircraft/prop/acf_num_blades").tolist() 90 print "Setting the number of blades" 91 print " from:", numBlades 92 numBlades = [n+2.5 for n in numBlades] 93 print " to:", numBlades 94 xplane.setFloatArray("sim/aircraft/prop/acf_num_blades", numBlades) 95 96 numBlades = xplane.getFloatArray("sim/aircraft/prop/acf_num_blades").tolist() 97 print "The result:", numBlades 98 print 99 100 batteryArrayOn = xplane.getIntArray("sim/cockpit/electrical/battery_array_on").tolist() 101 print "Setting the batteries" 102 print " from:", batteryArrayOn 103 batteryArrayOn = [1 if b==0 else 0 for b in batteryArrayOn] 104 print " to:", batteryArrayOn 105 xplane.setIntArray("sim/cockpit/electrical/battery_array_on", batteryArrayOn) 106 batteryArrayOn = xplane.getIntArray("sim/cockpit/electrical/battery_array_on").tolist() 107 print "The result:", batteryArrayOn 108 print 109 110 tailNum = [0] * 40 111 tailNum[0] = ord('H') 112 tailNum[1] = ord('A') 113 tailNum[2] = ord('-') 114 tailNum[3] = ord('V') 115 tailNum[4] = ord('A') 116 tailNum[5] = ord('I') 117 118 print "Setting the tail number to %s as a byte array..." % (tailNum,) 119 xplane.setByteArray("sim/aircraft/view/acf_tailnum", tailNum) 120 print "The tail number is:", xplane.getString("sim/aircraft/view/acf_tailnum") 121 print 122 123 tailNum1 = "VAIS" 124 print "Setting the tail number to " + tailNum1 + " as a string..." 125 xplane.setString("sim/aircraft/view/acf_tailnum", tailNum1, 40) 126 print "The tail number is:", xplane.getString("sim/aircraft/view/acf_tailnum") 127 print 128 129 66 130 except Exception as e: 67 131 print ">>>>>>>>>>>>>>>>>>>>>> Exception caught:", str(e)
Note:
See TracChangeset
for help on using the changeset viewer.