To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 43
42  |  44
Subject: 
Re: NQC tutorial available
Newsgroups: 
lugnet.robotics.rcx.nqc, lugnet.robotics
Date: 
Wed, 31 Mar 1999 02:12:45 GMT
Viewed: 
2623 times
  
In article <F9EKCI.CHD@lugnet.com>, "Boon Poh Tan"
<boon@tigger.ee.washington.edu> wrote:

There is one doubt and two question that I would like to get Mark or other
people's attention.
When I run the example program on section IV(Control Structures for the if
statement) of the tutorial, the Compiler detect an error on line 10, where the
Random function located.
I notice that the problem is cause by the Random function because I have read
in the earlier tutorial saying that we have to assign the Random number to a
variable. After I assign the Random number to a variable the program work just
as expected.
Mark or anybody, please correct me if I am wrong.


"if (Random(100) == 0)" used to be a compiler error, but version 1.2 of
NQC is smart enough to generate a temporary variable to hold the random
number.

A trickier problem is Sleep().  Sleep(Random(100)) parses just fine.
Since Sleep() is just a macro for some bytecode assembly language, there's
no way for the compiler to know that random numbers can't be used as
arguments.  Version 1.3 of NQC will fix this as well.

Dave

--
reply to: dbaum at enteract dot com



Message is in Reply To:
  Re: NQC tutorial available
 
I have gone through most of the tutorial that posted by Mark Overmars which is extremely helpful. What a good job. Thanks Mark. There is one doubt and two question that I would like to get Mark or other people's attention. When I run the example (...) (25 years ago, 30-Mar-99, to lugnet.robotics.rcx.nqc, lugnet.robotics)

8 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