GPC2 language reference

GPC2 script programming for Titan Two. Code examples, questions, requests.

Re: GPC2 language reference

Postby pablosscripts » Thu Sep 08, 2016 12:34 am

FCB77 wrote:i tried to convert my old fifa16 script and after some trial and error it finally compiled without errors.
my old fifa script for T1 had a lot of commented code because it used all 100% T1 memory, now i uncommented the code for T2 and it says it is using only 14%
GPC: Memory usage: Static: 152 bytes (14.84%), Dynamic: 16 bytes (1.56%)
lol there is a lot of space in T2. :smile0202:


Mine went from 99.9% usage to 11.33%.

This means T2 can support scripts 7 to 9 times larger in size. Holy crap.
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
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: GPC2 language reference

Postby pablosscripts » Thu Sep 08, 2016 12:43 am

Oh my god my friend who is a programmer just told me I could use this:

Code: Select all
if(get_val(MOV_Y_AXIS) <= -97.00)


Instead of this:

Code: Select all
if((int) get_val(MOV_Y_AXIS) <= -97)


or this:

Code: Select all
if(get_val(MOV_Y_AXIS) <= -97f)


I just tested this and it works!

I'm no programmer so I honestly don't know what the best approach is, I'm hoping someone more knowledgeable can chime in. I don't want to use more memory than I need to, I want to make it super efficient.

I'm going to update my guide now.

viewtopic.php?f=23&t=4609
Last edited by pablosscripts on Thu Sep 08, 2016 1:44 am, edited 1 time in total.
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
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: GPC2 language reference

Postby bonefisher » Thu Sep 08, 2016 1:19 am

You can also dial in your rapid fires :innocent_smile_1: under the 1ms mark.
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: GPC2 language reference

Postby PaulaTheKoala » Thu Sep 08, 2016 2:45 am

pablogroup wrote:Oh my god my friend who is a programmer just told me I could use this:

Code: Select all
if(get_val(MOV_Y_AXIS) <= -97.00)


Instead of this:

Code: Select all
if((int) get_val(MOV_Y_AXIS) <= -97)


or this:

Code: Select all
if(get_val(MOV_Y_AXIS) <= -97f)


I just tested this and it works!

I'm no programmer so I honestly don't know what the best approach is, I'm hoping someone more knowledgeable can chime in. I don't want to use more memory than I need to, I want to make it super efficient.

I'm going to update my guide now.

viewtopic.php?f=23&t=4609


Doing -97.00 or -97f are the same, by using a decimal you convert the number to fix32 and as Bonefisher said you can be more precise.

You have plenty of space so you shouldn't worry too much about being efficient, the compiler does lots of optimizations so you should be fine.
User avatar
PaulaTheKoala
Command Sergeant Major
Command Sergeant Major
 
Posts: 131
Joined: Wed Aug 26, 2015 3:45 am

Re: GPC2 language reference

Postby pablosscripts » Thu Sep 08, 2016 3:36 am

Great thanks for that feedback.

Without J2Kbr here it feels like we're paving the way here!
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
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: GPC2 language reference

Postby pablosscripts » Thu Sep 08, 2016 8:04 am

I'm so close now to getting it to compile 100%. Here's what I have left:

sensitivity() - I can't find an equivalent
deadzone() - I can't find an equivalent
irand() - I can't find an equivalent, I thought it was rand() but it doesn't work
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
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: GPC2 language reference

Postby Scachi » Thu Sep 08, 2016 11:24 am

pablogroup wrote:I'm so close now to getting it to compile 100%. Here's what I have left:

sensitivity() - I can't find an equivalent
deadzone() - I can't find an equivalent
irand() - I can't find an equivalent, I thought it was rand() but it doesn't work


How do you know that rand() isn't working ?

This compiles for me, but I can't test it.
Code: Select all
fix32 rtest;

rtest = rand();
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: GPC2 language reference

Postby pablosscripts » Thu Sep 08, 2016 2:08 pm

Scachi wrote:
pablogroup wrote:I'm so close now to getting it to compile 100%. Here's what I have left:

sensitivity() - I can't find an equivalent
deadzone() - I can't find an equivalent
irand() - I can't find an equivalent, I thought it was rand() but it doesn't work


How do you know that rand() isn't working ?

This compiles for me, but I can't test it.
Code: Select all
fix32 rtest;

rtest = rand();


I was testing rand(30, 70);

It occurs to me that I've probably made the same mistake again and forgotten to convert the parameters into an int first. I'll test this when I get back to my PC.
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
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: GPC2 language reference

Postby Scachi » Thu Sep 08, 2016 3:34 pm

I didn't see that rand takes arguments. Maybe you have to use clamp with rand to get the desired result.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: GPC2 language reference

Postby pablosscripts » Thu Sep 08, 2016 11:01 pm

Scachi wrote:I didn't see that rand takes arguments. Maybe you have to use clamp with rand to get the desired result.



Yeah it takes two arguments to generate a random number between. So if you set it to 1 and 10 it will generate a random number between the two.

I use it to prevent anti-cheat systems from detecting me. It reduces the consistency between certain automatic actions.
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
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 108 guests