Discuss Scratch
- Discussion Forums
- » Suggestions
- » List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
- zazashrooms
-
Scratcher
73 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
the list dropdown allows selection of list to run through items
the # is for numbers, (#) to (#) is for example loop through List items 2 to 32.
Also, this variable when put into a comparer will output the value that matched the value of the value the variable is comparing with, this behaviour is disableable, to output true put the comparer in a Join Block or to output 1 or 0 put it in a math operator.
I want this specifically to make a more efficient and less cost heavy loop through list script specifically for making multiple cooldown objects.
i want a way to get cooldowns more efficiently, because typically if something is a built in feature then using less blocks causes less data or whatever to be used.
I believe that brackes “{}” are how tables are formed in plenty coding languages.
example, if you put this a Set Variable Block, and the following objects are {3, ksi, true, 500} in list called MYLIST and use the “
List Items 1 to 4 and return object positions or objects? (Objects) variable will set the variables value to the Objects values (objects 1,4) in order and the values are spaced out, the variable will now be (3 ksi true 500), object positions will out the positions of object in order (1 2 3 4).
What does this mean for Boolean statements?
MYLIST = {3, ksi, true, 500}
You can put it in comparers, example: If 3 = List items (1) to (4) and output object positions or objects? (objects)
so basically when any object that is equal to 3 in MYLIST in this example gets looped through (probally looped through via For loop, which usaully means the ”index" number reaches object position which allows the value of object to be read).
the # is for numbers, (#) to (#) is for example loop through List items 2 to 32.
Also, this variable when put into a comparer will output the value that matched the value of the value the variable is comparing with, this behaviour is disableable, to output true put the comparer in a Join Block or to output 1 or 0 put it in a math operator.
I want this specifically to make a more efficient and less cost heavy loop through list script specifically for making multiple cooldown objects.
i want a way to get cooldowns more efficiently, because typically if something is a built in feature then using less blocks causes less data or whatever to be used.
I believe that brackes “{}” are how tables are formed in plenty coding languages.
example, if you put this a Set Variable Block, and the following objects are {3, ksi, true, 500} in list called MYLIST and use the “
List Items 1 to 4 and return object positions or objects? (Objects) variable will set the variables value to the Objects values (objects 1,4) in order and the values are spaced out, the variable will now be (3 ksi true 500), object positions will out the positions of object in order (1 2 3 4).
What does this mean for Boolean statements?
MYLIST = {3, ksi, true, 500}
You can put it in comparers, example: If 3 = List items (1) to (4) and output object positions or objects? (objects)
so basically when any object that is equal to 3 in MYLIST in this example gets looped through (probally looped through via For loop, which usaully means the ”index" number reaches object position which allows the value of object to be read).
Last edited by zazashrooms (Today 12:31:14)
- ZephyrF
-
Scratcher
15 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
Do you mean a block to do this ?
I believe that brackes “{}” are how tables are formed in plenty coding languages.
example, if you put this a Set Variable Block, and the following objects are {3, ksi, true, 500} in list called MYLIST and use the "
List Items 1 to 4 and return object positions or objects? (Objects) variable will set the variables value to the Objects values (objects 1,4) in order and the values are spaced out, the variable will now be (3 ksi true 500), object positions will out the positions of object in order (1 2 3 4).
set [start v] to [5]
set [end v] to [10]
set [i v] to (start)
set [text v] to []
Creat List
repeat ((end) - (start))
set [text v] to (join (text) (item (i) of [list v] :: list))
change [i v] by [1]
end
Define Creat List
delete all of [list v]
add [3] to [list v]
add [ksi] to [list v]
add [true] to [list v]
add [500] to [list v]
What does this mean for Boolean statements?
MYLIST = {3, ksi, true, 500}
You can put it in comparers, example: If 3 = List items (1) to (4) and output object positions or objects? (objects)
so basically when any object that is equal to 3 in MYLIST in this example gets looped through (probally looped through via For loop, which usaully means the “index” number reaches object position which allows the value of object to be read).
set [start v] to [5]
set [end v] to [10]
set [i v] to [0]
set [value v] to (start)
set [return boolean v] to [false]
Creat List
repeat until <<(item (i) of [list v] :: list) = (value)> or <(i) > (end)>>
change [i v] by [1]
end
if <(item (i) of [list v] :: list) = (value)> then
set [return boolean v] to [true]
Define Creat List
delete all of [list v]
add [3] to [list v]
add [ksi] to [list v]
add [true] to [list v]
add [500] to [list v]
- zazashrooms
-
Scratcher
73 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
Do you mean a block to do this ?I believe that brackes “{}” are how tables are formed in plenty coding languages.
example, if you put this a Set Variable Block, and the following objects are {3, ksi, true, 500} in list called MYLIST and use the "
List Items 1 to 4 and return object positions or objects? (Objects) variable will set the variables value to the Objects values (objects 1,4) in order and the values are spaced out, the variable will now be (3 ksi true 500), object positions will out the positions of object in order (1 2 3 4).set [start v] to [5]
set [end v] to [10]
set [i v] to (start)
set [text v] to []
Creat List
repeat ((end) - (start))
set [text v] to (join (text) (item (i) of [list v] :: list))
change [i v] by [1]
end
Define Creat List
delete all of [list v]
add [3] to [list v]
add [ksi] to [list v]
add [true] to [list v]
add [500] to [list v]What does this mean for Boolean statements?
MYLIST = {3, ksi, true, 500}
You can put it in comparers, example: If 3 = List items (1) to (4) and output object positions or objects? (objects)
so basically when any object that is equal to 3 in MYLIST in this example gets looped through (probally looped through via For loop, which usaully means the “index” number reaches object position which allows the value of object to be read).set [start v] to [5]
set [end v] to [10]
set [i v] to [0]
set [value v] to (start)
set [return boolean v] to [false]
Creat List
repeat until <<(item (i) of [list v] :: list) = (value)> or <(i) > (end)>>
change [i v] by [1]
end
if <(item (i) of [list v] :: list) = (value)> then
set [return boolean v] to [true]
Define Creat List
delete all of [list v]
add [3] to [list v]
add [ksi] to [list v]
add [true] to [list v]
add [500] to [list v]
This is exactly it.
- zazashrooms
-
Scratcher
73 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
Bump
- zazashrooms
-
Scratcher
73 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
Bump
- _nix
-
Scratcher
1000+ posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
You can put it in comparers, example: If 3 = List items (1) to (4) and output object positions or objects? (objects)Here's a visualization of your specific suggested block.
so basically when any object that is equal to 3 in MYLIST in this example gets looped through (probally looped through via For loop, which usaully means the ”index" number reaches object position which allows the value of object to be read).
if <(3) = (list items (1) to (4) of [MYLIST v] and output [objects v] :: list)> then
end
I added the “of MYLIST” part above.
Personally, I would rephrase it slightly:
… ([items v] from (1) to (4) of [MYLIST v] :: list)> :: #eee
… ([item positions v] from (1) to (4) of [MYLIST v] :: list)> :: #eee // or "item #'s"
Can you share an example of when you would choose “object positions” / “item positions”, instead of “objects” / “items”?
- zazashrooms
-
Scratcher
73 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
Also lets just say MYLIST has a bunch of cooldown values in all the objectsYou can put it in comparers, example: If 3 = List items (1) to (4) and output object positions or objects? (objects)Here's a visualization of your specific suggested block.
so basically when any object that is equal to 3 in MYLIST in this example gets looped through (probally looped through via For loop, which usaully means the ”index" number reaches object position which allows the value of object to be read).if <(3) = (list items (1) to (4) of [MYLIST v] and output [objects v] :: list)> then
end
I added the “of MYLIST” part above.
Personally, I would rephrase it slightly:… ([items v] from (1) to (4) of [MYLIST v] :: list)> :: #eee
… ([item positions v] from (1) to (4) of [MYLIST v] :: list)> :: #eee // or "item #'s"
Can you share an example of when you would choose “object positions” / “item positions”, instead of “objects” / “items”?
if <(8) = (List Items (1) to (4) of [MYLIST v], output [object value v] :: list> then
move (999 trillion billion gazillion jeffery bezo dollars from inches converted to pixels length) steps
end
<[8] = [List Items (1) to (4) of [MYLIST v], output [object value v] :: list>
outputs True or 1 if put in math operator because a object that was looped through by the variable was equal to 3
Last edited by zazashrooms (Today 01:32:27)
- _nix
-
Scratcher
1000+ posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
Also lets just say MYLIST has a bunch of cooldown values in all the objectsI think that makes sense and is a good use for the block, but it's another example of using “object value”. I'm curious about when you would use the option “object position”.if <(8) = (List Items (1) to (4) of [MYLIST v], output [object value v] :: list> then
move (999 trillion billion gazillion jeffery bezo dollars from inches converted to pixels length) steps
end
<[8] = [List Items (1) to (4) of [MYLIST v], output [object value v] :: list>
outputs True or 1 if put in math operator because a object that was looped through by the variable was equal to 3
Last edited by _nix (Today 09:45:52)
- zazashrooms
-
Scratcher
73 posts
List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!
I updated the description of it in the first message “Also, this variable when put into a comparer will output the value that matched the value of the value the variable is comparing with, this behaviour is disableable, to output true put the comparer in a Join Block or to output 1 or 0 put it in a math operator.”Also lets just say MYLIST has a bunch of cooldown values in all the objectsI think that makes sense and is a good use for the block, but it's another example of using “object value”. I'm curious about when you would use the option “object position”.if <(8) = (List Items (1) to (4) of [MYLIST v], output [object value v] :: list> then
move (999 trillion billion gazillion jeffery bezo dollars from inches converted to pixels length) steps
end
<[8] = [List Items (1) to (4) of [MYLIST v], output [object value v] :: list>
outputs True or 1 if put in math operator because a object that was looped through by the variable was equal to 3
also to answer.
set [Loop Count v] to [0]
repeat (5)
change [Loop Count v] by (1)
if <(Loop Count) = (List Items (1) to (4) of [MYLIST v], output [object value v] :: list> then
move (item (Loop Count) of [MYLIST v]) steps
end
end
Last edited by zazashrooms (Today 12:38:59)
- Discussion Forums
- » Suggestions
-
» List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!