Author Topic: Codes for moving and placing a brick  (Read 2099 times)

What are the codes to make a ghost brick go up or down, left or right, and to plant it?

client side or server side?

on the client side it is
commandtoserver('shiftbrick', x, y, z);
commandtoserver('plantbrick');
« Last Edit: July 23, 2013, 10:47:58 PM by Nexus »

commandtoserver('shiftbrick', x, y, z);
commandtoserver('plantbrick');

which is  serverCmdshiftbrick(%client, x, y, z) and serverCmdPlantBrick(%client) on the serverside, of course.

edit: thanks, nexus...forgot about those heh.
« Last Edit: July 24, 2013, 07:31:35 PM by PeeEsPee »

which is  serverCmdshiftbrick(x, y, z) and serverCmdPlantBrick() on the serverside, of course.

er, not quite.

The first argument of each of those will be the client that actually called the command.

servercmdshiftbrick(%client, %x, %y, %z);
servercmdplantbrick(%client);

... which means you can move any clients ghost brick server side

oh stuff i just had the nastiest idea for a horribly aggravating prank script: package the plant brick function to randomly shift the ghost brick a random distance every other plant or so then plant to cause maximum irriation

then run it on a freebuild

... which means you can move any clients ghost brick server side

oh stuff i just had the nastiest idea for a horribly aggravating prank script: package the plant brick function to randomly shift the ghost brick a random distance every other plant or so then plant to cause maximum irriation

then run it on a freebuild
this is why we can't have nice things

... which means you can move any clients ghost brick server side

oh stuff i just had the nastiest idea for a horribly aggravating prank script: package the plant brick function to randomly shift the ghost brick a random distance every other plant or so then plant to cause maximum irriation

then run it on a freebuild
th-thats... genius.

results:
« Last Edit: July 25, 2013, 09:59:08 PM by swollow »

package t{function r(){return getRandom(-1,1);}function servercmdPlantBrick(%c){servercmdshiftBrick(%c,r(),r());parent::servercmdPlantBrick(%c);}};activatepackage(t);

package t{function servercmdPlantBrick(%c){servercmdshiftBrick(%c,getRandom(-1,1),getRandom(-1,1));parent::servercmdPlantBrick(%c);}};activatepackage(t);

this is as short as I could make it
« Last Edit: July 26, 2013, 12:17:32 AM by MARBLE MAN »

Also, on non-planted bricks you can call ::setTransform

It's really nice that we're not restricted to only moving the brick one unit at a time.

A larger list of building functions, just in case:

In all cases, decimals where they shouldn't be are floored.

commandToServer('shiftBrick', %x, %y, %z); (serverCmdShiftBrick)
 Moves the ghost brick. %x, %y - movement in bricks, in the direction the client is facing. +Y is left, +X is forwards, -Y is right, -X is backwards. %z - vertical movement, in plates. +Z is up, -Z is down.
 Example: commandToServer('shiftBrick', 4, 2, 3); will shift the ghost brick the length, height, and width of a 2x4 brick - forwards, to the left, and up.

commandToServer('rotateBrick', %r); (serverCmdRotateBrick)
 Rotates the ghost brick. %r - rotation multiplied by 90 degrees.
 Example: commandToServer('rotateBrick', 2); will rotate the brick 180 degrees.

commandToServer('plantBrick'); (serverCmdPlantBrick)
 Plants a brick at the ghost brick. No arguments.
 Example: commandToServer('plantBrick'); will plant the ghost brick. What else?

commandToServer('instantUseBrick', %dat); (serverCmdInstantUseBrick)
 Changes the brick datablock. The brick does not have to be in the client's inventory. %dat - the datablock to change to.
 Example: commandToServer('instantUseBrick', "brick2x4Data"); will switch to the 2x4 brick datablock.
 Note that the brick position system is still the same - the new ghost brick will be at the center of the old one.

commandToServer('useSprayCan', %c); (serverCmdUseSprayCan)
 Changes the current color. %c - the colorID. ColorIDs count from 0 on the colorlist, down columns and then rows.
 Example: In the default colorset, commandToServer('useSprayCan', 12); will send you to the second column 'Bold' - each column is 9 colors tall, so mfloor(12/9) = move over 1 column, then to the fourth color 'Bold - 4' (12 - 9 = move down 3 rows).
« Last Edit: July 26, 2013, 03:12:35 AM by ThinkInvisible »

... which means you can move any clients ghost brick server side

oh stuff i just had the nastiest idea for a horribly aggravating prank script: package the plant brick function to randomly shift the ghost brick a random distance every other plant or so then plant to cause maximum irriation

then run it on a freebuild
calm down satan