Need help with script
9 posts
• Page 1 of 1
Need help with script
Hello! Can some one help me with a code where button 18 or share button toggles, 3 switches.
*So mode 1 switch does nothing- or I guess off swich
*mode 2 turns on red led light and if I press RT runs a combo( rapidfire )
*mode 3 turns off red light and turns on blue light, also hitting RT again will run new combo
*So mode 1 switch does nothing- or I guess off swich
*mode 2 turns on red led light and if I press RT runs a combo( rapidfire )
*mode 3 turns off red light and turns on blue light, also hitting RT again will run new combo
-
alencroat - Lieutenant
- Posts: 320
- Joined: Sun Oct 15, 2017 5:58 pm
Re: Need help with script
cant find anything similar that I need, and I have been searching
-
alencroat - Lieutenant
- Posts: 320
- Joined: Sun Oct 15, 2017 5:58 pm
Re: Need help with script
Hello
you can download Pubg v2 script and read it you can have an idea how it works
example coded by Scachi
i'm learning and only modifying scripts but not a T2 coder
so this is just an idea
you can download Pubg v2 script and read it you can have an idea how it works
example coded by Scachi
- Code: Select all
if (!WeaponHolstered && !bThrow ) {
WeaponActive = (WeaponActive+1)%2;
}
i'm learning and only modifying scripts but not a T2 coder
so this is just an idea
-
Tahsin - Sergeant Major
- Posts: 100
- Joined: Wed May 15, 2019 7:57 am
Re: Need help with script
alencroat wrote:Hello! Can some one help me with a code where button 18 or share button toggles, 3 switches.
*So mode 1 switch does nothing- or I guess off swich
*mode 2 turns on red led light and if I press RT runs a combo( rapidfire )
*mode 3 turns off red light and turns on blue light, also hitting RT again will run new combo
what do yo mean with a new combo?, different Rapid Fire?
You have to be more specific what do you wanted to do.
I mean pressing button 18 can change led to RED and apply rapid-fire type 1 when pressing RT.
Pressing again button 18 it change led to a SKYBLUE and apply a different rapid-fire when pressing RT.
and finally pressing button 18 again, turns led to regular blue (meaning rapid-fire off)
Is that what do you want? it can be done.
However, maybe loosing button 18 function is not advisable, you can run a combo like HOLD LT and then press XB/PS button then release LT o navigate toggles.
Enabling scripts can be a hassle, that's why I wrote mines with a numpad compatibility, so you can use a wireless numeric keypad and enabling/disabling mods by pressing a specific key on the numpad
-
alanmcgregor - Major
- Posts: 981
- Joined: Tue Mar 27, 2018 8:38 am
Re: Need help with script
alanmcgregor wrote:alencroat wrote:Hello! Can some one help me with a code where button 18 or share button toggles, 3 switches.
*So mode 1 switch does nothing- or I guess off swich
*mode 2 turns on red led light and if I press RT runs a combo( rapidfire )
*mode 3 turns off red light and turns on blue light, also hitting RT again will run new combo
what do yo mean with a new combo?, different Rapid Fire?
You have to be more specific what do you wanted to do.
I mean pressing button 18 can change led to RED and apply rapid-fire type 1 when pressing RT.
Pressing again button 18 it change led to a SKYBLUE and apply a different rapid-fire when pressing RT.
and finally pressing button 18 again, turns led to regular blue (meaning rapid-fire off)
Is that what do you want? it can be done.
However, maybe loosing button 18 function is not advisable, you can run a combo like HOLD LT and then press XB/PS button then release LT o navigate toggles.
Enabling scripts can be a hassle, that's why I wrote mines with a numpad compatibility, so you can use a wireless numeric keypad and enabling/disabling mods by pressing a specific key on the numpad
yea pretty much the way I want it, I would like to have one example for future scripts if I need them again. In most cases I usually run out of buttons to use the switches on. And I like to keep it convenient when Im playing. In this case that I need this for I would need to switch between the rapid fires as its needing different rapid fires and stuff for gun. Any chance you can write me that example?
-
alencroat - Lieutenant
- Posts: 320
- Joined: Sun Oct 15, 2017 5:58 pm
Re: Need help with script
I Wrote this should do what you want it by only toggling the Share or button_18
Wrote it in a way that is self explained, hope is clear.
I haven't tested it, my MacMini doesn't work with GTuner XD, but that's the idea.
Wrote it in a way that is self explained, hope is clear.
- Code: Select all
#pragma METAINFO("Basic toggle Rapidfire", 1, 0, "AMG")
//Rapid Fire Burst timings
static uint8 HoldTime = 0;
static uint8 ReleaseTime = 0;
// BUTTONS
#define FIRE (BUTTON_5)
uint8 fireMode = 0;
main {
if(event_release(BUTTON_18)){ //this hijacks BUTTON_18 function, so you can use it as a mod toggle. Share option won't work tho.
set_val(BUTTON_18, 0.0);
fireMode++;
}
if(fireMode > 2) fireMode = 0;
switch(fireMode){
case 1: HoldTime = 100; //Change this values for the burst timing you need.
ReleaseTime = 40;
led_color('P');
break;
case 2: HoldTime = 40;
ReleaseTime = 40;
led_color('S');
break;
default: HoldTime = 0;
ReleaseTime = 0;
led_color('B');
}
// RAPID-FIRE
if(is_active(FIRE) && HoldTime) combo_run(cRapidFire); //it reads: if firing button is pressed AND HoldTime has a value, then run a Rapidfire combo.
if(event_release(FIRE) && HoldTime) combo_stop(cRapidFire); //and stop the rapidfiring when fire button is released
}
combo cRapidFire{
set_val(FIRE, 100.0);
wait(HoldTime);
set_val(FIRE, 0.0);
wait(ReleaseTime);
set_val(FIRE, 0.0);
}
void led_color(uint8 newLight)
{
static uint8 prevLight;
if(newLight == prevLight) return;
prevLight = newLight;
switch(newLight) {
case 'G': // Green LED
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 25.0, 0);
led_set(LED_4, 0.0, 0);
break;
case 'B': // Blue LED
led_set(LED_1, 25.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 0.0, 0);
break;
case 'S': // Sky Blue LED
led_set(LED_1, 50.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 50.0, 0);
led_set(LED_4, 0.0, 0);
break;
case 'P': // Pink LED
led_set(LED_1, 0.0, 0);
led_set(LED_2, 0.0, 0);
led_set(LED_3, 0.0, 0);
led_set(LED_4, 5.0, 0);
break;
}
return;
}
I haven't tested it, my MacMini doesn't work with GTuner XD, but that's the idea.
Last edited by alanmcgregor on Wed Sep 14, 2022 12:57 am, edited 1 time in total.
-
alanmcgregor - Major
- Posts: 981
- Joined: Tue Mar 27, 2018 8:38 am
Re: Need help with script
awesome it works. And thanks, although sometimes it wont switch to other mod. I have seen this before, I think we goto change this part : get_actual to maybe is active or release. Ill try something. And Ill edit my findings
EDIT: ok I found it in my notes and tested it, this one works best for me for switches
many thanks for this script, I hope it will help others too
EDIT: ok I found it in my notes and tested it, this one works best for me for switches
- Code: Select all
if(event_release(BUTTON_18)) { //BEST WAY TO REGISTER
many thanks for this script, I hope it will help others too
-
alencroat - Lieutenant
- Posts: 320
- Joined: Sun Oct 15, 2017 5:58 pm
Re: Need help with script
alanmcgregor wrote: scripts can be a hassle, that's why I wrote mines with a numpad compatibility, so you can use a wireless numeric keypad and enabling/disabling mods by pressing a specific key on the numpad
do you have any examples you could share? It sounds like an amazing idea mods numbered 1-9 easily turned on and off instead of button combos, do you just link the multiply buttons to the number pad? (BUTTON_8 & BUTTON5) linked to "num8" ? If so could I see how this would look? I'm having a hard time trying to visualize it working.
-
GPCNoob - Staff Sergeant
- Posts: 14
- Joined: Wed Nov 25, 2020 2:24 am
9 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: Majestic-12 [Bot] and 118 guests