To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.org.ca.rtltorontoOpen lugnet.org.ca.rtltoronto in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Organizations / Canada / rtlToronto / 2661
2660  |  2662
Subject: 
Re: personal challange
Newsgroups: 
lugnet.org.ca.rtltoronto
Date: 
Fri, 26 Oct 2001 14:43:39 GMT
Viewed: 
552 times
  
In lugnet.org.ca.rtltoronto, Chris Magno writes:

HUmm, no one has offered step by step help on this:

I am running 2.0 of the firmware,   Just not using NQC.  I AM using the
lego script and from what I remember it should make use of ALL the
functions.   how could a new NQC offer arrays, YET the script language
not???

AND even so, can you post a bit of sample code in NQC with arrays???

Chris, I'm not sure why NQC would offer arrays and the scripting language
wouldn't. I am certainly not the resident programming expert:) Anyway, I can
send you some code when I get home. I copied the following directly from the
NQC documentation:

2.2.5 Arrays
The RCX2 target supports arrays (the other targets do not have suitable
support in firmware for arrays). Arrays are declared the same way as
ordinary variables, but with the size of the array enclosed in brackets. The
size must be a constant.
int my_array[3] ; / / declare an array with three elements
The elements of an array are identified by their position within the array
(called an index). The first element has an index of 0, the second has index
1, etc. For example:
my_array[0] = 123 ; // set first element to 123
Currently there are a number of limitations on how arrays can be used. These
limitations
will likely be removed in future versions of NQC:
•An array cannot be an argument to a function. An individual array element,
however, can be passed to a function.
• Neither arrays nor their elements can be used with the increment (++) or
decrement (--) operators.
•Only ordinary assignment (=) is allowed for array elements. The math
assignments (i.e. +=) are not allowed.
• The initial values for an array's elements cannot be specified - an explicit
assignment is required within the program itself to set the value of an element.

Hope this helps,
Rob



Message has 2 Replies:
  Re: personal challange
 
(...) Once again my appreciation for Rob goes up a notch. I actually understood mostof what he said :) I was thinking, originally, about getting a 4x4 black plate, and 16 1x1 round white plates (headlights), putting the pattern of white 'dots' on (...) (23 years ago, 26-Oct-01, to lugnet.org.ca.rtltoronto)
  Re: personal challange
 
(...) ROB, you are the best.!!!!!! this bit of documentation was all the answer i needed. thank you!!! its a shame that you have to use a constant to assign the array. :( BUt this is better than nothing. I guess i have to start to learn NQC (...) (23 years ago, 26-Oct-01, to lugnet.org.ca.rtltoronto)

Message is in Reply To:
  Re: personal challange
 
(...) HUmm, no one has offered step by step help on this: I am running 2.0 of the firmware, Just not using NQC. I AM using the lego script and from what I remember it should make use of ALL the functions. how could a new NQC offer arrays, YET the (...) (23 years ago, 26-Oct-01, to lugnet.org.ca.rtltoronto)

21 Messages in This Thread:




Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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