if condition not working
11 posts
• Page 2 of 2 • 1, 2
Re: if condition not working
DontAtMe wrote:maybe this ?
- Code: Select all
main {
if(is_active(BUTTON_8)){
if(event_active(BUTTON_5)){
cLeanLeft = is_active(BUTTON_9);
cLeanRight = is_active(BUTTON_6);
}
}
}
combo cLeanLeft {
wait(110);
set_val(BUTTON_6, 100);
set_val(BUTTON_9, 0);
wait(110);
}
combo cLeanRight {
wait(110);
set_val(BUTTON_9, 100);
set_val(BUTTON_6, 0);
wait(110);
}
Edit: Actually I think I understand what the OP is asking for.
I had to read thru the previous posts a couple more times, I am pretty sure this is what he's trying to do
@Derivates give this last script a try.
- Code: Select all
main {
uint32 timer;
//---
if(is_active(BUTTON_8)){
timer+=elapsed_time();
if(event_active(BUTTON_6) || event_active(BUTTON_9)) timer = 0;
if(event_active(BUTTON_5) && (is_release(BUTTON_6) && is_release(BUTTON_9))){
cLeanLeft = !check_release(BUTTON_9, timer);
cLeanRight = !check_release(BUTTON_6, timer);
}
} else timer = 0;
//---
}
combo cLeanLeft {
set_val(BUTTON_6, 100);
wait(110);
set_val(BUTTON_9, 100);
wait(110);
}
combo cLeanRight {
set_val(BUTTON_9, 100);
wait(110);
set_val(BUTTON_6, 100);
wait(110);
}
The second attempt worked perfectly, thanks a lot.
-
Derivates - Sergeant Major
- Posts: 75
- Joined: Sat Jan 19, 2019 6:15 pm
11 posts
• Page 2 of 2 • 1, 2
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 66 guests