Discuss Scratch

  • Discussion Forums
  • » Suggestions
  • » List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable! [RSS Feed]
zazashrooms
Scratcher
67 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.

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 (Yesterday 03:47:50)

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 ?

zazashrooms wrote:

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]

zazashrooms wrote:

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
67 posts

List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable!

ZephyrF wrote:

Do you mean a block to do this ?

zazashrooms wrote:

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]

zazashrooms wrote:

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.
  • Discussion Forums
  • » Suggestions
  • » List items (#) to (#) of (list) and output object positions or objects? (Choose position or objects). Variable! [RSS Feed]

Powered by DjangoBB