actually the short way returns an error

Ops ops at myesa.com
Sat Feb 21 11:51:47 EST 2004


Christopher,

Actually, Malte also responded with the corrected "shorter" version and 
he is correct.  My bad, in my zeal to explain the difference between a 
quoted literal string and the actual object name, I overlooked the 
fundamental syntax of what I sent!!  SORRY!!

In the example I sent, there is a precedence problem.  To make the 
evaluation sequence clear for the Rev engine, enclose "pointer" & i in 
double quotes.  This tells the Rev engine to "do this first".  So, (as 
Malte already stated) the corrected version is:

repeat with i = 1 to 3
      set the angle of graphic ("pointer" & i) to rotAngle
end repeat

The precedence is generally pretty intuitive as to how you the human 
(programmer) thinks...but...in some cases one must override the 
precedence rules by surrounding certain constructs inside ()'s in order 
to indicate to the engine that these phrases (the one's in ()'s) should 
be done FIRST.

Again, sorry, and hope this is *all* clear now :)

Opie

P.S. Don't know what kind of graphic that pointer1 is...but...in my 
test, although it compiled correctly with the above...*my* pointer1 
didn't seem to rotate...don't know why, but I also tried it with an 
image and it worked perfectly...I usually manipulate a graphic by 
changing it's points property...

Cheers!!

Christopher Mitchell wrote:

> Opie,
> 
> I think the thing that confused me from the beginning and caused me to 
> use that variable was that putting in :
> 
> repeat with i = 1 to 3
>     set the angle of graphic "pointer" & i to rotAngle
> end repeat
> 
> returns an error in the script debugger of type: set, missing 'to'  .... 
> so by putting in the concatenation, the set command does not follow to 
> the "to" ... and of course, you can't put the i counter in quotes, so 
> that's why I started pulling it out of the line.
> 
> Is there a good reason why the script shouldn't like the inline 
> concatenation though? that seems absurd.
> 
> Yours,
> Chris
> On Feb 21, 2004, at 6:15 AM, Ops wrote:
> 
>> set the angle of graphic "pointer" & i to rotAngle
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 


More information about the use-livecode mailing list