titan 2 scripts

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

titan 2 scripts

Postby Lurkin » Wed May 22, 2019 9:52 pm

i'm not exactly sure where to put this or what the correct question is.

I have a script that works on the cronos, can this be made to work on titan 2?
also is there a tutorial for writing scripts for the titan 2? ill post the script I want to use below.

Code: Select all
/* 
    *Press Right thumbstick to activate/Deactivate
*/

 
int MENUSPAM;
 
main {
 
 vm_tctrl(+24)// 34ms update time}
 
 if(event_press(XB1_RS)) {
  MENUSPAM = !MENUSPAM
}
 
 if(MENUSPAM)
  combo_run(menuSpam);
}
 
combo menuSpam {
 set_val(XB1_MENU,150);
 //set_val(XB1_MENU,0);
 wait(200);
 set_val(XB1_VIEW,150);
// set_val(XB1_VIEW,0);
 }
User avatar
Lurkin
Sergeant
Sergeant
 
Posts: 7
Joined: Mon May 20, 2019 5:52 pm

Re: titan 2 scripts

Postby DontAtMe » Thu May 23, 2019 2:54 am

Code: Select all
#include <titanone.gph>
int MENUSPAM;
main {
  vm_tctrl(+24); // 34ms update time} 
 
  if(event_press(XB1_RS)) {
    MENUSPAM = !MENUSPAM;
  }
 
  if(MENUSPAM) combo_run(menuSpam);
}
 
combo menuSpam {
  set_val(XB1_MENU,150);
  //set_val(XB1_MENU,0);
  wait(200);
  set_val(XB1_VIEW,150);
  // set_val(XB1_VIEW,0);
}
 
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: titan 2 scripts

Postby Buffy » Thu May 23, 2019 3:01 am

ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am

Re: titan 2 scripts

Postby Lurkin » Thu May 23, 2019 11:48 am

when I convert this the timing is way to slow. are the times different for the t2?
User avatar
Lurkin
Sergeant
Sergeant
 
Posts: 7
Joined: Mon May 20, 2019 5:52 pm

Re: titan 2 scripts

Postby Lurkin » Fri May 24, 2019 12:13 pm

can someone explain step by step what is going on in this script? all I need to happen is when I press the right stick it starts spamming view and menu buttons until I press the right stick again.
User avatar
Lurkin
Sergeant
Sergeant
 
Posts: 7
Joined: Mon May 20, 2019 5:52 pm

Re: titan 2 scripts

Postby DontAtMe » Fri May 24, 2019 1:09 pm

add another
Code: Select all
wait(200);

at the end of that combo.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: titan 2 scripts

Postby Lurkin » Fri May 24, 2019 2:30 pm

perfect. what I've been trying to figure out is if some of this is even necessary.
int MENUSPAM;<--------------what does this mean?
main {
vm_tctrl(+24); // 34ms update time} ;<--------------what does this mean?

if(event_press(XB1_RS)) {
MENUSPAM = !MENUSPAM; ;<--------------what does this mean?
}

if(MENUSPAM) combo_run(menuSpam);
User avatar
Lurkin
Sergeant
Sergeant
 
Posts: 7
Joined: Mon May 20, 2019 5:52 pm

Re: titan 2 scripts

Postby J2Kbr » Mon May 27, 2019 10:06 am

Lurkin wrote:int MENUSPAM;<--------------what does this mean?

Variable declaration. The variable name can be anything, here it was called "MENUSPAM";

Lurkin wrote:vm_tctrl(+24); // 34ms update time} ;<--------------what does this mean?

Here the author is configuring the script to run once every 34 milliseconds (the default for this device is 10ms), this is being done possible to match the game FPS. The Titan Two run at 1ms or less and this command has no effect when executed on the Titan Two.

Lurkin wrote:MENUSPAM = !MENUSPAM; ;<--------------what does this mean?

The variable "MENUSPAM " is being used as toggle to enable/disable the execution of some mod.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: titan 2 scripts

Postby DontAtMe » Mon May 27, 2019 6:08 pm

I think he was referring to the ; semicolons at the end of each statement.

These are called statement terminators.
To make it short, Yes, they are all necessary as it lets the compiler know when each statement is finished.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 142 guests

cron