What data type is BUTTON_1 and can i turn it into variable?
4 posts
• Page 1 of 1
What data type is BUTTON_1 and can i turn it into variable?
I'm trying to make a script that check for what button is pressed then choose it to activate whenever certain combination of buttons is used. So i want to use BUTTON_X as a variable instead of #DEFINE it. Something like this.
If it is not possible is there any other way?
- Code: Select all
datatype ActivatedBTN = BUTTON_1
main {
if(get_val(BUTTON_5) > 99.9){
if(is_active(BUTTON_10)){
set_val(BUTTON_10, 0.0);
if(is_active(BUTTON_16)){
ActivatedBTN = BUTTON_16
}
if(is_active(BUTTON_17)){
ActivatedBTN = BUTTON_17
}
}
else if(is_active(BUTTON_11)){
set_val(BUTTON_11, 0.0);
set_val(ActivatedBTN, 100.0);
}
}
}
If it is not possible is there any other way?
-
neit720 - Master Sergeant
- Posts: 26
- Joined: Sun Oct 21, 2018 10:25 am
Re: What data type is BUTTON_1 and can i turn it into variab
Yes, you can use variables to check the inputs. The data type should be uint8.
- Code: Select all
uint8 ActivatedBTN = BUTTON_1;
main {
if(get_val(BUTTON_5) > 99.9){
if(is_active(BUTTON_10)){
set_val(BUTTON_10, 0.0);
if(is_active(BUTTON_16)){
ActivatedBTN = BUTTON_16;
}
if(is_active(BUTTON_17)){
ActivatedBTN = BUTTON_17;
}
}
else if(is_active(BUTTON_11)){
set_val(BUTTON_11, 0.0);
set_val(ActivatedBTN, 100.0);
}
}
}
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
Re: What data type is BUTTON_1 and can i turn it into variab
Thank you! Really enjoy the Titan Two 1 year in :D
-
neit720 - Master Sergeant
- Posts: 26
- Joined: Sun Oct 21, 2018 10:25 am
Re: What data type is BUTTON_1 and can i turn it into variab
You are welcome
ConsoleTuner Support Team
-
J2Kbr - General of the Army
- Posts: 20323
- Joined: Tue Mar 18, 2014 1:39 pm
4 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: midg3t2 and 129 guests