-
Notifications
You must be signed in to change notification settings - Fork 754
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
Adding myMessages upvar #2593
base: master
Are you sure you want to change the base?
Adding myMessages upvar #2593
Conversation
Hi Jens @jmoenig Maybe a PR is not the place (:smile:)... but we can continue here playing with some ideas... If this is interesting... I will continue and then, two questions:
Current state is: Continue, |
Yes! Yes! And for custom blocks, too!!! Maybe now that it's not just me bugging Jens about this he'll finally allow it. The right way to do this so it isn't a kludge for this one case is for every MultiArgMorph to have three associated counts, Minimum/Default/Maximum, where "Default" is the number of slots visible in the palette. (For example, Join and Append would have default=2.) Maximum could be zero or blank to mean infinite. About what you've done, I think the keyboard and envelope icons as variable names are problematic. Can users make up 🤷 variables? Otherwise great. |
Oh gawd. This sparks applause in all the wrong ways for all the wrong reasons. I'm getting out of this discussion. |
Hi! Now I have a cleaner code. And these "myUpvars" are now inside a MultiArgMorph. I've added a "press virtual key" block to see this idea in action. Thanks! Joan |
That's very nice. I have mixed feelings about reporting the name of nonprinting characters ("space" etc.). The alternative would be to report the actual character, 0x40 or whatever. The advantage is that it'd be a single character, simplifying comparisons, and that you could JOIN it into a message and it'd do the right thing. I don't have a strong feeling either way; does anyone else? |
Thank's Brian,
So, I will think more deeply about this topic and try to write something about this. I will review old issues: you know, problems between keyCode-keyNames (we have different keys with the same names), problems about multiple detection, about IDE fired-events...
Ok. That's all for now. Joan |
The uparrow isn't the default upvar; it's the type hint for upvars. Different. But I can see that for a non-native-English-speaker an ideogram is better than a word. I don't hate it. And, now you remind me, "with input" isn't quite right, it is? The upvar isn't an input to a block. If the upvar were named "key" or "message," then a label of just "with" would be reasonable. But I don't think we need a label at all. Jens gets mad when I'm more excited about your 0/0/1 "multiple" input slot than about the any-key/any-message feature, but I've wanted that for sooooooo long! I want it for users, not just for primitives. My UI proposal is that when you click the multiple input slot radio button, the default-value text box turns into three numeric slots labelled Min, Def, and Max, with the requirement that Min≤Def≤Max except that Max=0 is taken to mean Max=∞, i.e., no maximum. Maybe if you make a PR he'd pull it? Maybe? |
naw, forget about it. |
Yes Brian, Joan |
Hi Jens!
Don't worry about this... Really it is not a Pull Request, it is only to show an idea (I think a PR helps us to see changes and to test it), and if this is worth it, I can remake it with the changes you would propose.
The idea is to have a message upvar. Something like this (we can change name, or visibility, or make another primitive with this...)
We know broadcasting (doBroadcast) search allHatBlocksFor that message (or for 'any message') on all the receivers (all sprites or targeted sprites), and then, it starts a new process.
The simple idea is to pass its message to this process, as a script variable (accessible by an upvar block variable).
This allows us to use the real message (the message received) and not the "last message" (that can be another one)
A simple demo is:
What do you thing about this? Is it interesting, or is it a wrong approach? If it is interesting I can make other changes and all the "routine work" for backward compatibility (translations...)
And if not, no problem, but I want to know your criteria about this, to future proposals...
Joan