GPC2 scripting printf spamming the output panel

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

GPC2 scripting printf spamming the output panel

Postby fullerorb7 » Sat Jul 23, 2022 1:42 pm

printF, is there any way to get 1 result back, NOT 5 results for .950ms and 5 results for .951ms and 5 results for .999ms...etc

i want to use printFor to give me an idea if my code ran correctly without testing @xbox
it cant be just me?
Theres like 100 gigabazillion printFs going on in the background,,, thats GR8, but i want to limit that to display just 1 per MS.
i mean i can code work arounds to set the current time as a variable and have a check to make sure its at least 10 seconds past the current time.... but with the amount of printFs i want to add in, i would be flooding my page with printf time checkers.
im having issues getting my actual code to work. i want to figure this out on my own... i just need printf to work right.

maybe i can add in specific time windows for every code to pass.
like only allow code to start if conditions met & if over 1000ms, but not over 1006ms.
but thats just rediculous.

maybe dedicated combos just for printsf?
why does it seem like my same combo is running multiple times in the background, but only executing the code of 1 combo?
why is this only seem to be an issue for me?
Last edited by fullerorb7 on Sat Jul 23, 2022 1:57 pm, edited 1 time in total.
User avatar
fullerorb7
Master Sergeant
Master Sergeant
 
Posts: 37
Joined: Sun Feb 21, 2016 8:09 pm

Re: GPC2 scripting printf spamming the output panel

Postby fullerorb7 » Sat Jul 23, 2022 1:44 pm

i cant count the number of printF's because it floods my screen to the point everything that was above it autodeletes itself
User avatar
fullerorb7
Master Sergeant
Master Sergeant
 
Posts: 37
Joined: Sun Feb 21, 2016 8:09 pm

Re: GPC2 scripting printf spamming the output panel

Postby fullerorb7 » Sat Jul 23, 2022 1:58 pm

perfect example.

i want this beyond simple code to only display 1 printf

if (get_val(BUTTON_9)) {
printf("StartWiredReflexesC");
}

does everyone else get like 100 prints?
User avatar
fullerorb7
Master Sergeant
Master Sergeant
 
Posts: 37
Joined: Sun Feb 21, 2016 8:09 pm

Re: GPC2 scripting printf spamming the output panel

Postby Scachi » Sat Jul 23, 2022 2:27 pm

use "event_active(BUTTON_9)" instead of that get_val
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: GPC2 scripting printf spamming the output panel

Postby fullerorb7 » Sat Jul 23, 2022 10:29 pm

Scachi wrote:use "event_active(BUTTON_9)" instead of that get_val


thanks a ton!!!
get_, is_, and time_ function in a way that will cause my printf's to spam out of control. GR8
event_ and Check_ dont cause printf spam


i made this example code trying to teach myself... and im running into a issue where printF spams forever.
shouldnt it only spam once because time_active can only hit the 5000ms mark 1 time?
Code: Select all
#pragma METAINFO("gdzxggnb", 1, 0, "fullerorb7")
 
int test;
init {(test) = 0;}
 
main {
    test = time_active(BUTTON_9);
    if (event_active(BUTTON_9)) {
      printf("Time Active: %d", test);
    }
 
    if ((test) = 5000) {
    printf("Time Active: %d", test);
    }
}
User avatar
fullerorb7
Master Sergeant
Master Sergeant
 
Posts: 37
Joined: Sun Feb 21, 2016 8:09 pm

Re: GPC2 scripting printf spamming the output panel

Postby Mad » Sun Jul 24, 2022 1:58 am

Your operators are wrong. Should be == 5000
Code: Select all
int test;
main {
    if(is_active(BUTTON_9)) {
        test = time_active(BUTTON_9);
    }
    if(test == 5000) {
        printf("Time Active: %d", test);
    }
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: GPC2 scripting printf spamming the output panel

Postby fullerorb7 » Sun Jul 24, 2022 9:32 am

I actually remember thinking about the double equal sign, but got side tracked before trying it.
Sorry I'm a noob
User avatar
fullerorb7
Master Sergeant
Master Sergeant
 
Posts: 37
Joined: Sun Feb 21, 2016 8:09 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 29 guests