Hi

I am assuming that the list has 8 values? if so this is calling a nineth
value from the list which does not exist. There are 2 ways arround this -
either add a nineth value to the list that is an exact duplicate of the
first value or change the script to check if i<8 and call from position 1 if
i=8 as follows:


repeat with i = 1 to 8
if i < 8 then
        member("canvas").image.draw(getAt(glistOfPointsCatA, i),
getAt(glistOfPointsCatA, i+1), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
                else
        member("canvas").image.draw(getAt(glistOfPointsCatA, 8),
getAt(glistOfPointsCatA, 1), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
end if
end repeat


--
Regards
Niqui

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Neil Sandbach
Sent: Tuesday, July 16, 2002 12:06 PM
To: [EMAIL PROTECTED]
Subject: <lingo-l> Trouble condensing this


Hello,

I've written a simple bit of lingo that uses pairs of points (co-ordinates)
to draw 8 lines onto a blank cast member "canvas." The lines will all
connect into a closed polygon. The pairs of points are extracted from a
list. called glistOfPointsCatA

For starters I had:

    member("canvas").image.draw(getAt(glistOfPointsCatA, 1),
getAt(glistOfPointsCatA, 2), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    member("canvas").image.draw(getAt(glistOfPointsCatA, 2),
getAt(glistOfPointsCatA, 3), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    member("canvas").image.draw(getAt(glistOfPointsCatA, 3),
getAt(glistOfPointsCatA, 4), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    member("canvas").image.draw(getAt(glistOfPointsCatA, 4),
getAt(glistOfPointsCatA, 5), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    member("canvas").image.draw(getAt(glistOfPointsCatA, 5),
getAt(glistOfPointsCatA, 6), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    member("canvas").image.draw(getAt(glistOfPointsCatA, 6),
getAt(glistOfPointsCatA, 7), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    member("canvas").image.draw(getAt(glistOfPointsCatA, 7),
getAt(glistOfPointsCatA, 8), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
    --complete circle/polygon
    member("canvas").image.draw(getAt(glistOfPointsCatA, 8),
getAt(glistOfPointsCatA, 1), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])


This works fine, but I'd like to condense it.
So I've been trying the following:

  repeat with i = 1 to 8
    member("canvas").image.draw(getAt(glistOfPointsCatA, i),
getAt(glistOfPointsCatA, i+1), [#shapeType:#line, #lineSize:2, #color:
rgb(150, 0, 0)])
  end repeat

(Will come to the last 'complete circle/polygon' later).
It almost works (I see the results on screen for a second) then I get the
error: "List expected".
After testing, it seems the i variable is OK to use on its own, but not as
i+1
Even substituting i+1 for something like j where j =i+1 doesn't work.

I feel close but no cigar.
Any thoughts would be appreciated.

Neil

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is
for learning and helping with programming Lingo.  Thanks!]

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to