[skip ci] Update document (#2468)

* Update execif document

* Update installation guide

* Add simple script page

* Add text script page to sidebar
This commit is contained in:
ReinforceZwei 2023-04-25 17:02:45 +08:00 committed by GitHub
parent 42abf928fb
commit 3570ef605e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 82 additions and 28 deletions

View file

@ -0,0 +1,26 @@
---
title: Creating Simple Script
---
# Creating Simple Script
A simple script is a text file with one command per line. See [Internal Commands](https://mccteam.github.io/guide/usage.html#internal-commands) section or type `/help` in the console to see available commands. Any line beginning with `#` is ignored and treated as a comment.
Application variables defined using the set command or [AppVars] INI section can be used. The following read-only variables can also be used: `%username%, %login%, %serverip%, %serverport%, %datetime%`
## Example
`sample-script.txt`: Send a hello message, wait 60 seconds and disconnect from server.
```
# This is a sample script for Minecraft Console Client
# Any line beginning with "#" is ignored and treated as a comment.
send Hello World! I'm a bot scripted using Minecraft Console Client.
wait 60
send Now quitting. Bye :)
exit
```
Go to [example scripts](https://github.com/MCCTeam/Minecraft-Console-Client/tree/master/MinecraftClient/config) to see more example.
If you want need advanced functions, please see [Creating Chat Bots](creating-bots.md)

View file

@ -20,32 +20,20 @@ If you're not the kind of person that likes textual tutorials, our community has
## Download a compiled binary
In order to run **Minecraft Console Client** you need [.NET 6.0 or new-er](https://dotnet.microsoft.com/en-us/download)
<div class="custom-container warning"><p class="custom-container-title">Warning</p>
**If you already have .NET, but an older version than `6.0`, please update to `6.0` since MCC might not work as expected or at all.**
</div>
#### How to install .NET on your platform
- [Install .NET on Windows](https://docs.microsoft.com/en-us/dotnet/core/install/windows)
- [Install .NET on Linux](https://docs.microsoft.com/en-us/dotnet/core/install/linux)
- [Install .NET on macOS](https://docs.microsoft.com/en-us/dotnet/core/install/macos)
#### Download
You can download a compiled binary file of the latest build from our Releases section on Git Hub: [Download](https://github.com/MCCTeam/Minecraft-Console-Client/releases)
## Building from the source code
We recommend you to download our precompiled binary file from [GitHub](https://github.com/MCCTeam/Minecraft-Console-Client/releases).
However, if you want to build the program from source code, please follow the guide.
### Windows
Requirements:
- [Git](https://www.git-scm.com/)
- [.NET 6.0 or new-er](https://dotnet.microsoft.com/en-us/download) or [Visual Studio](https://visualstudio.microsoft.com/) configured for C# app development
- [.NET 7.0 or new-er](https://dotnet.microsoft.com/en-us/download) or [Visual Studio](https://visualstudio.microsoft.com/) configured for C# app development
#### Cloning using Git
@ -98,7 +86,7 @@ If the build has succeeded, the compiled binary `MinecraftClient.exe` will be in
3. Run the following command to build the project:
```bash
dotnet publish MinecraftClient -f net6.0 -r win-x64 --no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None
dotnet publish MinecraftClient -f net7.0 -r win-x64 --no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None
```
If the build has succeeded, the compiled binary `MinecraftClient.exe` will be in `MinecraftClient/bin/Release/net6.0/win-x64/publish` folder.
@ -140,7 +128,7 @@ git clone https://github.com/MCCTeam/Minecraft-Console-Client.git --recursive
- On Linux:
```bash
dotnet publish MinecraftClient -f net6.0 -r linux-x64 --no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None
dotnet publish MinecraftClient -f net7.0 -r linux-x64 --no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None
```
<div class="custom-container tip"><p class="custom-container-title">Tip</p>
@ -152,7 +140,7 @@ git clone https://github.com/MCCTeam/Minecraft-Console-Client.git --recursive
- On macOS:
```bash
dotnet publish MinecraftClient -f net6.0 -r osx-x64 --no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None
dotnet publish MinecraftClient -f net7.0 -r osx-x64 --no-self-contained -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None
```
<div class="custom-container tip"><p class="custom-container-title">Tip</p>
@ -163,8 +151,8 @@ git clone https://github.com/MCCTeam/Minecraft-Console-Client.git --recursive
If the build has succeeded, the compiled binary `MinecraftClient` will be in:
- Linux: `MinecraftClient/bin/Release/net6.0/linux-x64/publish/`
- macOS: `MinecraftClient/bin/Release/net6.0/osx-x64/publish/`
- Linux: `MinecraftClient/bin/Release/net7.0/linux-x64/publish/`
- macOS: `MinecraftClient/bin/Release/net7.0/osx-x64/publish/`
## Using Docker

View file

@ -470,7 +470,7 @@ In scripts and remote control, no slash is needed to perform the command, eg. `q
- **Usage:**
Basic usage: `/execif <condition (C# expression)> ---> <command>`
Basic usage: `/execif <condition (C# expression)> <command>`
- **Examples:**
@ -478,30 +478,38 @@ In scripts and remote control, no slash is needed to perform the command, eg. `q
```
/set test=Something
/execif test == "Something" ---> send Success!
/execif 'test == "Something"' "send Success!"
```
<div class="custom-container tip"><p class="custom-container-title">Tip</p>
**You can use single quote (`'`) to wrap your expression if the expression contains double quote (`"`)**
**Adding back-slash (`\`) before the double quote will also work (`/execif "test == \"Something\"" "send Success!"`)**
</div>
```
/set test2=1
/execif test2 == "1" ---> send Success 2!
/execif 'test2 == "1"' "send Success 2!"
```
Basic C# expression:
```
/execif 1 + 2 + 3 == 6 ---> send Success!
/execif "1 + 2 + 3 == 6" "send Success!"
```
Using MCC class:
```
/execif MCC.GetHealth() == 20.0 ---> send Success!
/execif "MCC.GetHealth() == 20.0" "send Success!"
```
Using in combination with [`execmulti`](#execmulti):
```
/execif 1 == 1 ---> execmulti send 1 -> send 2 -> send 3
/execif "1 == 1" "execmulti send 1 -> send 2 -> send 3"
```
### `execmulti`