Well, it was a general description of how to use a single list instead of many variables using a base name with a 1, 2, 3, etc. appended to it. Here the text of my earlier message:

... If you have a need for something like this, what you really want is a list. Lists are one of the most powerful features of Lingo. Once you get your head around them, you will wonder how you were able to get by without them.

For what you want to do, you should really create a list which would have 25 elements, where each element of the list has the value of 150. This is easily done as follows:

myVariable = []   -- start off as an empty list
repeat with i = 1 to 25
   append(myVariable, 150)
end repeat

Then where ever you would have referenced something with a variable of yours like 'myVariableX', you would instead reference it with 'myVariable[x]'. For example where you would have tried to use myVariable5, use myVariable[5], referring to the 5th element in your list. This can be either on the left or right side of an assignment statement as it:

myVariable[5] = 12

or

someOtherVariable = myVariable[5]

But the real power of lists comes when you start to refer to list elements using other variables as indexes:

myVariable[someIndex] = someValue

I would strongly recommend that you take the time to learn about lists, it will be well work it.

Irv

At 7:34 PM -0700 6/16/05, Buzz Kettles wrote:
this question came up fairly recently -

what you probably want is a proplist with unique names in some way related to particular spritenums

Irv did a great description last time, so I'll let him find his older response :)

-Buzz

At 8:24 AM +1000 6/17/05, you wrote:
Hi list.

It's been a while since I've touched programming. I have string that I would like to convert as a variable-name so that I can use that to call a variable with different values on them.

basically this is what it's supposed to do roughly

on beginspite
myVariable = "myVariable" & the spriteNum of me
end

on mouseUP
put myVariable

end


lingo.ini
-- then you have this here
myVariable1 = "dfddf"
myVariable2 = "etc"
myVariable3 = "etc etc"

thanks for the help

Elvin.


[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 lingo-l@penworks.com (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 lingo-l@penworks.com (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]


--

Multimedia Wrangler.
[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 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to