Need To Run a Macro after X hours
6 posts
• Page 1 of 1
Need To Run a Macro after X hours
Basically, I have this script:
and I want the script to run a macro after 7 hours and then run the combo c_Start_Game after that macro is done. how can I do that?
- Code: Select all
#pragma METAINFO("VC Generator (8).gpc", 1, 0, "Buffy's GPC Converter v0.26r4")
#include <titanone.gph>
// GPC Online Library
// gl0zz3n_nba_2k20_vc_generator.gpc
/* INSTRUCTIONS:
WATCH THE DEMO: www.youtube.com/watch?v=2a-_Qos9rvs
[1] Set Game Timer to 5-minute Quarters
[2] Move cursor over the next game you want to play, so it is highlighted
[3] Press the XBOX or PLAYSTATION button to start/stop the script.
* When device LED is GREEN mod is ON.
* When device LED is RED mod is OFF.
**/// set_val(TRACE_6,(times_run));
//set_val(TRACE_1,1);
//start Nest Game
//select "yes"
//select "yes"
//set_val(TRACE_1,2);
//set_val(TRACE_1,3);
//start Nest Game
//skip practice to next game
//start Nest Game
//select "yes"
//select "yes"
// unmap 0;
int active;
int seconds = 65;
int times_run = 0;
main {
if (event_press(0)) {
seconds = 65;
active =! active;
combo_run(c_START_GAME);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
}
if (!active) {
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
combo_stop(c_START_GAME);
combo_stop(c_GAME_TIMER);
combo_stop(c_GAME_RESTART);
}
set_val(TRACE_2, (seconds));
}
combo c_START_GAME {
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_Y, -100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
combo_run(c_GAME_TIMER);
}
combo c_GAME_TIMER {
set_val(XB1_A, 100);
wait(6000);
wait(1500);
set_val(XB1_B, 100);
wait(75);
wait(50);
seconds = seconds - 1;
if (seconds > 0) combo_run(c_BUMP);
if (seconds < 1) combo_run(c_BUMP2);
}
combo c_BUMP {
combo_run(c_GAME_TIMER);
}
combo c_BUMP2 {
combo_run(c_GAME_RESTART);
}
combo c_GAME_RESTART {
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_RIGHT, 100);
wait(50);
wait(500);
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_DOWN, 100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
seconds = 65;
times_run = times_run + 1;
combo_run(c_GAME_TIMER);
}
main { // remapping code
set_val(0, 0);
}
and I want the script to run a macro after 7 hours and then run the combo c_Start_Game after that macro is done. how can I do that?
-
Capo - Staff Sergeant
- Posts: 11
- Joined: Mon Oct 28, 2019 10:02 pm
Re: Need To Run a Macro after X hours
Capo wrote: I want the script to run a macro after 7 hours and then run the combo c_Start_Game after that macro is done. how can I do that?
- Code: Select all
#include <xb1.gph>
uint32 timer;
bool macro_finished;
main {
timer += elapsed_time(); /* Wait 7 Hours */
if(timer < (((1000 * 60) * 60) * 7)) {
// 1000 Miliseconds * 60 Seconds * 60 Minutes * 7 Hours.
...
}
else { /* After 7 Hours */
if(macro_finished == FALSE){
macro_run("urMacro.gmk"); /* Run Macro */
if(macro_time() == 0) {
macro_finished = TRUE;
}
}
if(macro_finished == TRUE) {
combo_run(c_Start_Game); /* When Macro Finished Run Combo */
}
}
}
combo c_Start_Game { /* Combo */
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_Y, -100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
timer = macro_finished = 0; /* Reset Script */
}
-
DontAtMe - Captain
- Posts: 502
- Joined: Tue Oct 02, 2018 4:49 am
Re: Need To Run a Macro after X hours
I need the whole script to run for 7 hours then run a macro and when that macro is over it restarts and the 7 hour timer begins again.
-
Capo - Staff Sergeant
- Posts: 11
- Joined: Mon Oct 28, 2019 10:02 pm
Re: Need To Run a Macro after X hours
It’s a farming script so I want the timer to begin once I start the script and then 7 hours later it plays a macro and after that macro runs the script starts up again and the timer resets back to 7 hours and counts down again
-
Capo - Staff Sergeant
- Posts: 11
- Joined: Mon Oct 28, 2019 10:02 pm
Re: Need To Run a Macro after X hours
Capo wrote:I need the whole script to run for 7 hours then run a macro and when that macro is over it restarts and the 7 hour timer begins again.
- Code: Select all
uint32 Timer;
main {
Timer += elapsed_time();
/* Run script for 7 hours */
// 1000 Miliseconds * 60 Seconds * 60 Minutes * 7 Hours.
if(Timer < (((1000 * 60) * 60) * 7)) {
script(); //
}
else {
/* After 7 Hours Run Macro Then Reset Timer. */
bool macro_finished;
if(macro_finished == FALSE){
macro_run("macro.gmk");
if(macro_time() > 0) {
macro_finished = TRUE;
}
}else if(macro_time() < 0){
macro_finished = Timer = 0;
}
}
}
#include <titanone.gph>
int active;
int seconds = 65;
int times_run = 0;
void script() {
if (event_press(0)) {
seconds = 65;
active =! active;
combo_run(c_START_GAME);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
}
if (!active) {
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
combo_stop(c_START_GAME);
combo_stop(c_GAME_TIMER);
combo_stop(c_GAME_RESTART);
}
set_val(TRACE_2, (seconds));
}
combo c_START_GAME {
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_Y, -100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
combo_run(c_GAME_TIMER);
}
combo c_GAME_TIMER {
set_val(XB1_A, 100);
wait(6000);
wait(1500);
set_val(XB1_B, 100);
wait(75);
wait(50);
seconds = seconds - 1;
if (seconds > 0) combo_run(c_BUMP);
if (seconds < 1) combo_run(c_BUMP2);
}
combo c_BUMP {
combo_run(c_GAME_TIMER);
}
combo c_BUMP2 {
combo_run(c_GAME_RESTART);
}
combo c_GAME_RESTART {
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_RIGHT, 100);
wait(50);
wait(500);
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_DOWN, 100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
seconds = 65;
times_run = times_run + 1;
combo_run(c_GAME_TIMER);
}
main { // remapping code
set_val(0, 0);
}
-
DontAtMe - Captain
- Posts: 502
- Joined: Tue Oct 02, 2018 4:49 am
Re: Need To Run a Macro after X hours
DontAtMe wrote:Capo wrote:I need the whole script to run for 7 hours then run a macro and when that macro is over it restarts and the 7 hour timer begins again.
- Code: Select all
uint32 Timer;
main {
Timer += elapsed_time();
/* Run script for 7 hours */
// 1000 Miliseconds * 60 Seconds * 60 Minutes * 7 Hours.
if(Timer < (((1000 * 60) * 60) * 7)) {
script(); //
}
else {
/* After 7 Hours Run Macro Then Reset Timer. */
bool macro_finished;
if(macro_finished == FALSE){
macro_run("macro.gmk");
if(macro_time() > 0) {
macro_finished = TRUE;
}
}else if(macro_time() < 0){
macro_finished = Timer = 0;
}
}
}
#include <titanone.gph>
int active;
int seconds = 65;
int times_run = 0;
void script() {
if (event_press(0)) {
seconds = 65;
active =! active;
combo_run(c_START_GAME);
set_led(LED_1, 0);
set_led(LED_2, 0);
set_led(LED_3, 1);
}
if (!active) {
set_led(LED_1, 0);
set_led(LED_2, 1);
set_led(LED_3, 0);
combo_stop(c_START_GAME);
combo_stop(c_GAME_TIMER);
combo_stop(c_GAME_RESTART);
}
set_val(TRACE_2, (seconds));
}
combo c_START_GAME {
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_Y, -100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
combo_run(c_GAME_TIMER);
}
combo c_GAME_TIMER {
set_val(XB1_A, 100);
wait(6000);
wait(1500);
set_val(XB1_B, 100);
wait(75);
wait(50);
seconds = seconds - 1;
if (seconds > 0) combo_run(c_BUMP);
if (seconds < 1) combo_run(c_BUMP2);
}
combo c_BUMP {
combo_run(c_GAME_TIMER);
}
combo c_BUMP2 {
combo_run(c_GAME_RESTART);
}
combo c_GAME_RESTART {
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_RIGHT, 100);
wait(50);
wait(500);
set_val(XB1_A, 100);
wait(50);
wait(500);
set_val(XB1_DOWN, 100);
wait(50);
wait(200);
set_val(XB1_A, 100);
wait(50);
wait(200);
seconds = 65;
times_run = times_run + 1;
combo_run(c_GAME_TIMER);
}
main { // remapping code
set_val(0, 0);
}
I was just able to try out this script and it works perfectly. Thank you
-
Capo - Staff Sergeant
- Posts: 11
- Joined: Mon Oct 28, 2019 10:02 pm
6 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 98 guests