How can I monitor if switch is on

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

How can I monitor if switch is on

Postby alencroat » Fri Dec 14, 2018 10:42 pm

I have got this code in and I would like to monitor my switch if its (ON/OFF) in the Device monitor. kinda like tracking anything for example buton 5/RT.. Im guessing the combo would be assigned to new buttons I think button 18? I seen something like that before but still no idea what im doing. Thanks!


Code: Select all
 
bool preciseAR= FALSE;
main {
//PRECISE AR SHOOTING
    if(event_release(DDOWN)) {
        preciseAR = !preciseAR;
    }       
        if(preciseAR == TRUE) {           
        if(is_active(ADS_BUTTON)){
        set_val(ADS_BUTTON, 0.0);
        combo_run(preciseAR2);
    }
    if (event_active(Y_BUTTON)){
            preciseAR = FALSE;
            }
        }
    if(get_val(DDOWN)) {
        set_val(DDOWN, 0.0);     //   <<--  Also i didnt know where to add that above ^^
        }   
combo preciseAR2  {   
    set_val(ADS_BUTTON, 100);      
    wait(240);
BUTTON, 100);
    set_val(ADS_BUTTON, 100);
    set_val(FIRE_BUTTON, 100);
    wait(30);
 
    wait(200);     
}   
 
User avatar
alencroat
Lieutenant
Lieutenant
 
Posts: 320
Joined: Sun Oct 15, 2017 5:58 pm

Re: How can I monitor if switch is on

Postby Sillyasskid » Sat Dec 15, 2018 12:09 am

Code: Select all
#define DDOWN BUTTON_11
#define Y_BUTTON BUTTON_14
#define ADS_BUTTON BUTTON_8
#define FIRE_BUTTON BUTTON_5
 
bool preciseAR;
main {
  set_val(DDOWN, 0);
//----
  if(event_release(DDOWN)) { preciseAR = !preciseAR; }
//----
  if(preciseAR == TRUE) {
    if(is_active(ADS_BUTTON)) { combo_run(preciseAR2); set_val(ADS_BUTTON, 0); }
    if(event_active(Y_BUTTON)) preciseAR = FALSE;
  }
//----
}
 
combo preciseAR2  {
  set_val(ADS_BUTTON, 100); wait(240);
//----
  set_val(ADS_BUTTON, 100); set_val(FIRE_BUTTON, 100); wait(30);
//----
  wait(200);
//----
}
 
main {
//-- This is your toggle monitor
 set_val(BUTTON_18, preciseAR);
//-- BUTTON_18 will turn green only when preciseAR is active.
}
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: How can I monitor if switch is on

Postby alencroat » Sat Dec 15, 2018 1:18 am

nice ty ty
User avatar
alencroat
Lieutenant
Lieutenant
 
Posts: 320
Joined: Sun Oct 15, 2017 5:58 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: midg3t2 and 209 guests