Question about Get_Val for Acceleration
3 posts
• Page 1 of 1
Question about Get_Val for Acceleration
Hey everyone!
Just picked up the titan two and loving it so far however I had a question about using data from get_val. Right now I'm trying to use the JoyCon's acceleration/gyro by using get_val however I received an error.
error received:
I could be mis-remembering but I thought I was able to do this with the wiimote on the TitanOne using get_val(WII_ACCX) without an issue. What am I doing wrong in this case?
Thanks ahead of time!
Just picked up the titan two and loving it so far however I had a question about using data from get_val. Right now I'm trying to use the JoyCon's acceleration/gyro by using get_val however I received an error.
- Code: Select all
main
{
// movement based running using red joycon on leg strap
if(get_val(ACCEL_1_Y) > 30)
{
set_val(STICK_1_Y, 100);
}
}
error received:
- Code: Select all
GPC error: joycon_Workout.gpc(37): Illegal operation '>'.
I could be mis-remembering but I thought I was able to do this with the wiimote on the TitanOne using get_val(WII_ACCX) without an issue. What am I doing wrong in this case?
Thanks ahead of time!
-
atwerkingyoshi - Private First Class
- Posts: 2
- Joined: Sun Oct 15, 2017 5:27 pm
Re: Question about Get_Val for Acceleration
get_val returns a "fix32" value now on the T2.
add .0 to you comparing number:
wiki : scripting : data types
wiki : scripting : gpc language reference explained
add .0 to you comparing number:
- Code: Select all
main
{
// movement based running using red joycon on leg strap
if(get_val(ACCEL_1_Y) > 30.0)
{
set_val(STICK_1_Y, 100); // set_val can handle int or decimal as this works too: set_val(STICK_1_Y, 100.0);
}
}
wiki : scripting : data types
wiki : scripting : gpc language reference explained
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Question about Get_Val for Acceleration
Ohhh that makes sense now. Completely forgot about the data types.
Thank you very much!
Thank you very much!
-
atwerkingyoshi - Private First Class
- Posts: 2
- Joined: Sun Oct 15, 2017 5:27 pm
3 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 148 guests