How to loop a combo conditionally?
4 posts
• Page 1 of 1
How to loop a combo conditionally?
Just got my T2 a few days ago and new to scripting but picking it up quick. I am sure the issue is some simple syntax error but I can seem to find it . Can someone please tell me whats wrong with my code? I am not sure why it doesn't work like I think it should.
I want to hit a button then have it loop one combo 30 times before looping the second combo one time while looping the whole thing until I stop it or until a time limit is reached. Any assistance would be appreciated. Thanks
I want to hit a button then have it loop one combo 30 times before looping the second combo one time while looping the whole thing until I stop it or until a time limit is reached. Any assistance would be appreciated. Thanks
- Code: Select all
int RumbleNotification = 20;
int StartMacro = FALSE;
int Combo1 = 30; //times to loop combo one
int Combo2 = 1; //times to loop combo two
int RestTime = 600; // seconds before we shut it down
int Total = Combo1 + Combo2;
int Work = 0;
int RestTimer = 0;
define Rumble_Hard = RUMBLE_A;
main {
if ( get_val(XB1_LEFT))
{
RestTimer = RestTimer + get_rtime();
StartMacro = TRUE;
combo_run(Notification_Rumble);
}
if (StartMacro && (Work <= Combo1))
{
StartMacro = TRUE;
combo_run(MyAction);
}
if (StartMacro && (Work = Total))
{
StartMacro = TRUE;
macro_run("small.gmk");
Rest = 0;
}
if (event_press(XB1_B) && StartMacro || Work > Total || RestTimer >= (RestTime * 1000))
{
RestTimer = 0;
StartMacro = FALSE;
combo_stop();
macro_stop();
combo_run(Notification_Rumble);
}
}
combo MyAction
{
set_val(XB1_A, 100);
wait(400);
Work = Work + 1;
wait(10);
}
combo Notification_Rumble
{
set_rumble(Rumble_Hard, RumbleNotification);
wait(150);
set_rumble(Rumble_Hard, 0);
wait(200);
set_rumble(Rumble_Hard, RumbleNotification);
wait(150);
set_rumble(Rumble_Hard, 0);
wait(200);
set_rumble(Rumble_Hard, RumbleNotification);
wait(150);
set_rumble(Rumble_Hard, 0);
wait(1150);
}
-
USER101 - Sergeant Major
- Posts: 100
- Joined: Mon Dec 03, 2018 5:45 pm
Re: How to loop a combo conditionally?
this code is in its most part using Titan One scripting, so I added the back compatibility header and fixed couple bugs. now the code compiles without error, but I have not tested its functionality.
- Code: Select all
#include <titanone.gph>
int RumbleNotification = 20;
int StartMacro = FALSE;
int Combo1 = 30; //times to loop combo one
int Combo2 = 1; //times to loop combo two
int RestTime = 600; // seconds before we shut it down
int Total = Combo1 + Combo2;
int Work = 0;
int RestTimer = 0;
define Rumble_Hard = RUMBLE_A;
main {
if ( get_val(XB1_LEFT))
{
RestTimer = RestTimer + get_rtime();
StartMacro = TRUE;
combo_run(Notification_Rumble);
}
if (StartMacro && (Work <= Combo1))
{
StartMacro = TRUE;
combo_run(MyAction);
}
if (StartMacro && (Work = Total))
{
StartMacro = TRUE;
macro_run("small.gmk");
RestTimer = 0;
}
if (event_press(XB1_B) && StartMacro || Work > Total || RestTimer >= (RestTime * 1000))
{
RestTimer = 0;
StartMacro = FALSE;
//combo_stop();
macro_stop();
combo_run(Notification_Rumble);
}
}
combo MyAction
{
set_val(XB1_A, 100);
wait(400);
Work = Work + 1;
wait(10);
}
combo Notification_Rumble
{
set_rumble(Rumble_Hard, RumbleNotification);
wait(150);
set_rumble(Rumble_Hard, 0);
wait(200);
set_rumble(Rumble_Hard, RumbleNotification);
wait(150);
set_rumble(Rumble_Hard, 0);
wait(200);
set_rumble(Rumble_Hard, RumbleNotification);
wait(150);
set_rumble(Rumble_Hard, 0);
wait(1150);
}
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: How to loop a combo conditionally?
Thanks J2Kbr, I guess I have been learning the wrong code. I really want to learn T2 stuff. By the way the T1 I had originally got was faulty. As soon as I got a new one everything worked. I just sent it back and bought 3 T2s. I was wondering where I could find good T2 sample code? I want to know if there is a way to perform an action if my controller doesn't rumble after 30 seconds. Thanks
-
USER101 - Sergeant Major
- Posts: 100
- Joined: Mon Dec 03, 2018 5:45 pm
Re: How to loop a combo conditionally?
The language reference helps to look up functions and examples for them, but i lacks more information if you don't know which functions to use.
I added some scripting documentation to point to the functions one might want to use to do specific stuff:
https://www.consoletuner.com/wiki/index ... _scripting
for rumple functions:
https://www.consoletuner.com/wiki/index ... le_control
I added some scripting documentation to point to the functions one might want to use to do specific stuff:
https://www.consoletuner.com/wiki/index ... _scripting
for rumple functions:
https://www.consoletuner.com/wiki/index ... le_control
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
4 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 45 guests