mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Added a random interval option to the wait command
Added a random interval option to the wait command
This commit is contained in:
commit
ac65482296
4 changed files with 56 additions and 3 deletions
|
|
@ -205,7 +205,29 @@ namespace MinecraftClient.ChatBots
|
|||
int ticks = 10;
|
||||
try
|
||||
{
|
||||
ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
if (instruction_line[5..].Contains("to", StringComparison.OrdinalIgnoreCase) ||
|
||||
instruction_line[5..].Contains("-"))
|
||||
{
|
||||
var processedLine = instruction_line.Replace("wait", "")
|
||||
.Trim()
|
||||
.ToLower();
|
||||
processedLine = string.Join("", processedLine.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
|
||||
var parts = processedLine.Contains("to") ? processedLine.Split("to") : processedLine.Split("-");
|
||||
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
var min = Convert.ToInt32(parts[0]);
|
||||
var max = Convert.ToInt32(parts[1]);
|
||||
|
||||
if (min > max)
|
||||
{
|
||||
(min, max) = (max, min);
|
||||
LogToConsole(Translations.cmd_wait_random_min_bigger);
|
||||
}
|
||||
|
||||
ticks = new Random().Next(min, max);
|
||||
} else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
} else ticks = Convert.ToInt32(instruction_line[5..]);
|
||||
}
|
||||
catch { }
|
||||
sleepticks = ticks;
|
||||
|
|
|
|||
|
|
@ -3968,5 +3968,11 @@ namespace MinecraftClient {
|
|||
return ResourceManager.GetString("bot.common.movement.lock.held", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string cmd_wait_random_min_bigger {
|
||||
get {
|
||||
return ResourceManager.GetString("cmd.wait.random.min.bigger", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2115,4 +2115,7 @@ Logging in...</value>
|
|||
<data name="bot.common.movement.lock.held" xml:space="preserve">
|
||||
<value>You can not start/run/use the '{0}' bot because it requires movement, the movement is currently utilized by the '{1}' bot, stop it if you want to use this one.</value>
|
||||
</data>
|
||||
<data name="cmd.wait.random.min.bigger" xml:space="preserve">
|
||||
<value>Minimum number that you have provided is bigger than the maximum, swapping them around!</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -695,10 +695,10 @@ In scripts and remote control, no slash is needed to perform the command, eg. `q
|
|||
- **Examples:**
|
||||
|
||||
```
|
||||
/setrnd <variable> -7to10
|
||||
/setrnd <variable> -7 to 10
|
||||
```
|
||||
|
||||
(Set a `%variable%` to a number from -7 to 9)
|
||||
(Set a `%variable%` to a number from -7 to 10)
|
||||
|
||||
### `sneak`
|
||||
|
||||
|
|
@ -836,16 +836,38 @@ In scripts and remote control, no slash is needed to perform the command, eg. `q
|
|||
|
||||
- **Usage:**
|
||||
|
||||
Fixed time:
|
||||
|
||||
```
|
||||
/wait <time>
|
||||
```
|
||||
|
||||
Random time:
|
||||
|
||||
```
|
||||
/wait <minimum time> to <maximum time>
|
||||
```
|
||||
|
||||
<div class="custom-container tip"><p class="custom-container-title">Tip</p>
|
||||
|
||||
**You can use `-` instead of `to`**
|
||||
|
||||
</div>
|
||||
|
||||
- **Examples:**
|
||||
|
||||
```
|
||||
/wait 20
|
||||
```
|
||||
|
||||
```
|
||||
/wait 20 to 100
|
||||
```
|
||||
|
||||
```
|
||||
/wait 20-35
|
||||
```
|
||||
|
||||
### `move`
|
||||
|
||||
- **Description:**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue