Subject:
|
Re: nqc macros
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Tue, 21 Sep 2004 13:51:07 GMT
|
Viewed:
|
1031 times
|
| |
| |
> i figured out how to do it with 2, using a random number from 0-1
> and a subsequent if/else statement, but i understand the if statement
> cannot deal with more than 2 results, right?
> hints?
You could use a lot of nested "if", but the best solution is to use the "switch"
statement (excerpt from NQC help file):
switch(x)
{
case 1:
// do something when x is 1
break;
case 2:
case 3:
// do something else when x is 2 or 3
break;
default:
// do this when x is not 1, 2, or 3
break;
}
Philo
|
|
Message is in Reply To:
| | nqc macros
|
| hi i'm a nqc newbie trying to figure out tasks, subroutines etc. i have a program with (say) 5 macros to move the robot around. I want the robot to constantly shuffle around these macros in a random way. i figured out how to do it with 2, using a (...) (20 years ago, 21-Sep-04, to lugnet.robotics)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|