are these 2 things possible?

GPC2 script programming for Titan Two. Code examples, questions, requests.

are these 2 things possible?

Postby ThatOneDude » Sun Jun 28, 2020 3:09 am

So is there anyway that you can force a script to stop at a click of a button for example a toggle is on and off but lets say you use rapidfire then click so called button it will stop the script mid action? the other question is there anyway too freely use sticks if they are in use by the script since they are locked when a script is very fast? if so how would it be done on both questions thank you for your time never really tried these forums read through it all the time has a ton of positive energy and i like that. :joia:
User avatar
ThatOneDude
Corporal
Corporal
 
Posts: 4
Joined: Thu Jun 01, 2017 1:47 pm

Re: are these 2 things possible?

Postby Mad » Sun Jun 28, 2020 3:49 am

Welcome. :smile0201:

Code: Select all
bool toggle;
 
main {
    if(event_active(BUTTON_1)) {
        toggle = !toggle;
    }
 
    if (toggle) {
        // your script code
    }
}


For the second one, do you mean when a combo is locking the sticks?
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: are these 2 things possible?

Postby ThatOneDude » Sun Jun 28, 2020 3:51 am

ya thats what i ment it locks up and feels stuck
User avatar
ThatOneDude
Corporal
Corporal
 
Posts: 4
Joined: Thu Jun 01, 2017 1:47 pm

Re: are these 2 things possible?

Postby Mad » Sun Jun 28, 2020 4:15 am

you could stop the combo when the stick is active:
Code: Select all
if(is_active(STICK_1_X) || is_active(STICK_1_Y)) {
    combo_stop(mycombo);
}

or use this function and replace set_val() to offset() for the sticks in the combo:
Code: Select all
combo example {
    set_val(BUTTON_1, 100);
    wait(100);
    offset(STICK_1_X, -100.0);
    wait(100);
    offset(STICK_1_Y, 100.0);
    wait(100);
}
 
void offset(uint8 axis, fix32 offset_val) {
    set_val(axis, clamp(offset_val * (100f - abs(get_actual(axis))) / 100f + get_actual(axis), -100f, 100f));
    return;
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: are these 2 things possible?

Postby ThatOneDude » Sun Jun 28, 2020 5:40 am

thank you so much the 2nd script for the unlocking sticks works perfect appreciate that on the first question is there a different take on the toggle for example i want to use rapidfire so lets say i have a combo that does many things sometimes you will hit an object or tend to over extend is there a way like if you shoot it will make the script absolutely stop all functions kinda like a toggle but instead of an on and off it will be a hold shoot and script stops from running allowing for a reset sorry i know im typing a ton.
User avatar
ThatOneDude
Corporal
Corporal
 
Posts: 4
Joined: Thu Jun 01, 2017 1:47 pm

Re: are these 2 things possible?

Postby Mad » Sun Jun 28, 2020 6:24 am

You can use memset (https://www.consoletuner.com/wiki/index ... =t2:memset) + the toggle. This will stop all combos and the toggle will prevent any other functions within main from running.
Code: Select all
bool toggle;
 
main {
    if(event_active(BUTTON_5)) {
        toggle = !toggle;
        if(!toggle) {
            memset(&last_combo_name, 0, amount_of_combos * 4);
        }
    }
 
    if (toggle) {
        // your script code
    }
}

Place your entire script inside the toggle. For memset change "last_combo_name" to the last combo listed in your script and "amount_of_combos" with the total count of your combos.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: are these 2 things possible?

Postby ThatOneDude » Sun Jun 28, 2020 6:42 am

thank you so much you answered all my questions appreciate it have a wonderful rest of the day/night these forums are great
User avatar
ThatOneDude
Corporal
Corporal
 
Posts: 4
Joined: Thu Jun 01, 2017 1:47 pm

Re: are these 2 things possible?

Postby Mad » Sun Jun 28, 2020 7:10 am

ThatOneDude wrote:thank you so much you answered all my questions appreciate it have a wonderful rest of the day/night these forums are great

No problem. You to :smile0517:
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 113 guests