Macro Help for a Novice

Titan Two general support. Questions, firmware update, feature request.

Macro Help for a Novice

Postby ducati0307 » Fri Aug 27, 2021 1:13 am

I really appreciate the help given to beginners on this forum. Thank you so much!

I have made a number of XboxOne scripts that use the various buttons (X, Y, A, B, Dpad, etc.) but I would like to learn how to incorporate the analog sticks as well. For example, shown below is a simple script that does the following:

DPad Down
Click A Button
Wait 2-3 seconds
Click B Button
Wait 1-2 seconds
Click Y Button
Wait 4-5 seconds
DPad Up
Wait 5-8 seconds

The change I want to make would occur immediately before clicking the Y button (so right after the 1-2 second wait). What I would like to do is press the left analog stick to the right... and after about 2 seconds... tap and release the X button.

Could someone help me with the lines of code that I should insert?

____________________________________________________________________
Code: Select all
main {
if (event_active(BUTTON_12)) {
  if (One) combo_stop(One); // DPAD LEFT TO START!!! If combo is running stop it
  else combo_run(One);
}
}
 
combo One {
  uint16 run;
 
  set_val(BUTTON_11, 200); // Dpad down on
  wait(irand(200,250)); // this will create a random time between 200 and 250
  set_val(BUTTON_11, 0); // Dpad down off
  wait(irand(200,250)); // this will create a random time between 200 and 250
 
  set_val(BUTTON_16, 200); // A on
  wait(irand(200,250)); // this will create a random time between 200 and 250
  set_val(BUTTON_16, 0); // A off
  wait(irand(200,250)); // this will create a random time between 200 and 250
 
 wait(irand(2000,3000)); // this will create a random time between 2000 and 3000
 
  set_val(BUTTON_15, 200); // B on
  wait(irand(200,250)); // this will create a random time between 200 and 250
  set_val(BUTTON_15, 0); // B off
  wait(irand(200,250)); // this will create a random time between 200 and 250
 
  wait(irand(1000,2000)); // this will create a random time between 1000 and 2000
 
  set_val(BUTTON_14, 200); // Y on
  wait(irand(200,250)); // this will create a random time between 200 and 250
  set_val(BUTTON_14, 0); // Y off
  wait(irand(200,250)); // this will create a random time between 200 and 250
 
  wait(irand(4000,5000)); // this will create a random time between 4000 and 5000
 
  set_val(BUTTON_10, 200); // DPad Up on
  wait(irand(200,250)); // this will create a random time between 200 and 250
  set_val(BUTTON_10, 0); // DPad Up off
  wait(irand(200,250)); // this will create a random time between 200 and 250
 
  wait(irand(5000,8000)); // this will create a random time between 5000 and 8000
 
  if (++run % 1000) combo_restart(One); // Run 1000 times
  wait(0);
  run = 0;
}
User avatar
ducati0307
Sergeant First Class
Sergeant First Class
 
Posts: 16
Joined: Fri Jul 12, 2019 11:32 pm

Re: Macro Help for a Novice

Postby Mad » Tue Aug 31, 2021 10:10 pm

Hi,

The stick directions are:

X: negative for left, positive for right.
Y: negative for up, positive for down.

So for you to move the left stick left:
Code: Select all
set_val(STICK_2_X, -100);


You can always move your controller while connected via PROG and check Gtuner's Device Monitor. It'll show you the directions you're moving the stick in.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: Macro Help for a Novice

Postby ducati0307 » Tue Sep 07, 2021 5:08 pm

Thank you for the reply!
User avatar
ducati0307
Sergeant First Class
Sergeant First Class
 
Posts: 16
Joined: Fri Jul 12, 2019 11:32 pm


Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 65 guests