> global graw, gbiglist, gblist
>
> on assemble
> gbiglist = []
> gblist = [:]
> repeat with i = 1 to the number of lines in filed("netTextResult")
> graw = member("netTextResult").line[i]
> graw = value(graw)
> if not(field("netTextResult").line[i] = empty) then
> gblist.setaProp(#shape,member(graw[1]))
> gblist.setaProp(#hspeed,graw[2])
> gblist.setaProp(#vspeed,graw[3])
> gblist.setaProp(#rspeed,graw[4])
> gblist.setaProp(#red,graw[5])
> gblist.setaProp(#green,graw[6])
> gblist.setaProp(#blue,graw[7])
> gblist.setaProp(#name,graw[8])
> end if
> gbiglist.add(gblist)
> -- updatestage
> end repeat
>
> end
> at this point the problem is that gbiglist reads:
>
> put gbiglist
> - -- [[#shape: (member 10 of castLib 2), #hspeed: -4, #vspeed: 0, #rspeed: 4,
> #red: 158, #green: 128, #blue: 109, #name: "test_05"], [#shape: (member 10
> of castLib 2), #hspeed: -4, #vspeed: 0, #rspeed: 4, #red: 158, #green: 128,
> #blue: 109, #name: "test_05"], [#shape: (member 10 of castLib 2), #hspeed:
> - -4, #vspeed: 0, #rspeed: 4, #red: 158, #green: 128, #blue: 109, #name:
> "test_05"], [#shape: (member 10 of castLib 2), #hspeed: -4, #vspeed: 0,
> #rspeed: 4, #red: 158, #green: 128, #blue: 109, #name: "test_05"]]
>
> only the last property list repeated 4 times.....
That's because you assign gblist = [] outside of the repeat loop. So, you
are adding gblist to gbiglist four times, and updating the contents of that
list... thus, the last update is what you'll have in all four cases. Put the
gblist = [] inside the repeat loop, and you'll create a fresh list every
time through the loop. 4 different lists, instead of four copies of 1 list.
> then I have 100 empty sprites channels 20 to 120
> with the following behaviour attached..
>
> global gbiglist
> property my ,phspeed, pvspeed, prspeed, pname
>
> on beginsprite me
>
> my = sprite(me.spriteNum)
> x = me.spritenum -19
> my.member = gbiglist[x].shape
> my.color = rgb(gbiglist[x].red,gbiglist[x].green,gbiglist[x].blue)
> phspeed = gbiglist[x].hspeed
> pvspeed = gbiglist[x].vspeed
> prspeed = gbiglist[x].rspeed
> pname = gbiglist[x].name
> my.locH = random(600)
> my.locV = random(500)
> end if
>
> end
>
> on exitframe me
> goh me
> my.rotation = my.rotation + prspeed
> end
> on goh me
> my.locH = my.locH + phspeed
> if my.locH > 700 then
> my.locH = -10
> end if
> if my.locH < -20 then
> my.locH = 700
> end if
> end
>
> the error here reads my.member = gbiglist[x].shape index out of range...
Yes, it would. Once x reaches 5, you are beyond the range of gbiglist (it
only has 4 items).
Try moving the property setting method out of the begin sprite - I'd create
another behavior with an exitFrame script that assigns the values (or just
use a loop in a startmovie or something to set them all at once).
counter = 1
range = gBigList.count
mySprite = 19
repeat with x = 20 to 120
mySprite = mySprite + 1
sendSprite(mySprite, #mSetProperties, gbiglist[counter].shape,\
rgb(gbiglist[counter].red,gbiglist[counter].green,gbiglist[counter].blue),\
gbiglist[counter].hspeed,\
gbiglist[counter].vspeed,\
gbiglist[counter].rspeed,\
gbiglist[counter].name)
if counter < range then
counter = counter + 1
else
counter = 1
end if
end
That way, you stay within the limits of gBigList.
-Kurt
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]