blockly-lua
blockly-lua copied to clipboard
[Question] Variable/dropdown Block value
Is it possible for a block to have a drop down, that lets say says
- all
- other
and when other is selected they can drag a variable and connected it to the block, but when all is selected the default value is used...
I think if this is possible it could make turtle.drop, turtle.refuel, and turtle.transferTo a lot simpler to use for the newbies.
That's a good idea. I'd have to think about it. One easy workaround would be to create two blocks, as I did with place and place_sign, so we would have turtle.drop_all and turtle_drop, whose text would be "drop up to __ items".
yeh I originally had the same thought of defining new blocks, but thought that this would be better if it was already implemented, hence the question... For the interim I'll define some extra blocks though :)
I can implement either of these:
- Create a block with a dropdown with choices "all" (initially selected) or "some". If the user switches to "some", the dropdown gets replaced by a socket for a block. Problem: There'd be no way of converting back to the dropdown having "all". OTOH, they could always drag out a new block from the toolbar.
- Use a context menu to switch modes. I'm afraid this might be hard for users to find.
What do you think?
For grins, I implemented the GUI for turtle_drop for the first option on a test server [http://test.blockly-lua.appspot.com/static/apps/code/index.html]. Could you let me know what you think?
Yep love it. Exactly what I was thinking when I original thought of this suggestion, makes blocks just that little more powerful.
One suggestion, which is a change in wording and allows for the drop down to stick around meaning they can change it back if needed...
"drop all items from the selected slot DIR"
and
"drop up to | items from the selected slot DIR"
where | is the block connector
Also means that now you could have
"place block from the selected slot DIR"
and
"place sign from the selected slot DIR with text |"
Good suggestions on wording. Should "block" be "item"?
I agree it's better to have fewer, more powerful, blocks.
block/item maybe, idk I'll leave that decision up to you ;)
EDIT: oh btw links like this Google are [name].(link) without the '.'
On Tue, Nov 5, 2013 at 8:43 PM, Joshua Asbury [email protected]:
block/item maybe, idk I'll leave that decision up to you ;)
You're the Minecraft expert, so I'd value your opinion. I just started playing a month or so ago.
Well see technically if the turtle is placing cobble stone or the like, I'd put block (even though in code its called an ItemBlock) but then if its placing like redstone, I'd put item.... So maybe just put block/item?
We could say "contents of", although that's not ideal either. I'll just do "item" for now.
Take a look at some changes I made to the block: http://test.blockly-lua.appspot.com/static/apps/code/index.html
Specifically, what do you think of the change between "some" and "up to"? Note that changing back is now supported.
Ellen
On Tue, Nov 5, 2013 at 8:52 PM, Joshua Asbury [email protected]:
Well see technically if the turtle is placing cobble stone or the like, I'd put block (even though in code its called an ItemBlock) but then if its placing like redstone, I'd put item.... So maybe just put block/item?
— Reply to this email directly or view it on GitHubhttps://github.com/espertus/blockly-lua/issues/7#issuecomment-27843001 .
I added an "all" block, currently plugged into Turtle.refuel. Could you take a look at it at the test server [ http://test.blockly-lua.appspot.com/static/apps/code/index.html]? It is much simpler to implement than the fancy mutation I have for "drop", so I'm inclined to switch to using an "all" block. What do you think?
On Wed, Nov 6, 2013 at 12:16 PM, Ellen Spertus [email protected] wrote:
We could say "contents of", although that's not ideal either. I'll just do "item" for now.
Take a look at some changes I made to the block: http://test.blockly-lua.appspot.com/static/apps/code/index.html
Specifically, what do you think of the change between "some" and "up to"? Note that changing back is now supported.
Ellen
On Tue, Nov 5, 2013 at 8:52 PM, Joshua Asbury [email protected]:
Well see technically if the turtle is placing cobble stone or the like, I'd put block (even though in code its called an ItemBlock) but then if its placing like redstone, I'd put item.... So maybe just put block/item?
— Reply to this email directly or view it on GitHubhttps://github.com/espertus/blockly-lua/issues/7#issuecomment-27843001 .
I think it either needs to stick with "some" or "up to" the switching between is a little odd. Other than that its perfect, especially if its easier to implement ;)