How do I block a button for 2-3 seconds?
10 posts
• Page 1 of 1
How do I block a button for 2-3 seconds?
I use auto or easy sprint functions on some of my FPS games. The problem is when easy-sprint is enabled ( usually by holding forward on LS) it cancels my re-load cycle animation which usually takes 2-3 seconds. What I want is to know how to write a script that will block the sprint button after pushing re-load for 2-3 seconds. Can anyone help?
-
theORDOG - Master Sergeant
- Posts: 27
- Joined: Tue Sep 16, 2014 8:42 pm
Re: How do I block a button for 2-3 seconds?
Never actually used the block function personally, but according to the GPC LLanguage Reference the following should work:
- Code: Select all
int Reload = XB1_X;
int Sprint = XB1_LS;
main {
if(event_press(Reload)){
block(Sprint, 3000);
}
}
-
Elvish - Captain
- Posts: 531
- Joined: Tue Jun 09, 2015 4:57 am
Re: How do I block a button for 2-3 seconds?
- Code: Select all
/ Tue Jul 21 2015 14:30:26
// Script generated by Visual to GPC
//----------------------------------------
main {
swap(XB1_RB, XB1_RS);
if(event_press(XB1_RS)) {
combo_run(Tap_1);
}
int Reload = XB1_X;
int Sprint = XB1_LS;
main {
if(event_press(Reload)){
block(Sprint, 3000);
}
}
}
}
main {
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
}
combo Turbo_1 {
set_val(XB1_A, 100);
wait(40);
set_val(XB1_A, 0);
wait(30);
set_val(XB1_A, 0);
}
combo Tap_1 {
set_val(XB1_A, 0);
wait(400);
set_val(XB1_A, 100);
wait(40);
set_val(XB1_A, 100);
}
I get this error when I try to compile my script.
syntax error near unexpected token 'int'.
Build failed with 1 errors
-
theORDOG - Master Sergeant
- Posts: 27
- Joined: Tue Sep 16, 2014 8:42 pm
Re: How do I block a button for 2-3 seconds?
Thats because you added a second main function, you can have only one. Try this:
Again I have never used the block function, tell me if this is not working properly and I will try to fix it. I blocked the Left stick input, and have a feeling you want the A button blocked? According to what you pasted though you want the stick blocked and not the A blocked.
- Code: Select all
main {
swap(XB1_RB, XB1_RS);
if(event_press(XB1_RS)) {
combo_run(Tap_1);
}
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
if(event_press(XB1_X)){
block(XB1_LY, 3000);
}
}
combo Turbo_1 {
set_val(XB1_A, 100);
wait(40);
set_val(XB1_A, 0);
wait(30);
set_val(XB1_A, 0);
}
combo Tap_1 {
set_val(XB1_A, 0);
wait(400);
set_val(XB1_A, 100);
wait(40);
set_val(XB1_A, 100);
}
Again I have never used the block function, tell me if this is not working properly and I will try to fix it. I blocked the Left stick input, and have a feeling you want the A button blocked? According to what you pasted though you want the stick blocked and not the A blocked.
-
Elvish - Captain
- Posts: 531
- Joined: Tue Jun 09, 2015 4:57 am
Re: How do I block a button for 2-3 seconds?
This one does not work either, auto sprint works but when I reload it does not block the sprint for 3 seconds.
- Code: Select all
int Reload = XB1_X ;
int Sprint = XB1_LS ;
main {
if (event_press(Reload)) {
block (Sprint, 3000) ;
}
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
}
combo Turbo_1 {
set_val(XB1_LS, 100);
wait(40);
set_val(XB1_LS, 0);
wait(30);
set_val(XB1_LS, 0);}
-
theORDOG - Master Sergeant
- Posts: 27
- Joined: Tue Sep 16, 2014 8:42 pm
Re: How do I block a button for 2-3 seconds?
This one didn't work for me either:
- Code: Select all
main {
if(get_val(XB1_X)){
set_val(XB1_LS, 0);
block(XB1_LS, 3000);//block for 3000ms
}
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
}
combo Turbo_1 {
set_val(XB1_LS, 100);
wait(40);
set_val(XB1_LS, 0);
wait(30);
set_val(XB1_LS, 0);
}
-
theORDOG - Master Sergeant
- Posts: 27
- Joined: Tue Sep 16, 2014 8:42 pm
Re: How do I block a button for 2-3 seconds?
the block function does not works conditioned to other button event. I edited your script and now it should work as you want.
- Code: Select all
define SPRINT_BLOCK = 3000;
int tv = SPRINT_BLOCK;
main {
if(event_press(XB1_X)){
tv = 0;
}
if(tv < SPRINT_BLOCK) {
tv = tv + get_rtime();
set_val(XB1_LS, 0);
}
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
}
combo Turbo_1 {
set_val(XB1_LS, 100);
wait(40);
set_val(XB1_LS, 0);
wait(30);
set_val(XB1_LS, 0);
}
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: How do I block a button for 2-3 seconds?
I got it to work here is what I came up with:
- Code: Select all
//
// Mon Oct 26 2015 11:27:45
// Script generated by Visual to GPC
//----------------------------------------
main {
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
if((get_val(XB1_X)==100)){
combo_run(Turbo_2);
}
}
combo Turbo_1 {
set_val(XB1_LS, 100);
wait(40);
set_val(XB1_LS, 0);
wait(30);
set_val(XB1_LS, 0);
}
combo Turbo_2 {
set_val(XB1_LS, 100);
wait(1500);
set_val(XB1_LS, 0);
wait(1500);
set_val(XB1_LS, 0);
}
-
theORDOG - Master Sergeant
- Posts: 27
- Joined: Tue Sep 16, 2014 8:42 pm
Re: How do I block a button for 2-3 seconds?
Great! Thanks for sharing your code!
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: How do I block a button for 2-3 seconds?
theORDOG wrote:I got it to work here is what I came up with:
- Code: Select all
//
// Mon Oct 26 2015 11:27:45
// Script generated by Visual to GPC
//----------------------------------------
main {
if((get_val(XB1_LY)) < -95) {
combo_run(Turbo_1);
}
if((get_val(XB1_X)==100)){
combo_run(Turbo_2);
}
}
combo Turbo_1 {
set_val(XB1_LS, 100);
wait(40);
set_val(XB1_LS, 0);
wait(30);
set_val(XB1_LS, 0);
}
combo Turbo_2 {
set_val(XB1_LS, 100);
wait(1500);
set_val(XB1_LS, 0);
wait(1500);
set_val(XB1_LS, 0);
}
This could be just what I'm looking for, thanks.
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR
My R6 script: https://youtu.be/x-9NtxyySVM
My R6 script: https://youtu.be/x-9NtxyySVM
-
pablosscripts - Brigadier General
- Posts: 1976
- Joined: Tue Nov 24, 2015 6:27 am
10 posts
• Page 1 of 1
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 56 guests