Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I do I pick a item from a list using a number from 1 to 8
- -R4x-
-
Scratcher
100+ posts
I do I pick a item from a list using a number from 1 to 8
The list isn’t always gonna have the same amount of items
- ItsMarlowTime
-
Scratcher
16 posts
I do I pick a item from a list using a number from 1 to 8
I think this operator should work for what you are asking 

(pick random (1) to (length of [List v] :: list))
- -R4x-
-
Scratcher
100+ posts
I do I pick a item from a list using a number from 1 to 8
I think this operator should work for what you are asking(pick random (1) to (length of [List v] :: list))
That’s not what I meant. This one it just random but I want to chose a item from a list by using a number from 1 to 8
- Jman1111
-
Scratcher
54 posts
I do I pick a item from a list using a number from 1 to 8
How does your list behave?
Is there a reason you can't just do this?
Is there a reason you can't just do this?
(item ( num ) of [list v] :: list)
- Terry_Epic_Boi
-
Scratcher
13 posts
I do I pick a item from a list using a number from 1 to 8
(item ( (pick random (1) to (8))) of [list v] :: list)
- Im_KookiereeSoHI
-
Scratcher
100+ posts
I do I pick a item from a list using a number from 1 to 8
The list isn’t always gonna have the same amount of itemsDo
(pick random [insert number here] to [insert number here])or
(pick random[insert number here] to (length of [list name here v] :: list))
- medians
-
Scratcher
1000+ posts
I do I pick a item from a list using a number from 1 to 8
Copy and paste random into the dropdown, use the above method, or upload a project from 1.x or 2.0 with the item random block/backpack the block:

The 1st or 3rd works if you want to randomize through all items of the list.

Or do you mean like choosing a certain list item based on the value of the number (like 1 would be item 2, 2 would be item 1 or something like that?)
When first seeing the topic, people will believe that you mean as the function of the random item block from before 3.0.

The 1st or 3rd works if you want to randomize through all items of the list.
I'm confused what you mean by this. Do you mean from a variable or something?I think this operator should work for what you are asking(pick random (1) to (length of [List v] :: list))
That’s not what I meant. This one it just random but I want to chose a item from a list by using a number from 1 to 8

Or do you mean like choosing a certain list item based on the value of the number (like 1 would be item 2, 2 would be item 1 or something like that?)
When first seeing the topic, people will believe that you mean as the function of the random item block from before 3.0.
Last edited by medians (March 10, 2023 03:10:43)
- -R4x-
-
Scratcher
100+ posts
I do I pick a item from a list using a number from 1 to 8
It’s also gonna be higher than 8The list isn’t always gonna have the same amount of itemsDo(pick random [insert number here] to [insert number here])or(pick random[insert number here] to (length of [list name here v] :: list))
- -R4x-
-
Scratcher
100+ posts
I do I pick a item from a list using a number from 1 to 8
Copy and paste random into the dropdown, use the above method, or upload a project from 1.x or 2.0 with the item random block/backpack the block:
The 1st or 3rd works if you want to randomize through all items of the list.I'm confused what you mean by this. Do you mean from a variable or something?I think this operator should work for what you are asking(pick random (1) to (length of [List v] :: list))
That’s not what I meant. This one it just random but I want to chose a item from a list by using a number from 1 to 8
Or do you mean like choosing a certain list item based on the value of the number (like 1 would be item 2, 2 would be item 1 or something like that?)
When first seeing the topic, people will believe that you mean as the function of the random item block from before 3.0.
I want all 8 clones to use their ID to pick their unique number from the list, like I range from 1 to 8 turns into a range from 1 to the length of the list
Last edited by -R4x- (March 10, 2023 03:28:19)
- Spentine
-
Scratcher
1000+ posts
I do I pick a item from a list using a number from 1 to 8
I want all 8 clones to use their ID to pick their unique number from the list, like I range from 1 to 8 turns into a range from 1 to the length of the list
Why 8?
Isn't the length of the list going to be 8? (to match the number of clones)
Why do you want to map a range from 1 to 8 to the length of the list?
What are you even making?
Last edited by Spentine (March 10, 2023 03:33:37)
- medians
-
Scratcher
1000+ posts
I do I pick a item from a list using a number from 1 to 8
I want all 8 clones to use their ID to pick their unique number from the list, like I range from 1 to 8 turns into a range from 1 to the length of the listIf I understand correctly, you can use a cloneid script for this:

Then use this:

You can use an if statement to exclude the main sprite by checking if “cloneid” is 0.
Last edited by medians (March 10, 2023 04:04:11)
- -MasterMath-
-
Scratcher
41 posts
I do I pick a item from a list using a number from 1 to 8
@Terry_Epic_Boi did it right.(item ( (pick random (1) to (8))) of [list v] :: list)
- Discussion Forums
- » Help with Scripts
-
» I do I pick a item from a list using a number from 1 to 8
