| Blockland Forums > Modification Help |
| Deleting bricks of a certain color |
| << < (3/4) > >> |
| Iban:
--- Quote from: Treynolds416 on May 25, 2011, 08:21:32 PM ---The script is not working correctly Looks like you made a tiny mistake Iban, line 11 should be if(%colorID !$= "") It also seems that the script only destroys a single brick each time you use the command. --- End quote --- Not sure why. I wrote it off-handedly and did not test it but you should be able to figure it out since I did the rest. |
| Red_Guy:
not sure what you guys are atempting to write here.. but this should do what Treynolds416 asked for: --- Code: ---function serverCmdDeleteColor(%client, %colorID) { if (!%client.isAdmin) return; %toDelete = new SimSet(); for (%a=0; %a < MainBrickgroup.getCount(); %a++) { %group = MainBrickGroup.getObject(%a); for (%b=0; %b < %group.getCount(); %b++) { %brick = %group.getObject(%b); if (%brick.colorID == %colorID) { %toDelete.add(%brick); } } } MessageClient(%client, '', "Deleting " @ %toDelete.getCount() @ " bricks"); while (%toDelete.getCount() > 0) { %brick = %toDelete.getObject(0); %brick.delete(); } } --- End code --- then say /deletecolor 0 to delete all red bricks from the server. |
| otto-san:
I'd use Iban's last script. |
| Greek2me:
I'd say Red-Guy's is much cleaner and simpler. You can use Iban's script to find the paint color and call Red_Guy's function. |
| Iban:
--- Quote from: Greek2me on May 25, 2011, 11:18:01 PM ---I'd say Red-Guy's is much cleaner and simpler. You can use Iban's script to find the paint color and call Red_Guy's function. --- End quote --- The only thing he does differently is use a simset instead of a field list to keep track of the hit objects, which in retrospect is a better idea. He also uses an object property instead of a get function which is generally frowned upon. The end result is exactly the same. I just used comments and spaced everything out nicely. I do not loving understand for the life of me why people insist on indenting with 3 spaces like god damn stuff chucking apes. |
| Navigation |
| Message Index |
| Next page |
| Previous page |