Titan 2 Simple Macro

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

Titan 2 Simple Macro

Postby Gorphius » Wed May 22, 2019 4:45 pm

Hi everyone! I am in need of some assistance. I heard you can have more than one script running at the same time on the same slot, if this is true what would be the simplest way to create or get a macro on the same slot as my rapid fire gamepack? All I need this Macro to do is double tap a button when I hit it once(I have nerve damage in my right hand so it’s difficult to double tap B to combat roll.) So far I have tried the “MacroRecPlay” script and one other one but I fail to get it working, any easier options?
User avatar
Gorphius
Master Sergeant
Master Sergeant
 
Posts: 26
Joined: Tue Nov 13, 2018 7:54 pm

Re: Titan 2 Simple Macro

Postby Scachi » Wed May 22, 2019 5:09 pm

Different script at the same time on the same slot..no.
You can merge multiple scripts into one when you have the source code, their size and their logic allows that (so you don't end up doing multiple things with the same button when you don't want to)

You only need to change the button to match your combat roll button and maybe lower the wait times when it is to slow to work as a double tap:
Code: Select all
 
#define DBL_BUTTON     BUTTON_15 // in GTuner IV press F1 to see the list of buttons
#define DBL_TIME        100              // wait time between all button states
 
main {
  if (event_active(DBL_BUTTON)) combo_run(cDouble);
}
 
combo cDouble {
  set_val(DBL_BUTTON,100); // press button
  wait(DBL_TIME);              // (press) for ms
  set_val(DBL_BUTTON,0);   // release button
  wait(DBL_TIME);              // (release) for ms
  set_val(DBL_BUTTON,100); // press button
  wait(DBL_TIME);              // (press) for ms
}
 
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Titan 2 Simple Macro

Postby Gorphius » Wed May 22, 2019 5:37 pm

Thank you Scachi that’s good to know! How would I access the code in a gamepack, and where would I place it?
User avatar
Gorphius
Master Sergeant
Master Sergeant
 
Posts: 26
Joined: Tue Nov 13, 2018 7:54 pm

Re: Titan 2 Simple Macro

Postby Scachi » Wed May 22, 2019 6:04 pm

Gorphius wrote:Thank you Scachi that’s good to know! How would I access the code in a gamepack, and where would I place it?

Gamepacks are closed source, you can't edit those. You can ask J2kbr to add a feature to a Gamepack.
For non official stuff try to contact the authors and ask them.

For scripting information: https://www.consoletuner.com/wiki/index ... _scripting
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Titan 2 Simple Macro

Postby Gorphius » Fri May 24, 2019 3:16 pm

Hi Scachi, so i gave the script examples a try and it worked great. I got the double tap to work and i added the auto run which works well but i then tried to add a rapid fire section and it did not work. I just changed the timings but nothing happens in game when trying to use it. Would you be able to help me figure out why?

Code: Select all
#pragma METAINFO("<author_name>", 1, 0, "")
 
main {if (event_active(BUTTON_15)) combo_run(cDoubleJump);
}
 
combo cDoubleJump {
  set_val(BUTTON_15,100); // press button 15
  wait(50);              // (press) for 50ms
  set_val(BUTTON_15,0);   // release button 15
  wait(50);              // (release) for 50ms
  set_val(BUTTON_15,100); // press button 15
  wait(50);              // (press) for 50ms
 
}
main {
    if (get_actual(STICK_2_Y) ==  -100.0) set_val(BUTTON_9,100);
}
// toggle - rapid fire
bool bRapid=FALSE;
 
main {
  // toggle
  if (get_actual(BUTTON_8) && event_active(BUTTON_10)) bRapid = !bRapid;
 
  // run rapid fire only when it is enabled and you press BUTTON_5
  if (bRapid) {
      if (is_active(BUTTON_5)) combo_run(cRapidFire);
      if (event_release(BUTTON_5)) combo_stop(cRapidFire);
  }
}
 
combo cRapidFire {
  set_val(BUTTON_5,100); // press button 5
  wait(63);              // (press) for 63ms
  set_val(BUTTON_5,100);   // release button 5
  wait(30);              // (release) for 30ms
}
User avatar
Gorphius
Master Sergeant
Master Sergeant
 
Posts: 26
Joined: Tue Nov 13, 2018 7:54 pm

Re: Titan 2 Simple Macro

Postby Scachi » Fri May 24, 2019 3:37 pm

You have two of : set_val(BUTTON_5,100);
where the last one should be : set_val(BUTTON_5,0);
100 is for a full press, 0 is for a full release.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Titan 2 Simple Macro

Postby Gorphius » Sat May 25, 2019 7:20 pm

That worked out well thanks! Scachi would you happen to know if it’s possible to change the buttons on the controller that cycle through the slots?
User avatar
Gorphius
Master Sergeant
Master Sergeant
 
Posts: 26
Joined: Tue Nov 13, 2018 7:54 pm

Re: Titan 2 Simple Macro

Postby Scachi » Sun May 26, 2019 3:11 am

Gorphius wrote:That worked out well thanks! Scachi would you happen to know if it’s possible to change the buttons on the controller that cycle through the slots?

No, I don't think that this combination is configurable.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 84 guests