GPC2 language reference
40 posts
• Page 4 of 4 • 1, 2, 3, 4
Re: GPC2 language reference
No luck, converting the type didn't work:
Original:
Still doesn't work:
Original:
- Code: Select all
random_tee_bag = rand(70, 100);
Still doesn't work:
- Code: Select all
random_tee_bag = rand(70.00, 100.00);
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
Re: GPC2 language reference
pablogroup wrote:No luck, converting the type didn't work:
Original:
- Code: Select all
random_tee_bag = rand(70, 100);
Still doesn't work:
- Code: Select all
random_tee_bag = rand(70.00, 100.00);
The rand function doesn't take any arguments:
It returns a value between 0 and 32767. If you want to get a random number between a certain range, you'll need to create and use your own function:
This will return a number between 0 and the number you specify:
- Code: Select all
int random(int maximum)
{
return ((int) rand() % (maximum + 1));
}
This will return a number between the ranges you specify.
- Code: Select all
int random(int minimum, int maximum)
{
return ((int) rand() % ((maximum + 1) - minimum)) + minimum;
}
If you want to use both of these functions in a script, one of the functions will need to be renamed, AFAIK function overloading isn't allowed in C.
-
PaulaTheKoala - Command Sergeant Major
- Posts: 131
- Joined: Wed Aug 26, 2015 3:45 am
Re: GPC2 language reference
PaulaTheKoala wrote:The rand function doesn't take any arguments:
How do you get that hoverover to appear?
PaulaTheKoala wrote:This will return a number between the ranges you specify.
- Code: Select all
int random(int minimum, int maximum)
{
return ((int) rand() % ((maximum + 1) - minimum)) + minimum;
}
If you want to use both of these functions in a script, one of the functions will need to be renamed, AFAIK function overloading isn't allowed in C.
Thank you!! I finally got my auto-t-bag script to work:
- Code: Select all
int random_tee_bag;
random_tee_bag = random(70, 100);
if(get_val(RELOAD) && event_actived(CROUCH)) {
tee_bag_flag = TRUE;
}
if(get_val(RELOAD) && tee_bag_flag) {
walk_flag = FALSE;
combo_run(TeeBag);
} else if(event_resting(RELOAD)) {
tee_bag_flag = FALSE;
}
combo TeeBag {
set_val(CROUCH, 0);
wait(random_tee_bag);
set_val(CROUCH, 100);
wait(random_tee_bag);
}
int random(int minimum, int maximum)
{
return ((int) rand() % ((maximum + 1) - minimum)) + minimum;
}
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
Re: GPC2 language reference
pablogroup wrote:PaulaTheKoala wrote:The rand function doesn't take any arguments:
How do you get that hoverover to appear?PaulaTheKoala wrote:This will return a number between the ranges you specify.
- Code: Select all
int random(int minimum, int maximum)
{
return ((int) rand() % ((maximum + 1) - minimum)) + minimum;
}
If you want to use both of these functions in a script, one of the functions will need to be renamed, AFAIK function overloading isn't allowed in C.
Thank you!! I finally got my auto-t-bag script to work:
- Code: Select all
int random_tee_bag;
random_tee_bag = random(70, 100);
if(get_val(RELOAD) && event_actived(CROUCH)) {
tee_bag_flag = TRUE;
}
if(get_val(RELOAD) && tee_bag_flag) {
walk_flag = FALSE;
combo_run(TeeBag);
} else if(event_resting(RELOAD)) {
tee_bag_flag = FALSE;
}
combo TeeBag {
set_val(CROUCH, 0);
wait(random_tee_bag);
set_val(CROUCH, 100);
wait(random_tee_bag);
}
int random(int minimum, int maximum)
{
return ((int) rand() % ((maximum + 1) - minimum)) + minimum;
}
Glad to help. Also when you use a left parenthesis as seen in the picture, it should cause the details about the function to show, if it doesn't you may have to hit backspace and try again.
-
PaulaTheKoala - Command Sergeant Major
- Posts: 131
- Joined: Wed Aug 26, 2015 3:45 am
Re: GPC2 language reference
Great! I just tested it and every single time I tried a new function I had to press the back space and try again. It must need to cache it the first time or something.
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
Re: GPC2 language reference
Once you hook up to the Titan 2 which the whole world is going to change for you because some things are not seen til you hook up! Take a deep breath pablogroup and release. lol!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: GPC2 language reference
bonefisher wrote:Once you hook up to the Titan 2 which the whole world is going to change for you because some things are not seen til you hook up! Take a deep breath pablogroup and release. lol!
haha I'm easily excitable. Let the hype flow through you bonefisher, you know you want to take a look at GPC2 code. You know you want it. Give in to temptation..!
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
Re: GPC2 language reference
You know the greatest golf players never show there emotions even when they get that hole in one because it can turn around to get a triple bogie on the next hole because of being to excited. I'll just stay happy medium and await for the hole in one. lol!
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: GPC2 language reference
bonefisher wrote:You know the greatest golf players never show there emotions even when they get that hole in one because it can turn around to get a triple bogie on the next hole because of being to excited. I'll just stay happy medium and await for the hole in one. lol!
- Code: Select all
set_val(HYPE, 100);
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
Re: GPC2 language reference
Sorry guys for let you all without proper answers here. But very glad to see you already figured out some questions raised here.
Tip: Press ctrl+space to list all GPC keywords.
Another tip: everything related to the input/output are fix32 (or accum) type. This is new for Titan Two and allow normalization of the input/output values with from 0.000000 to 100.000000%. Up to 6 decimal places, and resolution of 0.000015.
Tip: Press ctrl+space to list all GPC keywords.
Another tip: everything related to the input/output are fix32 (or accum) type. This is new for Titan Two and allow normalization of the input/output values with from 0.000000 to 100.000000%. Up to 6 decimal places, and resolution of 0.000015.
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
40 posts
• Page 4 of 4 • 1, 2, 3, 4
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 147 guests