kyma•tweaky . How . StepThroughAnArray

Question (or Task)

I have an array in a Frequency field of a Sample that looks something like: (!KeyDown nextRandom abs * 5 of: #( 30 40 50 60 70)) nn (this is expression is actually from the book) which is helping me understand the nature of arrays and where one can use them...So this expression play's randomly because of nextRandom abs. My question would be how can I play through the array consecutively? My guess is that I would replace the !KeyDown nextRandom abs * 5 with something else. But what?

Solution(s)

Yes, you're right about replacing the nextRandom part of the expression. Here's a hint: if you were to count the triggers you receive from the !KeyDown, then it would give you the numbers in sequence: 0, 1, 2, etc. Then you could use those as the indexes into your array. So you could look in the book for an expression that would count triggers. If you want it to wrap around to the beginning again after it reaches the end, use the version of the expression that includes "mod":

(!KeyDown countTriggersMod: 5) of: #( 30 40 50 60 70)) nn

-- CarlaScaletti - 08 Dec 2006

WebForm
Question: How do I step through the values of an array consecutively, one on each !KeyDown?
Keywords: arrays consecutive sequencer

----- Revision r1.1 - 08 Dec 2006 - 01:31 GMT - CarlaScaletti
Copyright © 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding kyma•tweaky? Send feedback.