| View previous topic :: View next topic |
| Author |
Message |
BaldieJr
Joined: 02 Jul 2004 Posts: 23
|
Posted: Sat Jul 10, 2004 7:22 am Post subject: Boolean in Ifs |
|
|
if joyU < 020 && > 010
Send, somekey
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Sat Jul 10, 2004 12:11 pm Post subject: |
|
|
The "and" in your example is already supported:
| Code: | if joyU < 020
if joyU > 010
{
...
} |
But the "or" conjunction isn't yet. Much of the "or" would be realizable through an idea to have "if joyU not between 10, 20", which should be in a future version. |
|
| Back to top |
|
 |
BaldieJr
Joined: 02 Jul 2004 Posts: 23
|
Posted: Sat Jul 10, 2004 9:15 pm Post subject: |
|
|
Let me rephrase:
I wish for: expressions in if statements, with multiple comparisons using and/or.
ifing an if is fine when you've only two, but try breaking an axis into 10 (or more!) seperate keystrokes and only 'send'ing when there is a change. It gets pretty complex/ confusing (I've been at this since yesterday and still haven't made it work properly). |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Sat Jul 10, 2004 11:03 pm Post subject: |
|
|
Since true complex expressions are pretty far down on the list, it will probably be at least several months before it happens. In the meantime, it's usually best to use a series of else if statements:
if joyu < 10
...
else if joyu < 20 ; between 10 and 19
...
else if joyu < 30 ; between 20 and 29
...
else ; joyu >= 30
...
If that doesn't help you, someone here might be able to suggest an approach if you post a sample or describe the plan for your script in more detail. |
|
| Back to top |
|
 |
BaldieJr
Joined: 02 Jul 2004 Posts: 23
|
Posted: Sun Jul 11, 2004 2:33 am Post subject: |
|
|
Seems kinda involved to me
If anyone ever needs to know how to do key-stroke 'banding' on a joy axis, this is it.
This uses axis U.
0-10 = 0 % mixture
11-20 = 10% mixture
etc etc etc
It does not continuously send keys. It only sends when over/under a band.
| Code: |
#Persistent
#SingleInstance
SetFormat, float, 03
JoystickNumber = 2 ; Set this to joystick to be used.
state = 000
current = 0
Loop
{
sleep, 100
GetKeyState, joyu, %JoystickNumber%JoyU
If state <> %joyu%
{
Loop
{
if joyu < 10
{
if current = 1
{
Break
}
Send, Setting Mixture 0 Percent {enter}
state = %joyu%
current = 1
Break
}
else if joyu < 20 ; between 10 and 19
{
if current = 2
{
Break
}
Send, Setting Mixture 10 Percent {enter}
state = %joyu%
current = 2
Break
}
else if joyu < 30 ; between 20 and 29
{
if current = 3
{
Break
}
Send, Setting Mixture 30 Percent {enter}
state = %joyu%
current = 3
Break
}
else if joyu < 40 ; between 20 and 29
{
if current = 4
{
Break
}
Send, Setting Mixture 40 Percent {enter}
state = %joyu%
current = 4
Break
}
else if joyu < 50 ; between 20 and 29
{
if current = 5
{
Break
}
Send, Setting Mixture 50 Percent {enter}
state = %joyu%
current = 5
Break
}
else if joyu < 60 ; between 20 and 29
{
if current = 6
{
Break
}
Send, Setting Mixture 60 Percent {enter}
state = %joyu%
current = 6
Break
}
else if joyu < 70 ; between 20 and 29
{
if current = 7
{
Break
}
Send, Setting Mixture 70 Percent {enter}
state = %joyu%
current = 7
Break
}
else if joyu < 80 ; between 20 and 29
{
if current = 8
{
Break
}
Send, Setting Mixture 80 Percent {enter}
state = %joyu%
current = 8
Break
}
else if joyu < 90 ; between 20 and 29
{
if current = 9
{
Break
}
Send, Setting Mixture 90 Percent {enter}
state = %joyu%
current = 9
Break
}
else ; joyu >= 100
if current = 10
{
Break
}
Send, Setting Mixture 100 Percent {enter}
state = %joyu%
current = 10
Break
}
}
}
|
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Sun Jul 11, 2004 3:51 am Post subject: |
|
|
| Quote: | | JoystickNumber = 2 |
So you actually have more than one joystick installed? If so, that's good because I hadn't been able to test multi-joystick support. |
|
| Back to top |
|
 |
BaldieJr
Joined: 02 Jul 2004 Posts: 23
|
Posted: Sun Jul 11, 2004 4:16 am Post subject: |
|
|
Chris,
I'm not normal. I'm building a cockpit.
3 sticks are installed now (one is virtual) and autohotkeys sees them all. I have a dual-device USB controller awaiting more parts. I plan to get a 256 button controller board and a 256 channel digital output board.
I'm banging around with autohotkey in hopes that it will be the glue that brings all the hardware together. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10463
|
Posted: Sun Jul 11, 2004 5:11 am Post subject: |
|
|
| Sounds cool -- a simulator I imagine -- good luck with it. |
|
| Back to top |
|
 |
|