Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast: Add Cast #605

Merged
merged 8 commits into from
Jul 8, 2023
Merged

Cast: Add Cast #605

merged 8 commits into from
Jul 8, 2023

Conversation

LilyMakesThings
Copy link
Contributor

@LilyMakesThings LilyMakesThings commented Jun 18, 2023

Requires VM changes: TurboWarp/scratch-vm#145

Simple extension to use Scratch.Cast to convert inputs to strings, numbers, or booleans.
image

You can also get what type of value an input is.
image

Bonus: it works as a coupler for values ༼ つ ◕_◕ ༽つ
image

@yuri-kiss
Copy link
Contributor

how did you get the reporter in the boolean input???
also this seems very useful

- Add default option
- Don't allow "type of" to work in booleans
@LilyMakesThings
Copy link
Contributor Author

Ok I'm done now :)

@yuri-kiss
Copy link
Contributor

yuri-kiss commented Jun 18, 2023

Ok I'm done now :)

lol, also what does the "default" option do?

Bonus: it works as a coupler for values ༼ つ ◕_◕ ༽つ

HOWW, its a reporter thoe. I am so confused

@LilyMakesThings
Copy link
Contributor Author

lol, also what does the "default" option do?

default just doesn't cast the value, which allows it to function as a coupler :)

@yuri-kiss
Copy link
Contributor

yuri-kiss commented Jun 18, 2023

lol, also what does the "default" option do?

default just doesn't cast the value, which allows it to function as a coupler :)

But howw???????

@yuri-kiss
Copy link
Contributor

yuri-kiss commented Jun 18, 2023

i am going to have to lookup what the different between switch and if else does.

(edit):
i figured it out using stack-overflow

@CST1229
Copy link
Contributor

CST1229 commented Jun 18, 2023

how did you get the reporter in the boolean input???

Set the output variable of the block to null and its isDynamic to true in getInfo.

@LilyMakesThings
Copy link
Contributor Author

lol, also what does the "default" option do?

default just doesn't cast the value, which allows it to function as a coupler :)

But howw???????

When defining the block, set "isDynamic" to true, and "output" to null (in that order)!

Keep in mind, this method of achieving this does have the side effect of making any menu with "acceptReporters: false" not show up on the block, but it is the simplest method.

@LilyMakesThings
Copy link
Contributor Author

Optional Thumbnail:
image

@LilyMakesThings
Copy link
Contributor Author

Note: Just found this would also be ideal

@yuri-kiss
Copy link
Contributor

Note: Just found this would also be ideal

oml, so no more trickery lol

@GarboMuffin
Copy link
Member

thanks for your patience

@GarboMuffin GarboMuffin merged commit bfb68ac into TurboWarp:master Jul 8, 2023
1 check passed
@GarboMuffin
Copy link
Member

allowDropAnywhere is not live yet, but when it is, that part of the extension will just work

@LilyMakesThings LilyMakesThings deleted the Cast branch July 13, 2023 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants