This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-12-12 10:40:05

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Clickable lists?

Well I'm making this (unknown to public) game, and I want it so when I click one of the items in my inventory/list, it will set a variable to the number of the item I clicked. For example, I have 7 items, and the 4th one is, Chicken, so I click it and it sets this variable to 4. Is it possible to do this?


http://i.imgur.com/WBkM2QQ.png

Offline

 

#2 2008-12-12 10:44:15

BWOG
Scratcher
Registered: 2008-09-19
Posts: 1000+

Re: Clickable lists?

Not that i know of. They should probley add that. The only other thing i can think of is making an inventory with sprites instead of a list, but then you need a chicken sprite, and all the other ones you need.

Offline

 

#3 2008-12-12 13:27:39

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Clickable lists?

Just use the code blocks for that.

variable= item 4 in list


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#4 2008-12-12 13:32:42

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

archmage wrote:

Just use the code blocks for that.

variable= item 4 in list

Well you got half of it right. the other thing is, will that allow you to CLICK the variable name and then set the variable to 4?


http://i.imgur.com/WBkM2QQ.png

Offline

 

#5 2008-12-12 13:52:15

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Clickable lists?

Lucario621 wrote:

archmage wrote:

Just use the code blocks for that.

variable= item 4 in list

Well you got half of it right. the other thing is, will that allow you to CLICK the variable name and then set the variable to 4?

Can't do this right now.

The closest way to do this would be: if mouse down and mouse x and y are in the specific area of the list. Or make each section an individual Sprite.

I wish you could do this, along with using something like Control to select multiple sections of the list.

Offline

 

#6 2008-12-12 18:43:31

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

Zelda123 wrote:

Lucario621 wrote:

archmage wrote:

Just use the code blocks for that.

variable= item 4 in list

Well you got half of it right. the other thing is, will that allow you to CLICK the variable name and then set the variable to 4?

Can't do this right now.

The closest way to do this would be: if mouse down and mouse x and y are in the specific area of the list. Or make each section an individual Sprite.

I wish you could do this, along with using something like Control to select multiple sections of the list.

Well thats where your first thing is wrong again. Sure of course you can detect if mouse x and y are in certain areas which I sometimes do, but remember, lists scroll if you have even more than sometimes 3 items. So if x > blah and x < blah and y > blah and y < blah set variable to _ aka, that could have infinate different answers.

Also, I was making my own list that could do that, but I got far and then I left my computer for like an hour, and then I came back and (for some stupid reason) my computer installed a certain update which it had to reboot to do, so it was gone, well at least I lost a LOT of it.

Last edited by Lucario621 (2008-12-12 18:45:32)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#7 2008-12-12 19:09:07

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Clickable lists?

Lucario621 wrote:

Zelda123 wrote:

Lucario621 wrote:


Well you got half of it right. the other thing is, will that allow you to CLICK the variable name and then set the variable to 4?

Can't do this right now.

The closest way to do this would be: if mouse down and mouse x and y are in the specific area of the list. Or make each section an individual Sprite.

I wish you could do this, along with using something like Control to select multiple sections of the list.

Well thats where your first thing is wrong again. Sure of course you can detect if mouse x and y are in certain areas which I sometimes do, but remember, lists scroll if you have even more than sometimes 3 items. So if x > blah and x < blah and y > blah and y < blah set variable to _ aka, that could have infinate different answers.

Also, I was making my own list that could do that, but I got far and then I left my computer for like an hour, and then I came back and (for some stupid reason) my computer installed a certain update which it had to reboot to do, so it was gone, well at least I lost a LOT of it.

That stragey, of course, depends on the size of the box of the list and how many items you need to use.

You could use the approach of If length of list = (    ), and X and Y are < and > to something, then it could work.

The list can hold up to 15 items without scrolling down.

Offline

 

#8 2008-12-12 20:42:28

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

Zelda123 wrote:

Lucario621 wrote:

Zelda123 wrote:


Can't do this right now.

The closest way to do this would be: if mouse down and mouse x and y are in the specific area of the list. Or make each section an individual Sprite.

I wish you could do this, along with using something like Control to select multiple sections of the list.

