| Blockland Forums > Modification Help |
| Referencing datablocks by number... |
| (1/2) > >> |
| Trader:
Looking over my macro saves, I see that each brick used in the save is stored a number in an array. For example, a 1x1 brick may show as "202" (just an example) in the array, instead of showing up as the datablock name. I have two questions. First, wouldn't the number change if you add more datablocks later that are higher in the list alphabetically? If so, then the save wouldn't be good for much. If not (second question), how can I find out which numbers correspond to which datablocks without going through a tedious test and check method? |
| Trader:
Well, it appears the %obj.getDatablock() returns the number, and %obj.dataBlock is the actual name. Any confirmation as to whether future datablocks (e.g. those that come before the one in question, alphabetically) will change the current numbers? |
| Space Guy:
202.getName(); would get the name of the datablock - brick1x1data, or similar. nametoID("brick1x1data");, in this example, would return 202. The macro saver saving numbers rather than names is what caused problems with loading macros between 1.02 and 1.03. |
| Space Guy:
Also: Datablock numbers are done on when it is defined (datablock [whatever](name)), not on its name. Saving numbers for addons won't work well since if you install a new addon which is executed before yours, the numbers will change and saved items (I assume that's what you're doing) will change to a completely different item. |
| Trader:
Actually, I'm not using the numbers at all. I just wanted to make sure that other people knew that datablock numbers aren't reliable. I'm surprised Ephi allowed them to be used for his Macro Saver. |
| Navigation |
| Message Index |
| Next page |