mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Update bot making documentation in ChatBot.cs
+ Add GetVarAsDouble in Script API (See #200)
This commit is contained in:
parent
2a07fbbae6
commit
f5575d7f8b
3 changed files with 24 additions and 11 deletions
|
|
@ -303,6 +303,21 @@ namespace MinecraftClient
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a global variable by name, as a double
|
||||
/// </summary>
|
||||
/// <param name="varName">Name of the variable</param>
|
||||
/// <returns>Value of the variable as double, or 0 if no variable or not a number</returns>
|
||||
public double GetVarAsDouble(string varName)
|
||||
{
|
||||
if (GetVar(varName) is double)
|
||||
return (double)GetVar(varName);
|
||||
double result;
|
||||
if (double.TryParse(GetVarAsString(varName), out result))
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a global variable by name, as a boolean
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue