Error Question

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

Re: Error Question

Postby J2Kbr » Sun Sep 11, 2016 8:35 pm

Cool. Glad to see a comment in favor of FFB prefix! I liked it as well. It is simple and short, like the LED prefix.

Each FFB have two parameters: force and duration. The force feedback "signal" from steering wheels can be converted to this same parameters.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Error Question

Postby Prototype » Sun Sep 11, 2016 9:01 pm

OK like that with two parameters it's perfect.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3252
Joined: Sun Dec 16, 2012 1:43 pm

Re: Error Question

Postby pablosscripts » Mon Sep 12, 2016 12:26 am

J2Kbr wrote:set_val is the only IO function that accepts fix32 and int as values. If an int is provided, it internally converts to fix32. I did this to make easy use int values to set the outputs without use type cast, or be forced to use 32bits variables where it is not needed.


Could you please elaborate on this, for someone who is not a programmer?

Does that mean set_val is the only one that accepts values like this:

Code: Select all
set_val(button, 100)


While every other function requires you to cast it first, like this:

Code: Select all
if((int) get_val(BUTTON)) > 100)


Also in what scenarios would I use fix32 vs. int? Is it just a matter of more precision?
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: Error Question

Postby J2Kbr » Mon Sep 12, 2016 1:21 am

You are correct in your examples. And also on the scenarios, a int -100 to 100 has "only" 200 points of resolution, on the other hand, a fix32 -in the same range- have 13,333,333 points of resolution. For regular buttons this should not make any difference, but in case of mouse translation the extra resolution will have a significant positive impact.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Error Question

Postby pablosscripts » Mon Sep 12, 2016 1:24 am

thanks for clarifying!
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

Previous

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 140 guests

cron