I have a new idea; in-project coding.
As in, you type stuff in and design stuff, and it interacts.
my big problem is that variables would be a key in this creation, and I don't know of any way to be able for a user to create variables and name them what the want to name them.
Is there any possible way to do this without lists? If there isn't, than could lists work, and how?
Offline
BurritoSM wrote:
I have a new idea; in-project coding.
As in, you type stuff in and design stuff, and it interacts.
my big problem is that variables would be a key in this creation, and I don't know of any way to be able for a user to create variables and name them what the want to name them.
Is there any possible way to do this without lists? If there isn't, than could lists work, and how?
A very simple method using lists does exist. I am not familiar with any methods that could work without them.
Basically:
Create two lists: Name and Value
when the user creates a new "variable," the name is added to the list and a value is added to the value column. You can then recall variables by having the user reference the name or number of the variable and using a repeat block to scan the list of names then simply using that value to recall the variable's value...if that makes sense.
Offline
Offline
set [name v] to [apple] set [i v] to (1) repeat until<(item (i) of [variable names v]) = (name)> change [i v] by (1) end say (item (i) of [values v])
Offline
Essentially, keep the values and names of corresponding variables at the same spot on lists, so that "item 1" on both lists both belong to the first variable created, "item 2' on both lists both belong to the second variable created, etc.
Offline
You locate it by using the script above.
Set "name" in the script above to the variable you want to read.
To set the value of a variable:
set [name v] to [name of var to set] set [value v] to [value you want to set it to] set [i v] to (0) repeat until<(item (i) of [names v]) = (name)> change [i v] by (1) end replace item (i) of [values v] with (value)
Offline
When I broadcast a variable name does the value broadcast with it? I am assuming so but my script doesn't doesn't behave like it. I initially created a variable called sound exist then set sound exist = 0 in the script of one sprite. Then when sprite one does it's thing I broadcast sound exist. Then play sound until done and then change sound exist by one.
In sprite two I created an if else statement: if: sound exist = 0 a forever loop is started, else: sprite two goes to a location and stays there. The problem is: even though the script for sprite one set the variable to 0 It doesn't seem to be evaluated by the if-else statement in sprite two and it bypasses the whole block.
Also, is the broadcast continuous or must you rebroadcast every time a value changes?
Offline