Page 1 of 1

Titan 2 New user script support

PostPosted: Thu Aug 15, 2019 4:57 pm
by Lifty
Hello. I purchased a titan 2 this week and extremely new to scripting. I’m trying to write a basic script for Xbox One but I’m struggling :icon_frown:
If anyone could give me a hand I’d appreciate it. My goal is when I press Button_7 I automatically run a combo. The combo is simple it’s just YY (Button_ 14) twice. If it helps it’s for the game Halo 5 and I’m trying to do the Grenade animation stop by using the change weapon double tap. Thanks in advance :smile0517:

Re: Titan 2 New user script support

PostPosted: Thu Aug 15, 2019 8:31 pm
by alanmcgregor
If you want to learn more about scripting, Scachi wrote this well explained basic guide:

viewforum.php?f=26

Now, I don't know if L1 (BUTTON_7) has a crucial action for the game, so you might don't want to override it.

For case like yours, what I prefer to do is: create a script that if you quick tap Y it will press Y two times, but if you press Y for a bit longer (250ms) you have regular Y action. What you think? this could work for you?

Re: Titan 2 New user script support

PostPosted: Thu Aug 15, 2019 8:35 pm
by Mad
Try this:
Code: Select all
main { 
 if(event_active(6)) combo_run(Cancel);
}
 
combo Cancel {
  set_val(13, 100.0);
  wait(40);
  wait(40);
  set_val(13, 100.0);
  wait(40);
}

Re: Titan 2 New user script support

PostPosted: Thu Aug 15, 2019 8:42 pm
by alanmcgregor
This is the other option I commented earlier.

Code: Select all
#pragma METAINFO("Double Press", 1, 0, "alanmcgregor")
 
#define MaxTimePressed 200
#define TimeBeforeNextPress 100 // reduce this value for faster double Y tap
 
 
main {
    //If quick Tap for Double Y Press.  Press Y a bit longer for regular Y action
    if(event_release(BUTTON_14) && (time_active(BUTTON_14) <= MaxTimePressed)) {
        combo_run(cDoublePressY);
    }
}
 
combo cDoublePressY{
    wait(TimeBeforeNextPress);
    set_val(BUTTON_14, 100.0);
    wait(50);
}

Re: Titan 2 New user script support

PostPosted: Fri Aug 16, 2019 2:51 am
by Lifty
Thanks for the quick replies! The Button_7 is the throw grenade command and the Button_14 is the change weapon command.
Using your script alanmcgregor I changed the button_14 to button_7 because that is the action command. This works pretty well so that I can hold button_7 and the normal grenade throw animation occurs, and if I doubletap the button_7 the grenade animation stop occurs (which I want).

Is there a way I can only tap button_7 ONCE and I get the grenade animation stop response?

Thanks a bunch!


#pragma METAINFO("Double Press", 1, 0, "alanmcgregor")

#define MaxTimePressed 200
#define TimeBeforeNextPress 50 // reduce this value for faster double Y tap


main {
//If quick Tap for Double Y Press. Press Y a bit longer for regular Y action
if(event_release(BUTTON_7) && (time_active(BUTTON_7) <= MaxTimePressed)) {
combo_run(cDoublePressY);
}
}

combo cDoublePressY{
wait(TimeBeforeNextPress);
set_val(BUTTON_14, 100.0);
wait(50);
}