Discuss Scratch

Wrxth
Scratcher
11 posts

How do I define a block that orders a certain list

im trying to make a project of my own to just test out some stuff and i was wondering if there is a way to define a block that orders lists where itll look like this


define order list(list)





the list input being any list that you want just put it there and itll order it

Last edited by Wrxth (Oct. 12, 2021 20:33:50)


when green flag clicked
if <[scratch v] = [easy]> then
set [scratch v] to [hard]
end
deck26
Scratcher
1000+ posts

How do I define a block that orders a certain list

No, you can't pass a list name like that using standard Scratch blocks. I think there are hacked blocks around that do it.
awesome-llama
Scratcher
1000+ posts

How do I define a block that orders a certain list

Putting reporter blocks into any dropdown used to be supported in Scratch 2 through json editing (“hacking”), but in Scratch 3 (current version), there is no support for it at all unfortunately.
You have to create scripts for each list you want to sort.

Last edited by awesome-llama (Oct. 12, 2021 20:44:44)



Wrxth
Scratcher
11 posts

How do I define a block that orders a certain list

ok ty

when green flag clicked
if <[scratch v] = [easy]> then
set [scratch v] to [hard]
end
Communist33
Scratcher
74 posts

How do I define a block that orders a certain list

Depending on the content of the list you might be able to join then split the array.
For example, if the array contained only numbers, you could join all those items with a “e” in between them.
Then pass that to the custom block, which then splits the string into items split by “e”
You wouldn't have to worry about splitting up an item since it could not contain a “e”

By “join” I mean https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/array/join
By “split” I mean https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/string/split
Kinda explains what I mean, even if it is in javascript

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

Powered by DjangoBB