Page 1 of 1

Script writing help

PostPosted: Fri Oct 04, 2019 2:54 pm
by kokrng
So I took the time and figured out basic writing commands and combo commands, but now I want to do more advanced things if possible. Hopefully someone can help, as I haven't been able to find the answers:

1- Disable "A" from being used, while "C" is pressed down? What about disable "A" and "B" while "C" is pressed?


2- Pressing "A" and "B" at same time activates "C" button? The following does not seem to work when I try:
if(get_actual(BUTTON_11) and get_actual(BUTTON_12)){
get_actual(BUTTON_3);
};

3- Help creating a combo, when combo starts both "A" and "B" are activated, after 5 seconds activate "C". Then after 5 seconds deactivate "A" then after another 5 seconds deactivate "B" then after 5 seconds deactivate "C". This is an example, but i'm trying to learn how to overlap different key presses with different activation times and deactivation times.


I know this is quite a bit, but I've pretty much learned from deconstructing previous scripts, but can't seem to figure the above out. I would truly appreciate help

Thank you,
KOKRNG

Re: Script writing help

PostPosted: Fri Oct 04, 2019 4:59 pm
by Scachi
kokrng wrote:So I took the time and figured out basic writing commands and combo commands, but now I want to do more advanced things if possible. Hopefully someone can help, as I haven't been able to find the answers:

1- Disable "A" from being used, while "C" is pressed down? What about disable "A" and "B" while "C" is pressed?

use set_val(button,value); where value 0 is for released and 100 for fully pressed. For the other inputs take a look at the "Device Monitor" when you move your gamedpad to know which values are possible for each input.
Code: Select all
 
if(get_actual(BUTTON_3)){
    set_val(BUTTON_11,0);
}
 
if(get_actual(BUTTON_3)){
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,0);
}
 
 

2- Pressing "A" and "B" at same time activates "C" button? The following does not seem to work when I try:
if(get_actual(BUTTON_11) and get_actual(BUTTON_12)){
get_actual(BUTTON_3);
};

get_actual and get_val are used for reading values. To set values you have to use set_val.
There is no "and", you have to use "&&" instead. "||" instead of "or"
Code: Select all
if(get_actual(BUTTON_11) && get_actual(BUTTON_12)){
        set_val(BUTTON_3,100);
}

3- Help creating a combo, when combo starts both "A" and "B" are activated, after 5 seconds activate "C". Then after 5 seconds deactivate "A" then after another 5 seconds deactivate "B" then after 5 seconds deactivate "C". This is an example, but i'm trying to learn how to overlap different key presses with different activation times and deactivation times.

Put all the inputs you want to have pressed down or released at the same time into the same wait section, use set_val for each input.
You can remove set_val that sets buttons values to 0 if you are sure that you are not holding down the button manually when it should be released to save some script size.
Code: Select all
combo example {
    set_val(BUTTON_11,100);
    set_val(BUTTON_12,100);
    wait(5000);
    set_val(BUTTON_11,100);
    set_val(BUTTON_12,100);
    set_val(BUTTON_3,100);
    wait(5000);
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,100);
    set_val(BUTTON_3,100);
    wait(5000);
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,0);
    set_val(BUTTON_3,100);
    wait(5000);
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,0);
    set_val(BUTTON_3,0);
    wait(5000);
}
 

For more combo release button usage information read section "Press and Release of a button":
https://www.consoletuner.com/wiki/index ... s#pitfalls

For more scripting information and examples: https://www.consoletuner.com/wiki/index ... _scripting

Re: Script writing help

PostPosted: Sat Oct 05, 2019 6:37 am
by kokrng
Scachi wrote:
kokrng wrote:So I took the time and figured out basic writing commands and combo commands, but now I want to do more advanced things if possible. Hopefully someone can help, as I haven't been able to find the answers:

1- Disable "A" from being used, while "C" is pressed down? What about disable "A" and "B" while "C" is pressed?

use set_val(button,value); where value 0 is for released and 100 for fully pressed. For the other inputs take a look at the "Device Monitor" when you move your gamedpad to know which values are possible for each input.
Code: Select all
 
if(get_actual(BUTTON_3)){
    set_val(BUTTON_11,0);
}
 
if(get_actual(BUTTON_3)){
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,0);
}
 
 

2- Pressing "A" and "B" at same time activates "C" button? The following does not seem to work when I try:
if(get_actual(BUTTON_11) and get_actual(BUTTON_12)){
get_actual(BUTTON_3);
};

get_actual and get_val are used for reading values. To set values you have to use set_val.
There is no "and", you have to use "&&" instead. "||" instead of "or"
Code: Select all
if(get_actual(BUTTON_11) && get_actual(BUTTON_12)){
        set_val(BUTTON_3,100);
}

3- Help creating a combo, when combo starts both "A" and "B" are activated, after 5 seconds activate "C". Then after 5 seconds deactivate "A" then after another 5 seconds deactivate "B" then after 5 seconds deactivate "C". This is an example, but i'm trying to learn how to overlap different key presses with different activation times and deactivation times.

Put all the inputs you want to have pressed down or released at the same time into the same wait section, use set_val for each input.
You can remove set_val that sets buttons values to 0 if you are sure that you are not holding down the button manually when it should be released to save some script size.
Code: Select all
combo example {
    set_val(BUTTON_11,100);
    set_val(BUTTON_12,100);
    wait(5000);
    set_val(BUTTON_11,100);
    set_val(BUTTON_12,100);
    set_val(BUTTON_3,100);
    wait(5000);
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,100);
    set_val(BUTTON_3,100);
    wait(5000);
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,0);
    set_val(BUTTON_3,100);
    wait(5000);
    set_val(BUTTON_11,0);
    set_val(BUTTON_12,0);
    set_val(BUTTON_3,0);
    wait(5000);
}
 

For more combo release button usage information read section "Press and Release of a button":
https://www.consoletuner.com/wiki/index ... s#pitfalls

For more scripting information and examples: https://www.consoletuner.com/wiki/index ... _scripting


Thank you so much! I actually learned a lot of basic things from your destiny script. Was about to create one with antirecoil, skating, quickswapping (still need to 2 button activate it though, couldn't get it down to 1) hopefully I can get it to 1 button now with the advice you gave. Thank you!