To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 22866
22865  |  22867
Subject: 
nqc macros
Newsgroups: 
lugnet.robotics
Date: 
Tue, 21 Sep 2004 13:01:28 GMT
Original-From: 
roc <principio@SAYNOTOSPAMilimit.es>
Viewed: 
773 times
  
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 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?
best!
r



Message has 1 Reply:
  Re: nqc macros
 
(...) 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; (...) (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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR