mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add support for C# script extensions
- Allow defining function for use into the script - Allow defining a ChatBot for loading it into MCC - Improve sample script and add more examples - Todo add new documentation into the readme file
This commit is contained in:
parent
a6b3bf0481
commit
e29b4ee545
6 changed files with 115 additions and 26 deletions
30
MinecraftClient/config/sample-script-extended.cs
Normal file
30
MinecraftClient/config/sample-script-extended.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//MCCScript 1.0
|
||||
|
||||
/* This script demonstrates how to add fields and methods */
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int count = GetVarAsInt("test") + 1;
|
||||
SetVar("test", count);
|
||||
SendHelloWorld(count);
|
||||
SleepBetweenSends();
|
||||
}
|
||||
|
||||
//MCCScript Extensions
|
||||
|
||||
/* Here you can define methods for use into your script */
|
||||
|
||||
void SendHelloWorld(int count)
|
||||
{
|
||||
/* Warning: Do not make more than one server-related call into a method
|
||||
* defined as a script extension eg SendText or switching servers,
|
||||
* as execution flow is not managed in the Extensions section */
|
||||
|
||||
SendText("Hello World no. " + count);
|
||||
}
|
||||
|
||||
void SleepBetweenSends()
|
||||
{
|
||||
LogToConsole("Sleeping for 5 seconds...");
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue