Friday 1 May 2015

Redstone Programming Language Tool 1.8

Now in 1.8 we have a lot of new possibilities with command blocks, but sometimes it’s just too hard to use them. When you are working with command blocks you can’t see all your commands at once and sometimes it’s tricky to edit them, not to mention a very long and unclear syntax. It may be ok when you have a dozen of command blocks in your project, but that means you are probably not using on 100% all the cool stuff that came out.


Redstone Programming Language Tool is a way to generate any amount of command blocks based on code in a text file. You write your code in a file, go to MCEdit, use RPL filter and it will build all the command blocks. That way you always have a code of your project, you can easily edit it and more importantly it’s intended to have a short and intuitive syntax. You will write about 2-5 times less code than you would do working with command blocks ingame. And you will write this code faster because you’re working with it in a text file where you don’t have to fly around and right-click every command block.


New commands


RPL introduces some new commands. In first version there are two of them: tpsmart and sqrt.


tpsmart


This command creates a set of command blocks and each one of them covers certain range in possible velocity values. It takes 8 parameters:
tpsmart @Sheep x vx 20 400 10 0.02 0.4

1. Selector – who do you want to telepot

2. Axis of teleportation. You can use only one axis per one tpsmart command

3. Objective to use. RPL with use the selector from the first parameter to determine the velocity value

4 and 5. Range of possible velocity values.

6. Step. This affects how many blocks will be created and how accurate the correspondence between velocity and tp distance will be.

7 and 8. The range of distances corresponding to specified range of velocity values. This is the distance the entity will be teleported by. If you are using a 20Hz clock the reasonable values for these parameters are between -1 and 1, 1 stands for 20 blocks per second.


The above example will generate these commands:
tp @e[type=Sheep,score_vx_min=20,score_vx=29] ~0.02 ~ ~

tp @e[type=Sheep,score_vx_min=30,score_vx=39] ~0.03 ~ ~

tp @e[type=Sheep,score_vx_min=40,score_vx=49] ~0.041 ~ ~

... and so on untill:

tp @e[type=Sheep,score_vx_min=380,score_vx=389] ~0.39 ~ ~

tp @e[type=Sheep,score_vx_min=390,score_vx=400] ~0.4 ~ ~


sqrt


Square root calculation. As of now there’s no way to actually calculate the root in Minecraft, so this command uses the same technique as tpsmart. It creates a command block for every possible resulting square root and each of these blocks checks if the source number is around this block`s number squared, if that makes sense. Example:
sqrt 1 5 @p src dest

converts into (in RPL syntax):
@p[1<=src<=2] dest = 1

@p[3<=src<=6] dest = 2

@p[7<=src<=12] dest = 3

@p[13<=src<=20] dest = 4

@p[21<=src<=30] dest = 5


 




 



Redstone Programming Language Tool 1.8

No comments:

Post a Comment