| Blockland Forums > Modification Help |
| Getting the brick number from the brick name |
| << < (2/5) > >> |
| Red_Guy:
okay.. so you want the ID of the brick's datablock try something like this: echo( brick1x1Data.getID() ); echo( brick4xCubeData.getID() ); |
| Nexus:
--- Quote from: Red_Guy on June 22, 2011, 08:49:20 PM ---okay.. so you want the ID of the brick's datablock try something like this: echo( brick1x1Data.getID() ); echo( brick4xCubeData.getID() ); --- End quote --- This doesn't work on the client side. I am trying to figure out how to get this number, but the closest I can get to is finding the ID if the client sided brickdata using the following code. --- Code: ---for(%a=0; %a<serverconnection.getcount(); %a++) { %b = serverconnection.getobject(%a); if(%b.uiname $="1x6x3") { echo(%b); break; } } --- End code --- I am not entirely up to snuff with parented script objects and how to get ids local to the script object. |
| Nexus:
so, I was playing around with things and stuffs, and I came up with this: --- Code: ---function buildbrickdataidlist() { if(isObject(serverconnection)) { for(%a=0; %a<serverconnection.getcount(); %a++) { if((%b = serverconnection.getobject(%a)).uiname $= "1x1" && !%found) { %found = true; %c = 200; } %c++; if(%b.category !$= "" && %b.uiname !$= "" && %found) $brickdatalist[%b.uiname] = %c; } } } --- End code --- I'll let you guys know how it works. |
| Destiny/Zack0Wack0:
The 'brick number' is the ID of the datablock. To get the 'brick number' or ID of the brick's datablock on the client side you use .getID(). Most of the important server-side functions work on the client-side too. ie. Red_Guy had the right idea. |
| Nexus:
--- Quote from: Destiny/Zack0Wack0 on June 23, 2011, 04:16:44 AM ---The 'brick number' is the ID of the datablock. To get the 'brick number' or ID of the brick's datablock on the client side you use .getID(). Most of the important server-side functions work on the client-side too. ie. Red_Guy had the right idea. --- End quote --- Yes. At the time I did not know that the 'brick number' I was talking about had actual significance outside of the brick selector. However, on the client side, serverconnection.getid() gets an id that is different from the one on the server, so you need to find the offset. |
| Navigation |
| Message Index |
| Next page |
| Previous page |