Example

Start Minecraft with the Minescript mod installed. This will automatically create a minescript folder within the Minecraft folder. Create a file named example.py in the minescript folder with the following contents:

import minescript import sys # Get the player's position: player_x, player_y, player_z = minescript.player_position() x, y, z = round(player_x), round(player_y), round(player_z) # Get the type of block directly beneath the player: block_type = minescript.getblock(x, y - 1, z) block_type = block_type.replace("minecraft:", "").split("[")[0] sign_text = ( """{Text1:'{"text":"%s"}',Text2:'{"text":"at"}',Text3:'{"text":"%d %d %d"}'}""" % (block_type, x, y - 1, z)) # Script argument, passed from Minecraft like "\example 5" rotation = int(sys.argv[1]) if len(sys.argv) > 1 else 0 if rotation < 0 or rotation > 15: raise ValueError(f"Param not an integer between 0 and 15: {rotation}") # Create a sign then set text on it: print(f"/setblock {x} {y} {z} minecraft:birch_sign[rotation={rotation}]") print(f"/data merge block {x} {y} {z} {sign_text}") # Text written to stderr appears locally in Minecraft chat GUI and is not visible # to other players. To send a chat message that's visible to other players, remove # the file=sys.stderr param (default is file=sys.stdout). print(f"Created sign at {x} {y} {z} over {block_type}", file=sys.stderr)
Code language: Python (python)

Save your changes to example.py. Unlike regular Minecraft commands that start with a slash (“/”), Minescript commands start with a backslash (“\”). From within Minecraft bring up the in-game chat console and type the following then press enter:

\example 5

This should create a sign at your player’s location with the position and type of block beneath it printed on the sign, with a rotation of 5 (the rotation can be an integer from 0 to 15).