Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to detect if there are multiple of one thing in a list?
- BananaMilkshake1029
-
Scratcher
19 posts
how to detect if there are multiple of one thing in a list?
im making a crafting system and i need to detect if there are mutiple of one item in the inventory list.
if anyone knows how, please tell me. thanks!
if anyone knows how, please tell me. thanks!
- deck26
-
Scratcher
1000+ posts
how to detect if there are multiple of one thing in a list?
Various methods but if you want duplicate items one option is to store the item name in one list and the corresponding number in another list. You can perhaps fix the item numbers so item A is always item 1 in the list or just add item A to the list as and when you use it.
If you already have the list you can loop through the list and check whether the current item has already appeared either by copyng line by line to a second list or using the item # of thing in list - if that's less than the current item number it must appear earlier in the list.
If you already have the list you can loop through the list and check whether the current item has already appeared either by copyng line by line to a second list or using the item # of thing in list - if that's less than the current item number it must appear earlier in the list.
- BananaMilkshake1029
-
Scratcher
19 posts
how to detect if there are multiple of one thing in a list?
Various methods but if you want duplicate items one option is to store the item name in one list and the corresponding number in another list. You can perhaps fix the item numbers so item A is always item 1 in the list or just add item A to the list as and when you use it.i don't understand what you mean sorry
If you already have the list you can loop through the list and check whether the current item has already appeared either by copyng line by line to a second list or using the item # of thing in list - if that's less than the current item number it must appear earlier in the list.

- deck26
-
Scratcher
1000+ posts
how to detect if there are multiple of one thing in a list?
What don't you understand? Surely you must understand at least some of it!Various methods but if you want duplicate items one option is to store the item name in one list and the corresponding number in another list. You can perhaps fix the item numbers so item A is always item 1 in the list or just add item A to the list as and when you use it.i don't understand what you mean sorry
If you already have the list you can loop through the list and check whether the current item has already appeared either by copyng line by line to a second list or using the item # of thing in list - if that's less than the current item number it must appear earlier in the list.
- BananaMilkshake1029
-
Scratcher
19 posts
how to detect if there are multiple of one thing in a list?
oooohhh wait i think i understand now. thanksWhat don't you understand? Surely you must understand at least some of it!Various methods but if you want duplicate items one option is to store the item name in one list and the corresponding number in another list. You can perhaps fix the item numbers so item A is always item 1 in the list or just add item A to the list as and when you use it.i don't understand what you mean sorry
If you already have the list you can loop through the list and check whether the current item has already appeared either by copyng line by line to a second list or using the item # of thing in list - if that's less than the current item number it must appear earlier in the list.
- Discussion Forums
- » Help with Scripts
-
» how to detect if there are multiple of one thing in a list?