Discuss Scratch

A-Human-Rat
Scratcher
37 posts

[Length of list]

I'm making a random name generator and every time the flag is clicked, the list keeps getting longer and I don't like that. Is there any way that I code it to where it delete any list item over a certain number?

Signature:
———————-
Scratch Profiles: @A-Human-Rat @Lemony_Games @Xx_Galaxy-Bear_xX @BadAtTeaching
Youtube: RandomWeekdayUploads (If I need to remove the link, I will)
———————–
Currently helping @Wemsmealon with their FNF Vs Wemsmealon Mod on Scratch as the animator!
deck26
Scratcher
1000+ posts

[Length of list]

Your question is unclear. You've made a project that adds to a list but don't want it to do so??

Do you mean deleting any item with a value over a certain limit or deleting any item after a certain item in the list?
Communist33
Scratcher
74 posts

[Length of list]

Yes
set [i v] to [1]
repeat (length of [array v] :: list)
if <[i] > [300]> then
delete (i) of [array v]
end
change [i v] by (1)
end
Replace 300 with the length you want to trim the array to

average 3d object render enthusiast
Full stack developer (nodejs, php, html/css/js)
Working on a way to save games without codes and without storing it on cloud variables
A-Human-Rat
Scratcher
37 posts

[Length of list]

deck26 wrote:

Your question is unclear. You've made a project that adds to a list but don't want it to do so??

Do you mean deleting any item with a value over a certain limit or deleting any item after a certain item in the list?
I meant deleting an item after a certain length if that makes sense, but I already figured it out.

Signature:
———————-
Scratch Profiles: @A-Human-Rat @Lemony_Games @Xx_Galaxy-Bear_xX @BadAtTeaching
Youtube: RandomWeekdayUploads (If I need to remove the link, I will)
———————–
Currently helping @Wemsmealon with their FNF Vs Wemsmealon Mod on Scratch as the animator!

Powered by DjangoBB