> i am trying to keep trck of 25 different "values" which are at first
> randomized between 1 and 150. As soon as the movie starts they will all
> increase its own values until they reach 150 and then they will start do
> decrease until they reach the value of 1 where they will increase back
> again. Since they all will have a randomized value from start i am having a
> bit of a hazzle keeping track of all these values without using 25 globals.
> I have been using lists to make the values randomized and increasing, BUT i
> find it har to know how i should keep track of whether the values are
> increasing or decreasing...I know that the answer to this problem should be
> solved by using some kind of list, but how?
> This was harder than i thought to describe, hope someone can be of
> help....THANX !

You can perform math operations on lists. So, keep two lists. The first has
your "values", the second starts as a list full of the integer 1 (with the
same number of items as the first list). Add the lists, check the results,
and change the signs of any items in the second list that exceed your
maximum or minimum values. Untested:

---------------------
property pValueList
property pAddList

on new me, listIn
  pValueList = listIn
  pAddList = []
  repeat with i = 1 to pValueList.count
    pAddList.add(1)
  end repeat
end

on mResetValues me
  pValueList = pValueList + pAddList
  repeat with i = 1 to pValueList.count
    if pValueList[i] = 150 then
      pAddList[i] = -1
    else if pValueList[i] = 1 then
      pAddList[i] = 1
    end if
  end repeat
end
---------------------


[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!]

Reply via email to