homepage

Help with repeating twice the same character.

Posted By: Aullido

Help with repeating twice the same character. - 02/22/15 11:02 PM

Take a look at this code:

byte xFlaps = 0;
int DoNothing;

//----------------------------------------------------------------------------------------------------------------------------------- LandingMode

int
Workaround ()
{
ActKey(PULSE+KEYON+FlapsDown);
}

int
FlapsControl ()
{
if (xFlaps == 0)
{

//ActKey(PULSE+KEYON+FlapsDown);
//ActKey(PULSE+KEYON+FlapsDown); // Desired behavior: v v. Only sends One v.

//ActKey(PULSE+KEYON+FlapsDown);
//ActKey(PULSE+KEYON+'w'); // Any other key works, sendind v null v doesn't either.

//DOWN+ UP+ doesn't work.

//Workaround();

//DoNothing = 0;

//while (DoNothing <= 50000)
// {
// DoNothing = DoNothing + 1;
// }

//Workaround();
}

if (xFlaps == 3)
{
ActKey(PULSE+KEYON+FlapsUp);
}

xFlaps = 2;
}

int
LandingMode ()
{

MapKey
(
&Throttle,
BSF,
0
);

MapKeyR
(
&Throttle,
BSF,
0
);

MapKeyIO
(
&Throttle,
FLAPU,
0,
CHAIN
(
PULSE+FlapsUp,
D(),
PULSE+FlapsUp,
EXEC
(
"xFlaps = 0;"
)
)
);

MapKeyIO
(
&Throttle,
FLAPM,
0,
EXEC
(
"FlapsControl();"
)
);

MapKeyIO
(
&Throttle,
FLAPD,
0,
CHAIN
(
PULSE+FlapsDown,
EXEC
(
"xFlaps = 3;"
)
)
);
}

The event tester shows only a v is pressed. Looks like consecutive ActKeys are first pressed, then released. I tried to separate both actkeys but I ran out of ideas.

Any help will be truly appreciated. thanks.
Posted By: Aullido

Re: Help with repeating twice the same character. - 02/28/15 01:42 AM

DeferCall does the trick:

DeferCall(100,&ActKey,PULSE+KEYON+FlapsDown);
© 2024 SimHQ Forums