Repository navigation
EN UO Topic conversion compatibility
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Converts numbers, serial and old script formats. A compatible name may have restrictions or an explicitly prohibited operation - this is indicated on the card.
| Topic | Commands and explanations |
|---|---|
| Hex / int | UO.Hex2Int · UO.Int2Hex |
| EUO ↔ Injection | UO.EUO2ID · UO.EUO2Type · UO.EUO2Inj · UO.Inj2EUO |
| EasyUO | UO.GetEasyUO · UO.SetEasyUO |
| Type Conversion | C# and standard library C# and standard library C# and standard library C# and standard library C# and standard library · C# and standard library |
UO.Hex2Int · UO.Int2Hex · UO.ScanInt · UO.EUO2ID · UO.EUO2Inj · UO.EUO2Type · UO.Inj2EUO
UO.BoxHack · UO.ShutdownWindows
Each command card has several independent scenarios: direct code, functions and classes. Below are selected short scenarios; restrictions and full analysis are in the cards.
Parameters, result and all scenarios
UO.Print(UO.Int2Hex(1073746484));Parameters, result and all scenarios
var value = UO.EUO2ID("B");
UO.Print(Convert.ToString(value));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.BoxHack();Prints a notice that the legacy native client patch BoxHack is not required by ClassicUO.
There are no parameters.
void - no return value.
- The ExecuteLegacyManualAlias branch only calls SystemMessage. It does not correct motion, speech, containers, or network protocol.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.BoxHack");
UO.BoxHack();Parameters and execution flow:
- The message describes the lack of need for the old patch.
UO.BoxHack();Parameters and execution flow:
- The compatibility procedure does not change the game world.
return RunScenario();
object? RunScenario()
{
CompatibilityNotice();
return null;
}
void CompatibilityNotice()
{
UO.BoxHack();
}Parameters and execution flow:
- After the diagnostic message, execution continues.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.BoxHack();
UO.Print("continued");
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage($"{name}: obsolete native-client patch; ClassicUO does not require it.").
Internal implementation code; this is not a standalone script.
case "boxhack":
case "fixtalk":
case "fixwalk":
SystemMessage($"{name}: obsolete native-client patch; ClassicUO does not require it.");
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.EUO2ID(object? euo);Decodes the EasyUO literal notation in radix 26 with A=0.
-
euo— EasyUO string/value. Letters are converted to upper case; non-letter characters are skipped.
int — the resulting 32-bit numeric value; this is not a hex string.
- Sequentially calculates value=value*26+(letter-A). The uint accumulator runs unchecked, so the overflow wraps around the 32 bits. The empty string and the string without letters give 0. Doesn't look for any objects in the world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.EUO2ID("B");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- B encodes the number 1.
var value = UO.EUO2ID("B");
UO.Print(Convert.ToString(value));Parameters and execution flow:
- Case is not important; The hyphen and exclamation mark are skipped.
return RunScenario();
object? RunScenario()
{
var value = UO.EUO2ID("b-!");
UO.Print(Convert.ToString(value));
return null;
}Parameters and execution flow:
- A codes zero; the result does not indicate the object found.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var value = UO.EUO2ID("A");
UO.Print(Convert.ToString(value));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: euo (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.DecodeEasyUoId:DecodeEasyUoId(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "euo2id":
case "euo2type": return new InjectionValue(DecodeEasyUoId(Text(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.EUO2Inj(object? easyValue);Decodes the EasyUO literal notation in radix 26 with A=0.
-
easyValue— EasyUO string/value. Letters are converted to upper case; non-letter characters are skipped.
string is the hex-string of the Injection of the resulting serial.
- Sequentially calculates value=value*26+(letter-A). The uint accumulator runs unchecked, so the overflow wraps around the 32 bits. The empty string and the string without letters give 0. Doesn't look for any objects in the world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.EUO2Inj("B");
UO.Print("EUO2Inj: " + Convert.ToString(result));Parameters and execution flow:
- B encodes the number 1.
var value = UO.EUO2Inj("B");
UO.Print(Convert.ToString(value));Parameters and execution flow:
- Case is not important; The hyphen and exclamation mark are skipped.
return RunScenario();
object? RunScenario()
{
var value = UO.EUO2Inj("b-!");
UO.Print(Convert.ToString(value));
return null;
}Parameters and execution flow:
- A codes zero; the result does not indicate the object found.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var value = UO.EUO2Inj("A");
UO.Print(Convert.ToString(value));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: easyValue (Any)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.EUO2Inj. -
InjectionScript.Runtime.InjectionValue.ToString:easyValue.ToString(). -
InjectionScript.Runtime.NumberConversions.ToHex:NumberConversions.ToHex(unchecked((int)value)).
Internal implementation code; this is not a standalone script.
public string EUO2Inj(InjectionValue easyValue)
{
uint value = 0;
foreach (char c in easyValue.ToString().ToUpperInvariant())
{
if (c < 'A' || c > 'Z')
continue;
value = unchecked(value * 26 + (uint)(c - 'A'));
}
return NumberConversions.ToHex(unchecked((int)value));
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.EUO2Type(object? euo);Decodes the EasyUO literal notation in radix 26 with A=0.
-
euo— EasyUO string/value. Letters are converted to upper case; non-letter characters are skipped.
int — the resulting 32-bit numeric value; this is not a hex string.
- Sequentially calculates value=value*26+(letter-A). The uint accumulator runs unchecked, so the overflow wraps around the 32 bits. The empty string and the string without letters give 0. Doesn't look for any objects in the world.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
object? result = UO.EUO2Type("B");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- B encodes the number 1.
var value = UO.EUO2Type("B");
UO.Print(Convert.ToString(value));Parameters and execution flow:
- Case is not important; The hyphen and exclamation mark are skipped.
return RunScenario();
object? RunScenario()
{
var value = UO.EUO2Type("b-!");
UO.Print(Convert.ToString(value));
return null;
}Parameters and execution flow:
- A codes zero; the result does not indicate the object found.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var value = UO.EUO2Type("A");
UO.Print(Convert.ToString(value));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: euo (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.DecodeEasyUoId:DecodeEasyUoId(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "euo2id":
case "euo2type": return new InjectionValue(DecodeEasyUoId(Text(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Hex2Int(object? value);Converts a numeric value or numeric text to an int.
-
value— int, double, double text or hex text with 0x. Spaces around the edges and the sign are allowed. Alias strings "self"/"lasttarget" are not allowed here.
int with 32 bits; hex 0xFFFFFFFF gives -1. double is truncated to zero with a range check. Array and null in NumberConversions.ToInt result in 0.
- Despite the name, decimal text is accepted. Invalid text gives FormatException, unsupported type gives InvalidCastException; double overflow—conversion error.
- Reverse formatting is UO.Int2Hex. A transformation does not prove the existence of an object.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.Hex2Int("0x40001234");
UO.Print("Hex2Int: " + Convert.ToString(result));Parameters and execution flow:
- Converts a numeric value or numeric text to an int.
UO.Print(UO.Hex2Int("0x40001234"));Parameters and execution flow:
- Despite the name, decimal text is accepted. Invalid text gives FormatException, unsupported type gives InvalidCastException; double overflow—conversion error.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.Hex2Int("255"));
UO.Print(UO.Hex2Int("0xFFFFFFFF"));
return null;
}Parameters and execution flow:
- Reverse formatting is UO.Int2Hex. A transformation does not prove the existence of an object.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var number = UO.Hex2Int("0x000000FF");
UO.Print(UO.Int2Hex(number));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Hex2Int. -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(value).
Internal implementation code; this is not a standalone script.
public int Hex2Int(InjectionValue value) => NumberConversions.ToInt(value);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.Inj2EUO(object? serialValue);Encodes the 32-bit number serial with the letters A..Z for EasyUO.
-
serialValue— Number through NumberConversions.ToInt, then unsigned uint with bits preserved. For an alias, first get GetSerial/Hex2Int.
string — regular base digits 26 with A=0..Z=25. Zero gives "A". This is not a hex or an object name.
- The algorithm inserts the letter A + value % 26 on the left and divides uint by 26 to zero. This is the project's own conversion, not Excel A1 column number.
- EUO2Inj does the reverse conversion to a hex string. Encoding does not create an object and does not request it from the client.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.Inj2EUO(0);
UO.Print("Inj2EUO: " + Convert.ToString(result));Parameters and execution flow:
- Encodes the 32-bit number serial with the letters A..Z for EasyUO.
UO.Print(UO.Inj2EUO(0));Parameters and execution flow:
- The algorithm inserts the letter A + value % 26 on the left and divides uint by 26 to zero. This is the project's own conversion, not Excel A1 column number.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.Inj2EUO(26));
UO.Print(UO.Inj2EUO(25));
return null;
}Parameters and execution flow:
- EUO2Inj does the reverse conversion to a hex string. Encoding does not create an object and does not request it from the client.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var value = UO.Hex2Int("0x40001234");
var encoded = UO.Inj2EUO(value);
UO.Print(encoded);
UO.Print(UO.EUO2Inj(encoded));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: serialValue (Any)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Inj2EUO. -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(serialValue).
Internal implementation code; this is not a standalone script.
public string Inj2EUO(InjectionValue serialValue)
{
uint value = unchecked((uint)NumberConversions.ToInt(serialValue));
if (value == 0)
return "A";
var result = new StringBuilder();
while (value > 0)
{
result.Insert(0, (char)('A' + value % 26));
value /= 26;
}
return result.ToString();
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.Int2Hex(object? value);Formats an int as a hexadecimal serial string.
-
value— int or numeric/hex text; double is truncated to zero with an overflow check. The object alias cannot be found.
string "0xXXXXXXXX": eight hex digits, all 32 int bits. A negative value is represented in two's complement.
- NumberConversions.ToInt performs the conversion, then ToHex uses the X8 format. For example -1 gives "0xFFFFFFFF". Invalid numeric text causes an error; this is not checking for the existence of serial.
- To represent a number, conversion is sufficient; the presence of the object is checked by UO.Exists separately.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.Int2Hex(1073746484);
UO.Print("Int2Hex: " + Convert.ToString(result));Parameters and execution flow:
- Formats an int as a hexadecimal serial string.
UO.Print(UO.Int2Hex(1073746484));Parameters and execution flow:
- NumberConversions.ToInt performs the conversion, then ToHex uses the X8 format. For example -1 gives "0xFFFFFFFF". Invalid numeric text causes an error; this is not checking for the existence of serial.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.Int2Hex(-1));
return null;
}Parameters and execution flow:
- To represent a number, conversion is sufficient; the presence of the object is checked by UO.Exists separately.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var encoded = UO.Int2Hex(255);
UO.Print(encoded);
UO.Print(UO.Hex2Int(encoded));
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: value (Any)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Int2Hex. -
InjectionScript.Runtime.NumberConversions.ToHex:NumberConversions.ToHex(NumberConversions.ToInt(value)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(value).
Internal implementation code; this is not a standalone script.
public string Int2Hex(InjectionValue value) => NumberConversions.ToHex(NumberConversions.ToInt(value));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.ScanInt(object? textValue, object? startValue);Finds the first signed double/hex number in the string, starting at position.
-
textValue— Text via ToString. Searches for the first match of the regular expression [-+]?(?:0[xX][0-9A-Fa-f]+|\d+). -
startValue— int, zero position UTF-16. Limited to 0..text.Length; not index from 1.
int is the first 32-bit number recognized. There is no match or the number does not fit - 0; a real zero also gives 0.
- Regex.Match is applied to Substring(start). If the first match fails to convert TryStr2Int, the next numbers are not searched. The fractional part, such as .5, is not included in the numeric token.
- A negative start becomes 0, a start beyond the end of the line becomes text.Length and the result is 0. The original line does not change.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The result of one call is printed in the journal. A number is not converted to bool; an array is displayed as its element count.
var result = UO.ScanInt("gold=123", 0);
UO.Print("ScanInt: " + Convert.ToString(result));Parameters and execution flow:
- Finds the first signed double/hex number in the string, starting at position.
UO.Print(UO.ScanInt("gold=123", 0));Parameters and execution flow:
- Regex.Match is applied to Substring(start). If the first match fails to convert TryStr2Int, the next numbers are not searched. The fractional part, such as .5, is not included in the numeric token.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ScanInt("-7 0xFF", 3));
return null;
}Parameters and execution flow:
- A negative start becomes 0, a start beyond the end of the line becomes text.Length and the result is 0. The original line does not change.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var text = "count=0x20";
var amount = UO.ScanInt(text, 6);
UO.Print(amount);
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: textValue (Any), startValue (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ScanInt. -
InjectionScript.Runtime.InjectionValue.ToString:textValue.ToString(). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(startValue). -
InjectionScript.Runtime.NumberConversions.TryStr2Int:NumberConversions.TryStr2Int(match.Value, out int value).
Internal implementation code; this is not a standalone script.
public int ScanInt(InjectionValue textValue, InjectionValue startValue)
{
string text = textValue.ToString() ?? string.Empty;
int start = Math.Max(0, Math.Min(text.Length, NumberConversions.ToInt(startValue)));
Match match = Regex.Match(text.Substring(start), @"[-+]?(?:0[xX][0-9A-Fa-f]+|\d+)", RegexOptions.CultureInvariant);
return match.Success && NumberConversions.TryStr2Int(match.Value, out int value) ? value : 0;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ShutdownWindows(object? state);Always rejects an attempt to shutdown Windows from a script.
-
state- Legacy argument is stored in the signature, but is not used: any call is blocked.
There is no normal result: NativeSubrutineException with the message "shutdownwindows is intentionally blocked: scripts may not shut down Windows."
- ExecuteLegacyManualAlias throws an exception immediately. No shutdown, reboot, or launch of an external process is performed.
- All three examples deliberately show forbidden calls and fail when run. They cannot be used as a condition for successful shutdown.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
try { UO.ShutdownWindows(0); }
catch (Exception error) { UO.Print(error.Message); }Parameters and execution flow:
- Always rejects an attempt to shutdown Windows from a script.
UO.ShutdownWindows(0);Parameters and execution flow:
- ExecuteLegacyManualAlias throws an exception immediately. No shutdown, reboot, or launch of an external process is performed.
return RunScenario();
object? RunScenario()
{
UO.ShutdownWindows(1);
return null;
}Parameters and execution flow:
- All three examples deliberately show forbidden calls and fail when run. They cannot be used as a condition for successful shutdown.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.Print("The next command is expected to fail");
UO.ShutdownWindows(0);
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: state (Any)
Result: void / Unit.
During a call:
Internal implementation code; this is not a standalone script.
case "shutdownwindows":
throw new NativeSubrutineException("shutdownwindows is intentionally blocked: scripts may not shut down Windows.");ClassicUO — Bad Newbie & C# Scripts IDE