Discuss Scratch

Pandadude12321
Scratcher
76 posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

I believe in scratch 2.0 one could put a string block into a block's drop-down menu, however as far as i can tell this feature is missing from 3.0.

This prevents me from doing things like
(item ( 1) of (join [loot table of ] (enemy)) :: list) 

is there any efficient 3.0 workaround for this that isn't just an if block for every list?
a-jar-of-tuna
Scratcher
100+ posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

Huh. That's weird. Unless scratch 3.0 is updated to fix that or you can hack it, then no, I don't think there's an efficient workaround.

Pianist, violinist, coder, programmer, web developer, haxor; Coded with Scratch for 2 years
Website (See my projects!) -> https://a-jar-of-tuna.github.io/

Pandadude12321
Scratcher
76 posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

a-jar-of-tuna wrote:

Huh. That's weird. Unless scratch 3.0 is updated to fix that or you can hack it, then no, I don't think there's an efficient workaround.
oh no, has anyone by any chance figured out hacked blocks for 3.0?
codeman1044
Scratcher
1000+ posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

Hacked blocks are a feature that 3.0 basically stomped out. I haven't seen any working hacked blocks in scratch since 3.0 dropped (except for some blocks that exist in the JSON files of scratch but aren't actually used or shown and lack code). If you try and pull up any project that has hacked blocks that was made before 3.0, it will just crash the page.
You can make an array, which is a list of lists. Each item on the array would have a label so you could read the info off of the correct item. Examples (based on a loot table example):
Zombie| armor sword key coin
Spider| Cobweb coin
Goblin| Cloth coin
Etc etc. You could add numbers next to the items so you can change their rarity of dropping, which would go in the pick random block.
If you need an example, just ask.

This is my signature, which shows up every time I post and is automatic.
I'm not going to be as active anymore…
I am a bot, and this action was performed automatically. Just kidding! Fake news!.
Last signature edit: November 19, 2019 1000th post
I like being formal, though I'm usually not formal anywhere but here.
Plug time! https://scratch.mit.edu/projects/280489344/
Current WIP (may be out of date): click!
dual_creator43
Scratcher
1000+ posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

Pandadude12321 wrote:

I believe in scratch 2.0 one could put a string block into a block's drop-down menu, however as far as i can tell this feature is missing from 3.0.

This prevents me from doing things like
(item ( 1) of (join [loot table of ] (enemy)) :: list) 

is there any efficient 3.0 workaround for this that isn't just an if block for every list?
It is slightly longer, but what could work is this:
add (join [loot table of ] (enemy)) to [enemyLoot v]
(item (1 v) of [enemyLoot v] :: list)

I'm dual_creator43, and I hope I've done well with anything. (Projects, forum replies, etc.) My Scratch habits include:
  • checking my inbox
  • working on my projects
  • being active in the forums
Check out more about me by clicking here or here. Happy Scratching!

My most famous quote: “Nothing good ever comes from posting near the end of a page.”
Pandadude12321
Scratcher
76 posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

codeman1044 wrote:

Hacked blocks are a feature that 3.0 basically stomped out. I haven't seen any working hacked blocks in scratch since 3.0 dropped (except for some blocks that exist in the JSON files of scratch but aren't actually used or shown and lack code). If you try and pull up any project that has hacked blocks that was made before 3.0, it will just crash the page.
Hopefully this changes, in 3.0 I've seen some key detection for keys unavailable from the key pressed Boolean, which i believe requires basic block hacking. But i can't seem to figure out how it was done.


codeman1044 wrote:

You can make an array, which is a list of lists. Each item on the array would have a label so you could read the info off of the correct item. Examples (based on a loot table example):
Zombie| armor sword key coin
Spider| Cobweb coin
Goblin| Cloth coin
Etc etc. You could add numbers next to the items so you can change their rarity of dropping, which would go in the pick random block.
If you need an example, just ask.
Could you give an example of how this would be done in the most elegant and efficient way?
codeman1044
Scratcher
1000+ posts

efficient workaround for putting strings into drop-down selectors (2.0 feature)

Here's an engine for it:
https://scratch.mit.edu/projects/321434386/
this took a lot more scripting than I thought it would…
I haven't tested this out to the max, so let me know if it's buggy.
Feel free to use this if you need. Let me know if you want me to change how the loot tables work.

This is my signature, which shows up every time I post and is automatic.
I'm not going to be as active anymore…
I am a bot, and this action was performed automatically. Just kidding! Fake news!.
Last signature edit: November 19, 2019 1000th post
I like being formal, though I'm usually not formal anywhere but here.
Plug time! https://scratch.mit.edu/projects/280489344/
Current WIP (may be out of date): click!

Powered by DjangoBB

Standard | Mobile