View Full Version : Need some help :)
VFS-22_SPaRX
26th May 2004, 04:51 AM
So i am sitting here awaiting my shiny new Throttle Quad that i pre-ordered and thought that i might get some help with some of the scripting ideas i have been thinking about. I am not quite sure how to code these in, so i figured i would come to the scripting gurus :bye: I fly primarily IL2 Aces.
First one:
I want to assign button strokes to particular positions on one of the throttle axis. I want to use this for differnt mixture settings. I understand that i can create a line that says something to this effect
if js2.a5 = 200 (axis value for a dedent)
then cms.b1 = True
Then i can assign a key stroke to cms.b1 in the map. But doing it this way, it will continually keep cms.b1 active until i move the axis from that position, just as if i was holding down a key on my keyboard. So how do i set it to just send a single keystoke when i enter the dedent?
Second one:
I want to thru cms create a quasi dual throttle control for teh P38 in il2. My idea is to assign two of the TQ axis to control a single cms axis. Lets say for this example that js2.a1 and js2.a2 are the axis i want to use. I want js2.a1 to control the left engine and js2.a2 to control the right engine. What i am think needs to happen is, if input is detected on js2.a1, the script needs to send a keystroke to select engine 1 and assign js2.a1 to control cms.a1. Then when input is detected from js2.a2, the script would need to send a keystroke command to select engine 2 and assign js2.a2 to control cms.a1. I hope this makes sense? I am totally lost on even where to start on this one. But if this can work, then we can create virtual muti-engine control for the throttle quad in il2.
Hope some of you guys can help me out with these. I am foaming at the mouth waiting for this TQ to show up at my door :).
S~
SPaRX
Bob Church
26th May 2004, 05:57 AM
>> First one:
I want to assign button strokes to particular positions on one of the throttle axis. I want to use this for differnt mixture settings. I understand that i can create a line that says something to this effect
if js2.a5 = 200 (axis value for a dedent)
then cms.b1 = True
Then i can assign a key stroke to cms.b1 in the map. But doing it this way, it will continually keep cms.b1 active until i move the axis from that position, just as if i was holding down a key on my keyboard. So how do i set it to just send a single keystoke when i enter the dedent? <<
If you're sending a character like "a" with cms.b1, then add "NULL" to it like "NULL a" so it's not a single character up in the GUI and it will just press and release. A couple of other notes. In general, it's a bad idea to ask for "exactly" 200. If it bounce 199-200-199-200.... you'll end up with a lot of single "a" characters (or whatever). Better use a range of values to give yourself some leeway. Also, it's easier just to code the compare rather than the whole if/then thing:
cms.b1 = [js2.a5 == 200];
or, with a little leeway:
cms.b1 = [js2.a5 > 195] AND [js2.a5 < 205];
Also, you need a "C"-type double "=" for the equality comparison.
You might also look at the Select blocks, they let you use on statement to line up several values like that.
>> Second one:
I want to thru cms create a quasi dual throttle control for teh P38 in il2. My idea is to assign two of the TQ axis to control a single cms axis. Lets say for this example that js2.a1 and js2.a2 are the axis i want to use. I want js2.a1 to control the left engine and js2.a2 to control the right engine. What i am think needs to happen is, if input is detected on js2.a1, the script needs to send a keystroke to select engine 1 and assign js2.a1 to control cms.a1. Then when input is detected from js2.a2, the script would need to send a keystroke command to select engine 2 and assign js2.a2 to control cms.a1. I hope this makes sense? I am totally lost on even where to start on this one. But if this can work, then we can create virtual muti-engine control for the throttle quad in il2. <<
I don't know if you can get an acceptable response or not. I don't have IL2, but if I understand correctly, you've got two axes on the controllers, two engines on the aircraft, but only one throttle input to the sim, so you really need to alternate throttle values into and out of that one input.
There's a sort of a brick wall that you run into with that in that the sim only checks once per frame for axis inputs, and you can't know when it's going to happen. Getting your engine select character to get the correct engine ready to accept input and getting the new value there at the right instant so that the engines don't switch while the value for the other engine is still on the axis and that the axis doesn't change before the engine is has switched would be very difficult. If you can live with the "bump" while things get out of sync for a few seconds you might be okay, I don't know if that would be smooth enough to be useful or not.
Is there a command to disconnect the throttle entirely, e.g. so neither engine is selected? That might make it possible:
1. Set value 1
2. Select Engine 1
3. Deselect Engine 1
4. Set Value 2
5. Select Engine 2
6. Deselect Engine 2
That way the values would only change while no engine was watching. You could easily write a timer-driven program to just alternate back and forth continuously, or whenever the throttle inputs. Not immediate response, but something like "Okay, the axis has moved by a couple of percent, lets start running the multiplexer until they stop moving entirely for 10 seconds." or something along those lines.
Anyway, it's an interesting problem. Maybe someone else has some ideas.
- Bob
The StickWorks
http://www.stickworks.com
VFS-22_SPaRX
27th May 2004, 05:38 AM
Yes Bob, Il2 has a command to unselect all engines. I knew this part was going to take some thinking. I just hope it will work somehow. Will be nice to have separate throttle control for the P38s :).
S~ sparx
MichaelCHProd
27th May 2004, 06:13 AM
I did talk to Oleg at E-3 and he seemed really interested in the TQ. I have a couple slated from the first production run for shipment to Russia. :)
VFS-22_SPaRX
1st June 2004, 09:02 PM
So how would i script this?
IF js1.a1 moves, then i want it to turn js1.b1 to true.
If js1.a2 moves, then i want it to turn js1.b2 to true.
S~
SPaRX
Bob Church
2nd June 2004, 01:00 AM
Well, you'd need to record the axis value at some point, then compare that with the axis value each time the script looped, check the current value against the stored value. When it changed, do whatever needed doing and then store the new value for comparison next time around. There are a lot of problems with that, though. The response will be laggy and fine changes would be very difficult.
I'd try just continually updating, I think. Maybe something like this. Set CMS.B1 to select "No Engine", CMS.B2 to select the left engine, and CMS.B3 to select the right engine. They would need to send characters or whatever it took to do the selection. Assume initially that neither engine is selected (e.g. the state the CMS.B1 would produce). I don't know which axes you want to use, but lets say JS1.A1 is left engine and JS1.A2 is right engine and the CMS.A1 is the common axis input to the sim. You'd need to do a sequence something like:
sequence
cms.a1 = js1.a1; // Hook the left engine control to to the engine axis
delay( 1 ); // Let that propogate to the CMS axis
cms.b2 = TRUE; // Select the left axis
delay( 1 ); // Let the sim see that axis value
cms.b2 = FALSE; // Kill the left axis output
cms.b1 = TRUE; // Deselect both engines
delay( 1 ); // Let that propogate to the sim
cms.b1 = FALSE; // Kill the deselect command
cms.a1 = js1.a2; // Set the right engine value
delay( 1 ); // Let that propogate to the CMS value
cms.b3 = TRUE; // Select the right engine
delay( 1 ); // Let it propogate to the sim
cms.b3 = FALSE; // Kill the right engine command
cms.b1 = TRUE; // Set the "no engine" command
delay( 1 ); // Let that propogate to the sim
cms.b1 = FALSE; // Kill the "no engine" command
delay( 1 ); // Let that propogate
endSequence
Something along those lines anyway. That's not tested, and you'll likely need to fiddle with the delay values and things, but that would be my first shot. You don't need to know when the axis "just moved" that way, you're just continually updating both engines to match what their respective inputs are set to by alternately selecting the two inputs and connecting them one at a time to the two axes.
Let us know if it looks like it will work or not. If not, maybe we can think of something else to try.
- Bob
The StickWorks
http://www.stickworks.com
Powered by vBulletin® Version 4.1.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.