updated docs to mention loading from scripts files
This commit is contained in:
1 parent
c04b18b158
commit
bba6e900ea
1 file changed
+39
-35
@@ -72,38 +72,38 @@ import static java.lang.Math.min;
|
|||||||
* <p>or an overly complex example:</p>
|
* <p>or an overly complex example:</p>
|
||||||
* <pre>
|
* <pre>
|
||||||
* /script run
|
* /script run
|
||||||
* $ block_check(x1, y1, z1, x2, y2, z2, block_to_check) ->
|
* block_check(x1, y1, z1, x2, y2, z2, block_to_check) ->
|
||||||
* $ (
|
* (
|
||||||
* $ l(minx, maxx) = sort(l(x1, x2));
|
* l(minx, maxx) = sort(l(x1, x2));
|
||||||
* $ l(miny, maxy) = sort(l(y1, y2));
|
* l(miny, maxy) = sort(l(y1, y2));
|
||||||
* $ l(minz, maxz) = sort(l(z1, z2));
|
* l(minz, maxz) = sort(l(z1, z2));
|
||||||
* $ 'Need to compute the size of the area of course';
|
* 'Need to compute the size of the area of course';
|
||||||
* $ 'Cause this language doesn\'t support comments';
|
* 'Cause this language doesn\'t support comments';
|
||||||
* $ xsize = maxx - minx + 1;
|
* xsize = maxx - minx + 1;
|
||||||
* $ ysize = maxy - miny + 1;
|
* ysize = maxy - miny + 1;
|
||||||
* $ zsize = maxz - minz + 1;
|
* zsize = maxz - minz + 1;
|
||||||
* $ total_count = 0;
|
* total_count = 0;
|
||||||
* $ loop(xsize,
|
* loop(xsize,
|
||||||
* $ xx = minx + _ ;
|
* xx = minx + _ ;
|
||||||
* $ loop(ysize,
|
* loop(ysize,
|
||||||
* $ yy = miny + _ ;
|
* yy = miny + _ ;
|
||||||
* $ loop(zsize,
|
* loop(zsize,
|
||||||
* $ zz = minz + _ ;
|
* zz = minz + _ ;
|
||||||
* $ if ( block(xx,yy,zz) == block_to_check,
|
* if ( block(xx,yy,zz) == block_to_check,
|
||||||
* $ total_count += ceil(rand(1))
|
* total_count += ceil(rand(1))
|
||||||
* $ )
|
* )
|
||||||
* $ )
|
* )
|
||||||
* $ )
|
* )
|
||||||
* $ );
|
* );
|
||||||
* $ total_count
|
* total_count
|
||||||
* $ );
|
* );
|
||||||
* $ check_area_around_closest_player_for_block(block_to_check) ->
|
* check_area_around_closest_player_for_block(block_to_check) ->
|
||||||
* $ (
|
* (
|
||||||
* $ closest_player = players();
|
* closest_player = player();
|
||||||
* $ l(posx, posy, posz) = query(closest_player, 'pos');
|
* l(posx, posy, posz) = query(closest_player, 'pos');
|
||||||
* $ total_count = block_check( posx-8,1,posz-8, posx+8,17,posz+8, block_to_check);
|
* total_count = block_check( posx-8,1,posz-8, posx+8,17,posz+8, block_to_check);
|
||||||
* $ print('There is '+total_count+' of '+block_to_check+' around you')
|
* print('There is '+total_count+' of '+block_to_check+' around you')
|
||||||
* $ )
|
* )
|
||||||
*
|
*
|
||||||
* /script invoke check_area_around_closest_player_for_block 'diamond_ore'
|
* /script invoke check_area_around_closest_player_for_block 'diamond_ore'
|
||||||
*
|
*
|
||||||
@@ -198,16 +198,20 @@ import static java.lang.Math.min;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <h2>Line indicators</h2>
|
* <h2>Line indicators</h2>
|
||||||
|
* <p>Note that this should only apply to pasting your code to execute with commandblock. Scarpet recommends placing your
|
||||||
|
* code in packages (files with <code>.sc</code> extension that can be placed inside "/scripts" folder in the world files
|
||||||
|
* and loaded as a module with command <code>/script load [package_name]</code>. Scarpet modules loaded from disk should only
|
||||||
|
* contain code, no need to start with "/script run" prefix</p>
|
||||||
* <p>Since the maximum command that can be input to the chat is limited in length, you will be probably inserting your
|
* <p>Since the maximum command that can be input to the chat is limited in length, you will be probably inserting your
|
||||||
* programs by pasting them to command blocks, however pasting to command blocks will remove some whitespaces and squish
|
* programs by pasting them to command blocks or reading from world files, however pasting to command blocks will remove some whitespaces and squish
|
||||||
* your newlines making the code not readable. If you are pasting a program that is perfect and will never cause an error,
|
* your newlines making the code not readable. If you are pasting a program that is perfect and will never cause an error,
|
||||||
* I salute you, but for the most part it is quite likely that your program might break, either at compile time, when
|
* I salute you, but for the most part it is quite likely that your program might break, either at compile time, when
|
||||||
* its initially analyzed, or at execute time, when you suddenly attempt to divide something by zero. In these cases
|
* its initially analyzed, or at execute time, when you suddenly attempt to divide something by zero. In these cases
|
||||||
* you would want to get a meaningful error message, but for that you would need to indicate for the compiler where
|
* you would want to get a meaningful error message, but for that you would need to indicate for the compiler where
|
||||||
* did you put these new lines, since command block would squish them. For that, place at the beginning
|
* did you put these new lines, since command block would squish them. For that, place at the beginning
|
||||||
* of the line to let the copiler know where are you. This makes so that <code>$</code> is the only character that is
|
* of the line to let the compiler know where are you. This makes so that <code>$</code> is the only character that is
|
||||||
* illegal in programs, since it will be replaced with new lines. As far as I know, <code>$</code> is not used
|
* illegal in programs, since it will be replaced with new lines. As far as I know, <code>$</code> is not used
|
||||||
* anywhere inside Minecraft identifiers, so this shoudn't hinder the abilities of your programs.</p>
|
* anywhere inside Minecraft identifiers, so this shouldn't hinder the abilities of your programs.</p>
|
||||||
* <p>Consider the following program executed as command block command:</p>
|
* <p>Consider the following program executed as command block command:</p>
|
||||||
* <pre>
|
* <pre>
|
||||||
* /script run
|
* /script run
|
||||||
|
|||||||
Reference in new issue
Block a user