|
0 registered members (),
1,089
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: how to get the input in orders?
[Re: jockerob]
#468890
10/25/17 19:41
10/25/17 19:41
|
Joined: Jul 2014
Posts: 72
DriftWood
Junior Member
|
Junior Member
Joined: Jul 2014
Posts: 72
|
I'd use both timers and a complex "SWITCH" setup. Not functioning code.
...
var key_timer =0;
var run_yes = 0; // false
var comboo_1 = 0; // false
while(1)
{
if(key_cur)
key_timer = 10;
if(key_1)
key_timer = 5;
if(key_2)
key_timer = 5;
...Subtract timer here...
switch(key_lastpressed )
{
case 77:
if(key_timer >0)
if(key_cur)
run_yes =1;
//... Call run function or code below switch
break;
case 2:
if(key_timer >0)
if(key_1)
comboo_1 = 0.5;
else
{
comboo_1 = 0;
key_timer = 0;
}
break;
case 3:
if(key_timer >0)
if(key_2)
comboo_1 = 1;
//... Call comboo function or code below switch
else
{
comboo_1 = 0;
key_timer = 0;
}
break;
default:
printf("None of them! ");
break;
}
wait(1);
}
reading ... http://www.conitec.net/beta/akeyboard.htmhttp://www.conitec.net/beta/akey_a.htmhttp://www.conitec.net/beta/akey_lastpressed.htmhttp://www.conitec.net/beta/switch.htmhttp://www.conitec.net/beta/acrt-break.htmYou can also use a time and an array to store last-hit key scan codes. Using a "For" loop you can check the array for patterns of combos each frame. so like
......
var key_timer =0;
var key_store[5];
var key_index_max = 4;
var key_index =0;
while(1)
{
if(key_cur)
key_timer = 10;
if(key_1)
key_timer = 5;
if(key_2)
key_timer = 5;
...Subtract timer here...
switch(key_lastpressed)
switch(key_lastpressed )
{
case 77:
if(key_timer > 0)
{
for(key_index =0; key_index <= key_index_max; key_index++)
{
if(key_store[key_index] == 0)
{
key_store[key_index] = 77;
break;
}
}
else
{
for(key_index =0; key_index <= key_index_max; key_index++)
key_store[key_index] = 0;
}
run_yes =1;
//... Call run function or code below switch
break;
case 2:
......
break;
case 3:
.........
break;
default:
printf("None of them! ");
break;
}
//....... Checking the array
if(key_store[0] !=0) // ?One key was hit
{
if(key_store[1] !=0)
{
if(key_store[0] == 77 && key_store[1] == 77 )
///...Call RUN here
}
}
wait(1);
}
http://www.conitec.net/beta/for.htmhttp://www.conitec.net/beta/keys_c.htmThe above code doesn't work and is bugged, but you should get an idea of how you can use it to build a combo system. Also please check the AUM mags, I'm sure a combo system has been done before.
Last edited by DriftWood; 10/25/17 20:03.
|
|
|
Re: how to get the input in orders?
[Re: Ezzett]
#468927
10/27/17 20:52
10/27/17 20:52
|
Joined: Jul 2014
Posts: 72
DriftWood
Junior Member
|
Junior Member
Joined: Jul 2014
Posts: 72
|
Add a new timer called charge timer - for the charge key. You need to step out of the switch and into IF trees.
.........
var charge_timer =0;
if( key_a)
charge_time =5;
...sub charge_timer...
if(key_d && key_lastpressed(--key_a--) && charge_time<=0)
----do attack----
As per double keys, it's not complex,
if(key_a && key_d && key_timer < 0)
{
.... do -x- .....
}
If you like give each optional key it's own timer... key_a_timer, key_d_timer, ect + key_a_charge timer..... Also look at this http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=468925#Post468925 , by the Master @txesmi
|
|
|
|
|
|