[SCRIPTING] Dictionaries holding multiple values per variable.
3 posters
Page 1 of 1
Should we implement this?
[SCRIPTING] Dictionaries holding multiple values per variable.
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:
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.
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:
Perfect use for quotesScarfacial 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.
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.
coolieman2- Posts : 78
Join date : 2013-06-21
Location : Europe meaning i'm in a good timezone :)
Re: [SCRIPTING] Dictionaries holding multiple values per variable.
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.
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.
jobro13- Posts : 250
Join date : 2013-06-02
Re: [SCRIPTING] Dictionaries holding multiple values per variable.
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.
coolieman2- Posts : 78
Join date : 2013-06-21
Location : Europe meaning i'm in a good timezone :)
Re: [SCRIPTING] Dictionaries holding multiple values per variable.
What is the point of this? Multi-dimensional tables are easy enough.
magnalite- Posts : 4
Join date : 2013-11-04
Age : 26
Location : Tea land! (England)
Re: [SCRIPTING] Dictionaries holding multiple values per variable.
I guess so :/
EDIT: Now i really think this is more like a spam thread.
EDIT: Now i really think this is more like a spam thread.
coolieman2- Posts : 78
Join date : 2013-06-21
Location : Europe meaning i'm in a good timezone :)
Similar topics
» Scripting Entry
» Scripting Application
» Scripting Application for MagicMasterRohan
» Multiplayer building scripting etc
» Signup for scripting for coolieman2
» Scripting Application
» Scripting Application for MagicMasterRohan
» Multiplayer building scripting etc
» Signup for scripting for coolieman2
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|