Subject:
|
Re: personal challange
|
Newsgroups:
|
lugnet.org.ca.rtltoronto
|
Date:
|
Fri, 26 Oct 2001 14:43:39 GMT
|
Viewed:
|
552 times
|
| |
![Post a public reply to this message](/news/icon-reply.gif) | |
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: ![](/news/x.gif) | | 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)
| ![](/news/x.gif) | | 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:
![](/news/x.gif) | | 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: ![personal challange -Chris Magno (21-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/246.gif) ![Re: personal challange -Trevyn Watson (22-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Chris Magno (22-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Trevyn Watson (23-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif)
![](/news/x.gif) ![](/news/268.gif) ![Re: personal challange -David Koudys (22-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif)
![](/news/x.gif) ![](/news/68.gif) ![Re: personal challange -Rob Stehlik (22-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Chris Magno (22-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Rob Stehlik (23-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Chris Magno (25-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Rob Stehlik (25-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Chris Magno (26-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![You are here](/news/here.gif) ![](/news/246.gif) ![Re: personal challange -David Koudys (26-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Chris Magno (26-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -David Koudys (29-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: personal challange -Chris Magno (26-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Rob Stehlik (28-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -Chris Magno (28-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: personal challange -David Koudys (29-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![OT, C64 musings Re: personal challange -Calum Tsang (29-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif) ![](/news/46.gif) ![Re: OT, C64 musings Re: personal challange -David Koudys (29-Oct-01 to lugnet.org.ca.rtltoronto)](/news/x.gif)
- 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
|
|
|
|