Empezando con tus archivos

Link to empezando-con-tus-archivos

CraftTweaker uses a custom scripting Language called ZenScript, ZenScript is read from .zs files that are stored in the <gamedir>/scripts folder, if you aren't sure where this folder is, just run /ct scripts when in the game and the folder will open.

ZenScript es un lenguaje de programación que va de arriba a abajo, lo que quiere decir que las declaraciones de Variables y las Importaciones deberían encontrarse como más arribo del fichero, mejor. Esto no quiere decir que no puedas declarar Variables en cualquier parte, solo que esa variable no existirá a los ojos de las líneas que estén por delante de la declaración.

Script files have the .zs suffix, make sure that it isn't .zs.txt!

What are scripts

Link to what-are-scripts

Scripts are stored in <gamedir>/scripts and are loaded when the player joins a world, much like previous versions of CraftTweaker (excluding 1.12), Scripts CAN be reloaded, just run /reload.

When joining a server, the server sends their scripts to the client, and the client runs those scripts. This does mean that a client without any scripts, can join a server and get the changes (useful if you need to disable an item on the server but don't want to force clients to download extra files!)

Escribiendo tu primer archivo.

Link to escribiendo-tu-primer-archivo

To get started with Scripts, you can create a very basic file, called hello.zs in the <gamedir>/scripts> folder; If you aren't sure where the folder is, just run /ct scripts and it should open!

Dentro de hola.zs pon la siguiente línea:

ZenScript
Copy
println("Hello world!");

Now load up Minecraft and and take a look at the <gamedir>/logs/crafttweaker.log file (or run /ct log to have the file open in your default text editor).

The crafttweaker.log file is located in <gamedir>/logs and can be read by any program that can read plaintext files.

It is recommended to use VSCode, Sublime Text or Notepad++ to edit script files, however any program will do.

When choosing a program to use to edit scripts, take a look at what Syntax highlighters are available, most common text editors have ZenScript highlighting support through the use of a plugin.

El archivo crafttweaker.log usa una sintaxis muy specifica en la salida de información, que es:

Copy
[HH:MM:SS.ms][TYPE] <message>

Mirando el ejemplo de arriba, nuestra salida para el fichero hola.zs sería:

Copy
[14:58:06.697][INFO] Hello world!

Los comentarios se acostumbran a usar para hacer tus archivos más comprensibles y fáciles de entender para ti y para otra persona que lo pueda leer.

Zenscript ofrece 3 tipos de comentarios, que son:

Comentario de una línea : //Soy un comentario

Comentario de una línea alternativo: #Yo también

Comentario de más de una línea

Copy
 /*  Soy
un comentario 
multilinear!
 */

Just note, that # comments are also used for PreProcessors, so while they are still valid comments, they could cause unwanted side effects.

Now you know the absolute basics of how to create scripts. Now, what you do is up to you! Feel free to browse the Docs for any pages that interest you.

However, if you're getting started, we recommend checking out the Tutorial tab, more specifically the Crafting Table Tutorial as well as the Recipe Managers page for information on how to add and remove different kinds of recipes.