[SCRIPTING] Dictionaries holding multiple values per variable.

View previous topic View next topic Go down

Should we implement this?

33% 33% 
[ 1 ]
0% 0% 
[ 0 ]
0% 0% 
[ 0 ]
0% 0% 
[ 0 ]
33% 33% 
[ 1 ]
33% 33% 
[ 1 ]
 
Total Votes : 3

[SCRIPTING] Dictionaries holding multiple values per variable.

Post by coolieman2 on Sat Oct 19, 2013 12:31 pm

Jobro told me to post it on the forums because the one in the group wall got cut off. Sorry this might not be in the right place.

So i can't explain it much in words without showing an example.
Backpack = {
["X1Y1"] = "Wood", 2, 8, 2, "X2Y1", "X3Y1"
["X2Y1"] = "Wood", 2, 8, 2, "X1Y1", "X3Y1"
["X1Y1"] = "Wood", 2, 8, 2, "X1Y1", "X2Y1"
}
That would be a dictionary holding the voxels of a grid backpack:
Scarfacial wrote:While we're on the topic, I'd just like to take a moment to shotgun this idea I've had for a backpack. It's been done before in other games so it shouldn't be to difficult to grasp, although I've never seen it done on Roblox.

Basically the idea is this: The player gets some kind of grid based backpack. Each item has a specific size which takes up a certain amount of room in the pack, so it does have limits to the amount of stuff a player can carry. Dragging an item from the 3D space into the 2D grid puts it into their backpack, and dragging it from the 2D grid into the 3D space takes it out of their pack respectively.
Perfect use for quotes Very Happy 
Anyway, the format would be Item, dimensions, other voxels.
But that was only an example. It could be useful in many other ways. For example if you want to create lists of values in one variable in a table you could expand the possibilities of dictionaries. Altough it's not necessary it will make scripting easier.
avatar
coolieman2

Male Posts : 78
Join date : 2013-06-21
Location : Europe meaning i'm in a good timezone :)

View user profile

Back to top Go down

Re: [SCRIPTING] Dictionaries holding multiple values per variable.

Post by jobro13 on Sun Oct 20, 2013 3:26 pm

I think it would be easier to use the indices for x and y coordinates.

So, an access would be:

Backpack[x][y]

The table could be;

Backpack = {
[1] = {[1] = {SE_Resource, 1, 0, 4}, [2] = {SE_Resource, 1,0,4}}, [2] = {[1] = {SE_Resource, 0, 1, 3}, [2] = {SE_Resource, 1, 0, 2}}}

So Backpack[2][1] (x = 2, y = 1) would give {SE_Rescource, 0, 1, 3}
That table itself would represent:
Object, ShiftX, ShiftY, ShiftLength
You can imagine that an object will take more than one space - like Wood, which could take 4 spaces for example. We want to know if it moves to the right (from the starting point, which are the indices) - if true then the second property - ShiftX - is 1. If it moves down though, then ShiftY, the 3rd property is 1. Finally, ShiftLength represents the length of the item - for wood, 4 for example.

But yes, I think the Backpack will be an actual SE class and "BackpackMembers" will also be an SE class.

_________________
Project Profile | My Roblox profile | My twitter
avatar
jobro13

Male Posts : 250
Join date : 2013-06-02

View user profile

Back to top Go down

Re: [SCRIPTING] Dictionaries holding multiple values per variable.

Post by coolieman2 on Mon Oct 21, 2013 12:06 pm

Actually the point was variables holding lots of values. Altough i can see you're making an extra table. My point was making variables hold different values instead of tables. But otherwise making tables is kinda what i meant.
avatar
coolieman2

Male Posts : 78
Join date : 2013-06-21
Location : Europe meaning i'm in a good timezone :)

View user profile

Back to top Go down

Re: [SCRIPTING] Dictionaries holding multiple values per variable.

Post by magnalite on Wed Nov 06, 2013 2:22 pm

What is the point of this? Multi-dimensional tables are easy enough.
avatar
magnalite

Female Posts : 4
Join date : 2013-11-04
Age : 19
Location : Tea land! (England)

View user profile

Back to top Go down

Re: [SCRIPTING] Dictionaries holding multiple values per variable.

Post by coolieman2 on Thu Nov 07, 2013 2:48 pm

I guess so :/


EDIT: Now i really think this is more like a spam thread.
avatar
coolieman2

Male Posts : 78
Join date : 2013-06-21
Location : Europe meaning i'm in a good timezone :)

View user profile

Back to top Go down

Re: [SCRIPTING] Dictionaries holding multiple values per variable.

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum