Need help using a recorded macro

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

Need help using a recorded macro

Postby Airforce » Sun Jul 14, 2019 12:29 am

Hello :)

I'm in need of guidance as I'm still learning GPC..

So, I've recorded the macros under device monitor and went to the editor and now I wish to use them.
In GPC, I'm wanting to toggle between the 10 macros using a numberpad that I have plugged into the Titan2 (antirecoil). How might this be done?
User avatar
Airforce
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Jul 10, 2019 5:46 pm


Re: Need help using a recorded macro

Postby Buffy » Sun Jul 14, 2019 4:27 am

Code: Select all
 
 
#include <keyboard.gph>
 
uint8 key_idx, curr_running;
 
main {
    if(key_status((KEY_PAD1 + key_idx))) {
        if(curr_running != key_idx) macro_stop();
        curr_running = key_idx;
        char* str = "n.gmk";
        *str = (key_idx == 9) ? '0' : '1' + key_idx;
        macro_run(str);
    }
    key_idx = (key_idx+1)%10;
}
 
ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am

Re: Need help using a recorded macro

Postby Airforce » Sun Jul 14, 2019 4:33 am

I'm having a difficult time just getting it to play lol.

I was able to record what I needed, edit it, and save it as a gmk file onto the SD card.
I wasted 8 hours today and don't feel any closer in getting this done :\.

Essentially, its an anti-recoil macro,... So when button 5 is pressed, run the macro on the sd card.. when it's released, stop.. any ideas?
User avatar
Airforce
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Jul 10, 2019 5:46 pm

Re: Need help using a recorded macro

Postby Mad » Sun Jul 14, 2019 5:02 am

Code: Select all
main {
  if (get_actual(BUTTON_5)) macro_run("Example.gmk");
  else macro_stop();
}


But why the macro? There are some solid choices in the online resource section for anti-recoil
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4532
Joined: Wed May 22, 2019 5:39 am

Re: Need help using a recorded macro

Postby Airforce » Sun Jul 14, 2019 5:08 am

I've been making weapon-specific anti-recoil macros,.. I was able to record them using the titan 2 and now I'm trying to use them + switch between them using a numberpad connected to the T2.
User avatar
Airforce
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Jul 10, 2019 5:46 pm

Re: Need help using a recorded macro

Postby Buffy » Sun Jul 14, 2019 5:49 am

Something like this (macros must be named 0.gmk, 1.gmk, 2.gmk ... 9.gmk)?

Code: Select all
 
 
 
#include <keyboard.gph>
#include <xb1.gph>
 
uint8 key_idx;
char* str = "n.gmk";
 
main {
    if(is_active(XB1_LT) && is_active(XB1_RT)) {
        if(sqrt(sq(get_actual(XB1_RX)) + sq(get_actual(XB1_RY))) < 30.0) {
            macro_run(str);
        }
    }
    else if(macro_time() > 0) macro_stop();
}
 
// macro selector
main {
    if(key_status((KEY_PAD1 + key_idx))) {
        *str = (key_idx == 9) ? '0' : '1' + key_idx;
    }
    key_idx = (key_idx+1)%10;
}
 
ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am

Re: Need help using a recorded macro

Postby Airforce » Sun Jul 14, 2019 8:43 am

Yeah, although my numberpad isn't switching files like it should- Did I get it wrong?

Code: Select all
 
#pragma METAINFO("<Logan>", 1, 0, "test1")
#include <keyboard.gph>
 
uint8 key_idx, curr_running;
char* str = "0.gmk";
 
// Macro Selector
main {
    if(key_status((KEY_PAD1 + key_idx))) {
        if(curr_running != key_idx) macro_stop();
        curr_running = key_idx;
        *str = (key_idx == 9) ? '0' : '1' + key_idx;
        macro_run(str);
    }
    key_idx = (key_idx+1)%10;
}
 
// Macro
main {
    if (get_actual(BUTTON_5)) macro_run("0.gmk");
    else macro_stop();
}
 
User avatar
Airforce
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Jul 10, 2019 5:46 pm

Re: Need help using a recorded macro

Postby Mad » Sun Jul 14, 2019 8:50 am

Use the last one Buffy posted.
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4532
Joined: Wed May 22, 2019 5:39 am

Re: Need help using a recorded macro

Postby Airforce » Mon Jul 15, 2019 3:09 am

Nothing so far is working :(

I'm wondering though, "Include <keyboard.gph>" I have went to the online resources and downloaded/saved that file... I'm wondering since it shows red instead of gold if its an indicator that I'm doing something wrong?
User avatar
Airforce
Staff Sergeant
Staff Sergeant
 
Posts: 12
Joined: Wed Jul 10, 2019 5:46 pm

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 133 guests

cron