Need Help with rapidfire script with random timings
12 posts
• Page 1 of 2 • 1, 2
Need Help with rapidfire script with random timings
Hi guys, I need your help please.
I am a complete noob in doing scripts.
I was download this simple rapidfire script.
And now I will change the fix time between the commands in a variable random time.
For example
Push button x
Than hold it for a random time between 40ms and 50ms
Or something like that.
I hope u understand my crap Englisch.
This is the script I found and want to rewrite with this. Can someone help me please?
and this was trying a friend of mine to help me .. but it dont works :(
I am a complete noob in doing scripts.
I was download this simple rapidfire script.
And now I will change the fix time between the commands in a variable random time.
For example
Push button x
Than hold it for a random time between 40ms and 50ms
Or something like that.
I hope u understand my crap Englisch.
This is the script I found and want to rewrite with this. Can someone help me please?
- Code: Select all
#pragma METAINFO("<Jacked>", 1, 0, "")
#include <xb1.gph>
#define SHOOT XB1_RT
#define ADS XB1_LT
#define RAPIDFIRE_SPEED 30 // Lower the value, faster the rapidfire
bool toggle = !FALSE;
main {
if((get_val(XB1_UP) && event_active(XB1_RT)) || (get_val(XB1_RT) && event_active(XB1_UP))) {
toggle = !toggle;
}
if(toggle && is_active(SHOOT)) {
combo_run(RapidFire);
} else if(RapidFire) {
combo_stop(RapidFire);
}
}
combo RapidFire {
set_val(SHOOT, 100.0);
wait(RAPIDFIRE_SPEED);
set_val(SHOOT, 0.0);
wait(RAPIDFIRE_SPEED);
and this was trying a friend of mine to help me .. but it dont works :(
- Code: Select all
#define SHOOT Button_15
#define TOGGLE Button_15
#define RAPIDFIRE_SPEED_TIME 50
#define RAPIDFIRE_SPEED_VARIATION 10
bool toggle = !FALSE;
bool pressed = FALSE;
main {
bool _pressed = (key_get(TOGGLE);
if( _pressed && !pressed) {
toggle = !toggle;
}
pressed = _pressed;
if(toggle && key_get(SHOOT)) {
combo_run(RapidFire);
} else if(RapidFire) {
combo_stop(RapidFire);
}
}
combo RapidFire {
key_set(SHOOT, 1);
wait(RAPIDFIRE_SPEED_TIME + rand() * RAPIDFIRE_SPEED_VARIATION);
key_set(SHOOT, 0);
wait(15);
}
RAW Paste Data
#pragma METAINFO("<Jacked>", 1, 0, "")
#include <xb1.gph>
#define SHOOT KEY_A
#define TOGGLE KEY_B
#define RAPIDFIRE_SPEED_TIME 50
#define RAPIDFIRE_SPEED_VARIATION 10
bool toggle = !FALSE;
bool pressed = FALSE;
main {
bool _pressed = (key_get(TOGGLE);
if( _pressed && !pressed) {
toggle = !toggle;
}
pressed = _pressed;
if(toggle && key_get(SHOOT)) {
combo_run(RapidFire);
} else if(RapidFire) {
combo_stop(RapidFire);
}
}
combo RapidFire {
key_set(SHOOT, 1);
wait(RAPIDFIRE_SPEED_TIME + rand() * RAPIDFIRE_SPEED_VARIATION);
key_set(SHOOT, 0);
wait(15);
}
-
Silent_x - Sergeant
- Posts: 9
- Joined: Thu Jul 30, 2020 11:26 pm
Re: Need Help with rapidfire script with random timings
Are you using KEY_A to actually shoot or left mouse button?
If you're using a mouse:
If your actually using KEY_A to shoot:
If you're using a mouse:
- Code: Select all
#pragma METAINFO("<Jacked>", 1, 0, "")
#include <mouse.gph>
#include <keyboard.gph>
#define SHOOT MBUTTON_1
#define TOGGLE KEY_B
#define RAPIDFIRE_SPEED_TIME 40
#define RAPIDFIRE_SPEED_VARIATION 50
#define irand(a,b) (((int)(rand() * (fix32)(b+1 - a))) + a)
bool toggle = TRUE;
bool pressed;
main {
if(toggle && mouse_status(SHOOT)) {
combo_run(RapidFire);
}
else {
combo_stop(RapidFire);
}
if(key_status(TOGGLE)) pressed = 1;
else if(pressed) {
pressed = 0;
toggle = !toggle;
}
}
combo RapidFire {
mouse_set(SHOOT, 1);
wait(0);
wait(irand(RAPIDFIRE_SPEED_TIME, RAPIDFIRE_SPEED_VARIATION));
mouse_set(SHOOT, 0);
wait(0);
wait(irand(RAPIDFIRE_SPEED_TIME, RAPIDFIRE_SPEED_VARIATION));
}
If your actually using KEY_A to shoot:
- Code: Select all
#pragma METAINFO("<Jacked>", 1, 0, "")
#include <keyboard.gph>
#define SHOOT KEY_A
#define TOGGLE KEY_B
#define RAPIDFIRE_SPEED_TIME 40
#define RAPIDFIRE_SPEED_VARIATION 50
#define irand(a,b) (((int)(rand() * (fix32)(b+1 - a))) + a)
bool toggle = TRUE;
bool pressed;
main {
if(toggle && key_status(KEY_A)) {
combo_run(RapidFire);
}
else {
combo_stop(RapidFire);
}
if(key_status(TOGGLE)) pressed = 1;
else if(pressed) {
pressed = 0;
toggle = !toggle;
}
}
combo RapidFire {
key_set(SHOOT, 1);
wait(0);
wait(irand(RAPIDFIRE_SPEED_TIME, RAPIDFIRE_SPEED_VARIATION));
key_set(SHOOT, 0);
wait(0);
wait(irand(RAPIDFIRE_SPEED_TIME, RAPIDFIRE_SPEED_VARIATION));
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: Need Help with rapidfire script with random timings
Thank you very much
The keys I can change by myself.
I use (circle) on ps4 controller.
I think this is BUTTON_15
i will try
The keys I can change by myself.
I use (circle) on ps4 controller.
I think this is BUTTON_15
i will try
Last edited by Silent_x on Sun Aug 02, 2020 3:15 pm, edited 1 time in total.
-
Silent_x - Sergeant
- Posts: 9
- Joined: Thu Jul 30, 2020 11:26 pm
Re: Need Help with rapidfire script with random timings
Mad wrote:Are you using KEY_A to actually shoot or left mouse button?
i have now tried to change yours to work on ps4 controller with circle button.
this is what i did.
- Code: Select all
#pragma METAINFO("<test>", 1, 0, "")
#include <ps4.gph>
#define SHOOT BUTTON_15
#define TOGGLE POINT_1_X
#define RAPIDFIRE_SPEED_TIME 40
#define RAPIDFIRE_SPEED_VARIATION 50
#define irand(a,b) (((int)(rand() * (fix32)(b+1 - a))) + a)
bool toggle = TRUE;
bool pressed;
main {
if(get_val(BUTTON_15)) {
combo_run(RapidFire);
}
else {
combo_stop(RapidFire);
}
if(get_val(TOGGLE)) pressed = 1;
else if(pressed) {
pressed = 0;
toggle = !toggle;
}
}
combo RapidFire {
set_val(SHOOT, 1);
wait(0);
wait(irand(RAPIDFIRE_SPEED_TIME, RAPIDFIRE_SPEED_VARIATION));
set_val(SHOOT, 0);
wait(0);
wait(irand(RAPIDFIRE_SPEED_TIME, RAPIDFIRE_SPEED_VARIATION));
}
but it dont works
what is wrong? can u pls help me
it works but often the time for next shoot is over 2 secounds.. somtimes more
-
Silent_x - Sergeant
- Posts: 9
- Joined: Thu Jul 30, 2020 11:26 pm
Re: Need Help with rapidfire script with random timings
The code of the combo RapidFire above was created for sending keyboard output. For controller output you need some adjustments.
Are you using a keyboard / USB HID Output at all or are you playing using a controller or keyboard mouse on console using an input translator only ?
For controller give this a try:
Are you using a keyboard / USB HID Output at all or are you playing using a controller or keyboard mouse on console using an input translator only ?
For controller give this a try:
- Code: Select all
#pragma METAINFO("<test>", 1, 0, "")
#include <ps4.gph>
#define SHOOT BUTTON_15
#define RAPIDFIRE_SPEED_TIME_MIN 40
#define RAPIDFIRE_SPEED_TIME_MAX 50
#define irand(a,b) (((int)(rand() * (fix32)(b+1 - a))) + a)
main {
if(get_val(BUTTON_15)) {
combo_run(RapidFire);
}
else {
combo_stop(RapidFire);
}
}
combo RapidFire {
set_val(SHOOT, 100);
wait(irand(RAPIDFIRE_SPEED_TIME_MIN, RAPIDFIRE_SPEED_TIME_MAX));
set_val(SHOOT, 0);
wait(irand(RAPIDFIRE_SPEED_TIME_MIN, RAPIDFIRE_SPEED_TIME_MAX));
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Need Help with rapidfire script with random timings
Scachi wrote:The code of the combo RapidFire above was created for sending keyboard output. For controller output you need some adjustments.
Are you using a keyboard / USB HID Output at all or are you playing using a controller or keyboard mouse on console using an input translator only ?
For controller give this a try:
- Code: Select all
#pragma METAINFO("<test>", 1, 0, "")
#include <ps4.gph>
#define SHOOT BUTTON_15
#define RAPIDFIRE_SPEED_TIME_MIN 40
#define RAPIDFIRE_SPEED_TIME_MAX 50
#define irand(a,b) (((int)(rand() * (fix32)(b+1 - a))) + a)
main {
if(get_val(BUTTON_15)) {
combo_run(RapidFire);
}
else {
combo_stop(RapidFire);
}
}
combo RapidFire {
set_val(SHOOT, 100);
wait(irand(RAPIDFIRE_SPEED_TIME_MIN, RAPIDFIRE_SPEED_TIME_MAX));
set_val(SHOOT, 0);
wait(irand(RAPIDFIRE_SPEED_TIME_MIN, RAPIDFIRE_SPEED_TIME_MAX));
}
thank you so much.. thisworks
can u please say what i have to include in this script that the controller led lights blue it this script is in the active titan two lot?
-
Silent_x - Sergeant
- Posts: 9
- Joined: Thu Jul 30, 2020 11:26 pm
Re: Need Help with rapidfire script with random timings
Scachi wrote:Are you using a keyboard / USB HID Output at all or are you playing using a controller or keyboard mouse on console using an input translator only ?
i use xim apex mouse keyboard translator. and then put the xim in the titan two.
so if the signals arives titan two, the already translated in controller signals.
-
Silent_x - Sergeant
- Posts: 9
- Joined: Thu Jul 30, 2020 11:26 pm
Re: Need Help with rapidfire script with random timings
Silent_x wrote:thank you so much.. thisworks
can u please say what i have to include in this script that the controller led lights blue it this script is in the active titan two lot?
https://www.consoletuner.com/greslib/?w551
I always use the header file colorled for it from the online resource, download it from within gtuner iv.
put the file into the same directory as your script.
Add the line to your script near the top
- Code: Select all
#include "colorled.gph"
Then use this for blue static color:
- Code: Select all
ColorLED(CB);
There are more examples on how to use the header file near the top of the file.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Need Help with rapidfire script with random timings
@scachi
Works great. Thank you for the help.
Works great. Thank you for the help.
-
Silent_x - Sergeant
- Posts: 9
- Joined: Thu Jul 30, 2020 11:26 pm
Re: Need Help with rapidfire script with random timings
@Scachi - with the final code in the thread, is the hold and release times supposed to be random (based on the min / max ) for (a) every shot while the BUTTON_15 is kept active or (b) for every time the BUTTON_15 is activated?
Just to exemplify:
(a) I press the BUTTON_15 and keep is active, and in this case, the hold and release values will be random every time the combo RapidFire runs
(b) I press the BUTTON_15 and keep it active, and in this case, the hold and release values will be 40 (for instance) for every shot while the combo RapidFire runs. The hold and release values will change the next time I press the Button_15.
The reason I'm asking is that I've added the code line below to my hold/release values but the values are kept constant, such as in the example (b) above. Could you please advise how to make every shot have different hold/release values based on a set of min/max values? Thank you.
Just to exemplify:
(a) I press the BUTTON_15 and keep is active, and in this case, the hold and release values will be random every time the combo RapidFire runs
(b) I press the BUTTON_15 and keep it active, and in this case, the hold and release values will be 40 (for instance) for every shot while the combo RapidFire runs. The hold and release values will change the next time I press the Button_15.
The reason I'm asking is that I've added the code line below to my hold/release values but the values are kept constant, such as in the example (b) above. Could you please advise how to make every shot have different hold/release values based on a set of min/max values? Thank you.
- Code: Select all
irand(RAPIDFIRE_SPEED_TIME_MIN, RAPIDFIRE_SPEED_TIME_MAX)
- My recommendation for learning C programming: 'C Programming Absolute Beginner's Guide'
- Create your own scripts with GPC2 Scripting
- Create your own scripts with GPC2 Scripting
-
jelly44 - Sergeant Major of the Army
- Posts: 220
- Joined: Tue Feb 05, 2019 3:49 pm
12 posts
• Page 1 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 145 guests