Well thats where your first thing is wrong again. Sure of course you can detect if mouse x and y are in certain areas which I sometimes do, but remember, lists scroll if you have even more than sometimes 3 items. So if x > blah and x < blah and y > blah and y < blah set variable to _ aka, that could have infinate different answers.

Also, I was making my own list that could do that, but I got far and then I left my computer for like an hour, and then I came back and (for some stupid reason) my computer installed a certain update which it had to reboot to do, so it was gone, well at least I lost a LOT of it.

That stragey, of course, depends on the size of the box of the list and how many items you need to use.

You could use the approach of If length of list = (    ), and X and Y are < and > to something, then it could work.

The list can hold up to 15 items without scrolling down.

Well only 15 at max, but honestly, who has a list that big? Anyway, I guess it is possible, but it is VERY impractical.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#9 2008-12-13 03:03:29

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: Clickable lists?

Yeah sensing where the mouse is on the list is a good idea.
For me at least though, the lists a bigger online then in scratch, so they don't match up.

I stamped buttons down the side of the list:
http://scratch.mit.edu/projects/AddZero/346118
(Let me know if you'd like for me to explain it better.)

-------
Another way would be to have the list viewer hidden.
Stamp as many buttons as are in the list like above.  (It can be many this way)
The buttons won't be labeled, but the user can hover their mouse over the stamped buttons. 
The button will say in a talking balloon what item in the list it is.

Last edited by AddZero (2008-12-13 03:11:45)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#10 2008-12-13 09:59:48

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

AddZero wrote:

Yeah sensing where the mouse is on the list is a good idea.
For me at least though, the lists a bigger online then in scratch, so they don't match up.

I stamped buttons down the side of the list:
http://scratch.mit.edu/projects/AddZero/346118
(Let me know if you'd like for me to explain it better.)

-------
Another way would be to have the list viewer hidden.
Stamp as many buttons as are in the list like above.  (It can be many this way)
The buttons won't be labeled, but the user can hover their mouse over the stamped buttons. 
The button will say in a talking balloon what item in the list it is.

Still, on the left side if you keep adding 14 more, to have 17, you'll see theres only 16 buttons, and also, in my game the inventory will be small and have a maximum length of 50. So I don't think that will work. ALSO, for some single words like Cooked Chicken in my game, it will take up 2 lines, so again, sorry.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#11 2008-12-13 10:48:35

Zelda123
Scratcher
Registered: 2007-11-21
Posts: 1000+

Re: Clickable lists?

How many items do you plan to add in your list?

Offline

 

#12 2008-12-13 12:07:11

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

Zelda123 wrote:

How many items do you plan to add in your list?

Well its an inventory, so the player will be able to add and get rid of items. I set the maximum to 50.

P.S. Congrats for 900 posts!


http://i.imgur.com/WBkM2QQ.png

Offline

 

#13 2008-12-13 20:42:28

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: Clickable lists?

Lucario621 wrote:

ALSO, for some single words like Cooked Chicken in my game, it will take up 2 lines, so again, sorry.

Ok, then maybe consider my second suggestion then.

Don't show lists.
It would be a stamped list or grid of buttons as many as are in the inventory list.
They don't have to be big.
The user would hover their mouse over them to see what the button is, when the mouse is over it, the button will say the name of that item in the list- like tool-tips. (the yellow help text you see when you hover over a button.)

You could have room for 50 buttons on the screen, and if there's more have a 'next page' button to show the next 50.

That would be for printing buttons that all look the same,
If you wanted to get more fancy,  you could have several icon type like the bottom of this image:
http://news.filefront.com/wp-content/uploads/2008/07/diablo1.jpg (except large items wouldn't be in several spots, easily.)

You could also have another list the same size as the inventory list that stores the type of item it is, that would store the costume number for the icon of the button.  So you would have an "Sword" as 1, "Armor" as 2, "Ring" as 3 ...

Here's what the lists could look like as it's being played:
List- InventoryName:

Code:

1  Ultra Sword
2  Awesome Ring
3  Shinny Ring
4  Leather Armor
5  Shinny Armor

List-  InventoryType:

Code:

1  1
2  3
3  3
4  2
5  2

When they go into their inventory, the Inventory sprite that has these costumes would switch to the icon number as the InventoryType, stamp, move 20 px (or however big your icons are). and repeat for each item in the list:

It would work somewhat similar to this project:
http://scratch.mit.edu/projects/AddZero/134975

I hope that helps.

Last edited by AddZero (2008-12-13 20:45:44)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#14 2008-12-16 15:31:20

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

AddZero wrote:

Lucario621 wrote:

ALSO, for some single words like Cooked Chicken in my game, it will take up 2 lines, so again, sorry.

Ok, then maybe consider my second suggestion then.

Don't show lists.
It would be a stamped list or grid of buttons as many as are in the inventory list.
They don't have to be big.
The user would hover their mouse over them to see what the button is, when the mouse is over it, the button will say the name of that item in the list- like tool-tips. (the yellow help text you see when you hover over a button.)

You could have room for 50 buttons on the screen, and if there's more have a 'next page' button to show the next 50.

That would be for printing buttons that all look the same,
If you wanted to get more fancy,  you could have several icon type like the bottom of this image:
http://news.filefront.com/wp-content/uploads/2008/07/diablo1.jpg (except large items wouldn't be in several spots, easily.)

You could also have another list the same size as the inventory list that stores the type of item it is, that would store the costume number for the icon of the button.  So you would have an "Sword" as 1, "Armor" as 2, "Ring" as 3 ...

Here's what the lists could look like as it's being played:
List- InventoryName:

Code:

1  Ultra Sword
2  Awesome Ring
3  Shinny Ring
4  Leather Armor
5  Shinny Armor

List-  InventoryType:

Code:

1  1
2  3
3  3
4  2
5  2

When they go into their inventory, the Inventory sprite that has these costumes would switch to the icon number as the InventoryType, stamp, move 20 px (or however big your icons are). and repeat for each item in the list:

It would work somewhat similar to this project:
http://scratch.mit.edu/projects/AddZero/134975

I hope that helps.

Sorry, but I DON'T WANT 50 BUTTONS ON MY SCREEN. I wan't there to perhaps be a scroll bar and 3 items able to see at once, and them being clickable.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#15 2008-12-16 16:44:39

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Re: Clickable lists?

50 was an example.  It can be whatever you want.

(Wow, was anything I wrote helpful?  Honestly I feel like I'm wasting my time trying to help.  I do want to help, but please consider what I write.  And a 'thanks' would be nice.  This will help you get help from others in the future.)

Again, you can hit 'next page' to show more of the items.

If you need scrolling click-able lists, look at this:
http://scratch.mit.edu/projects/RecycleBin/311782

I had suggested a grid layout of icons because it's popular for rpg inventories.
http://news.filefront.com/wp-content/uploads/2008/07/diablo1.jpg
And if you categorized your items into a few types, you wouldn't have to make a costumes for every item.

Good luck.

Last edited by AddZero (2008-12-16 17:13:26)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#16 2008-12-16 19:35:26

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Clickable lists?

AddZero wrote:

50 was an example.  It can be whatever you want.

50 is what I want and I'm not lowering it or changing it! I started with it and I'm ending with it!

AddZero wrote:

(Wow, was anything I wrote helpful?  Honestly I feel like I'm wasting my time trying to help.  I do want to help, but please consider what I write.  And a 'thanks' would be nice.  This will help you get help from others in the future.)

Ok. Thhhaaa. Thhaannn. I can't. Sorry. Lol. Thanks for trying lol.

AddZero (the guy that FINALLY HELPED ME) wrote:

If you need scrolling click-able lists, look at this:
http://scratch.mit.edu/projects/RecycleBin/311782

This is what I've wanted the entire time! Sheesh!

AddZero wrote:

And if you categorized your items into a few types, you wouldn't have to make a costumes for every item.

Still then you'll think chicken and beef is the same thing  tongue

Last edited by Lucario621 (2008-12-16 19:41:52)


http://i.imgur.com/WBkM2QQ.png

Offline

 

Board footer