mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Various C# Script improvements
Move handling code in a separate file Add caching ability for low-power devices (rpi..) Use a distinct API with MCC.MethodName() Stop script execution only on specific API calls
This commit is contained in:
parent
ca02c7f2e6
commit
3e2622fbb7
8 changed files with 407 additions and 159 deletions
|
|
@ -9,8 +9,8 @@ if (args.Length > 0)
|
|||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
int count = GetVarAsInt("test") + 1;
|
||||
SetVar("test", count);
|
||||
int count = MCC.GetVarAsInt("test") + 1;
|
||||
MCC.SetVar("test", count);
|
||||
SendHelloWorld(count, text);
|
||||
SleepBetweenSends();
|
||||
}
|
||||
|
|
@ -21,15 +21,11 @@ for (int i = 0; i < 5; i++)
|
|||
|
||||
void SendHelloWorld(int count, string text)
|
||||
{
|
||||
/* 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 + ": " + text);
|
||||
MCC.SendText("Hello World no. " + count + ": " + text);
|
||||
}
|
||||
|
||||
void SleepBetweenSends()
|
||||
{
|
||||
LogToConsole("Sleeping for 5 seconds...");
|
||||
MCC.LogToConsole("Sleeping for 5 seconds...");
|
||||
Thread.Sleep(5000);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue