Repository navigation
EN UO Topic profiles configuration
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Profiles, saving settings, global values and hotkeys. The global runtime value and the local procedure variable have different lifetimes.
| Topic | Commands and explanations |
|---|---|
| GetProfile | UO.GetProfile |
| ProfileName | UO.ProfileName |
| ProfileShardName | UO.ProfileShardName |
| ChangeProfile | UO.ChangeProfile |
| ExtChangeProfile | UO.ExtChangeProfile |
| ResetProfile | UO.ResetProfile |
| SaveConfig | UO.SaveConfig |
| Global Variables | UO.GetGlobal · UO.SetGlobal · UO.GListGet · UO.GListSet · UO.GListSize |
| EasyUO Variables | UO.GetEasyUO · UO.SetEasyUO |
| MUL Path | UO.SetMulPath |
UO.GetProfile · UO.ProfileName · UO.ProfileShardName · UO.ChangeProfile · UO.ExtChangeProfile · UO.ResetProfile · UO.SaveConfig · UO.ReqProfile · UO.ClientProfilePath · UO.ClientPath · UO.SetMulPath
UO.GetGlobal · UO.SetGlobal · UO.GetEasyUO · UO.SetEasyUO · UO.GListClear · UO.GListGet · UO.GListPosName · UO.GListPosValue · UO.GListSet · UO.GListSize
UO.LoadHotkeys · UO.SaveHotkeys · UO.Set · UO.SetDefault
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
var text = UO.GetGlobal("manual.delay");
var delayMs = 350;
if (Truth(text != "N/A") && Truth(IsNumeric(text)))
{
var parsed = Val(text);
if (Truth(parsed >= 50) && Truth(parsed <= 5000))
{
delayMs = checked((int)parsed);
}
}
await Delay(delayMs);
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;Parameters, result and all scenarios
UO.SetGlobal("manual.delay", 350);
UO.SetGlobal("manual.delay", 600);
var text = UO.GetGlobal("manual.delay");
if (Truth(IsNumeric(text)))
{
await Delay(Val(text));
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ChangeProfile(object? name);Changes the selected profile for the next self-client connection when the session is disconnected.
-
name— Saved profile/character name resolved by TryResolveProfileCharacter for the selected shard. An empty/unknown name gives -4.
int: 0 — selection is prepared; -2 — manager session or connection/game world is active; -3 — more than one script is executed; -4 - profile name/shard is not allowed.
- ChangeProfile passes empty shard/character; ExtChangeProfile allows explicit shard and character. In the manager session, you need to select another session in ClassicUO Manager - the running session saves its profile.
- If successful, saves and unloads the current profile, changes LastServerName, saves the settings and assigns the next character. The connection itself does not start; Connect is called for it 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.
object? result = UO.ChangeProfile("ExampleProfile");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Use the actual saved profile name; a negative code describes a failure.
var status = UO.ChangeProfile("ExampleProfile");
UO.Print(Convert.ToString(status));Parameters and execution flow:
- A disabled standalone client with no other violation returns -4 for an empty name.
return RunScenario();
object? RunScenario()
{
var status = UO.ChangeProfile("");
UO.Print(Convert.ToString(status));
return null;
}Parameters and execution flow:
- Connect is called only after the code 0; The server response has not yet been confirmed.
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 status = UO.ChangeProfile("ExampleProfile");
if (Truth(status == 0))
{
UO.Connect();
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: name (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ChangeProfileSelection:bridge.ChangeProfileSelection(Text(0), string.Empty, string.Empty). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "changeprofile":
return new InjectionValue(bridge.ChangeProfileSelection(Text(0), string.Empty, string.Empty));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.ClientPath();Returns the client installation/executable directory.
There are no parameters.
string — path to the directory. It's not a bool, it's not an array, and it's not ID. An empty path means the value is not available; don't use it as your default current working folder.
- Read CUOEnviroment.ExecutablePath. This is not a driving route, a list of waypoints, a script folder, or a path to game data.
- The command only reads the path, does not open, create or save anything. The trailing delimiter should not be assumed; the helper example adds it if necessary.
- The name is the game/client name API and is spelled with UO. ClientPath returns the client directory, ClientProfilePath returns the active profile directory.
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.ClientPath();
UO.Print("ClientPath: " + Convert.ToString(result));Parameters and execution flow:
- There are no arguments. folder - string; an empty value is processed separately.
var folder = UO.ClientPath();
if (Truth(folder == ""))
{
UO.Print("Folder is not available");
return null;
}
UO.Print(folder);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- These folders have different purposes. The script outputs both lines without changing the configuration or profile.
return RunScenario();
object? RunScenario()
{
var client = UO.ClientPath();
var profile = UO.ClientProfilePath();
UO.Print("Client: " + client);
if (Truth(profile == ""))
{
UO.Print("No current profile");
}
else
{
UO.Print("Profile: " + profile);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ChildPath is shown in its entirety: folder is the resulting directory, leaf is the file name. This is a string concatenation for a given name, not a universal path normalizer.
- The file is not created or read; First you can check the resulting string.
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 folder = UO.ClientPath();
var filePath = ChildPath(folder, "sample.json");
if (Truth(filePath != ""))
{
UO.Print("Example path: " + filePath);
}
return null;
}
dynamic ChildPath(dynamic folder, dynamic leaf)
{
if (Truth(folder == ""))
{
return "";
}
var last = Right(folder, 1);
if (Truth(last == "/") || Truth(last == "\\"))
{
return folder + leaf;
}
return folder + "/" + leaf;
}
string Right(object? value, int count)
{
string text = Convert.ToString(value) ?? "";
return text[Math.Max(0, text.Length - count)..];
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ClientPath:bridge.ClientPath.
Internal implementation code; this is not a standalone script.
case "clientpath": return new InjectionValue(bridge.ClientPath);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.ClientProfilePath();Returns the current client profile directory.
There are no parameters.
string — path to the directory. It's not a bool, it's not an array, and it's not ID. An empty path means the value is not available; don't use it as your default current working folder.
- Read ProfileManager.ProfilePath; if the profile has not yet been selected, an empty string is returned. The call itself does not create a profile and does not transfer settings.
- The command only reads the path, does not open, create or save anything. The trailing delimiter should not be assumed; the helper example adds it if necessary.
- The name is the game/client name API and is spelled with UO. ClientPath returns the client directory, ClientProfilePath returns the active profile directory.
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.ClientProfilePath();
UO.Print("ClientProfilePath: " + Convert.ToString(result));Parameters and execution flow:
- There are no arguments. folder - string; an empty value is processed separately.
var folder = UO.ClientProfilePath();
if (Truth(folder == ""))
{
UO.Print("Folder is not available");
return null;
}
UO.Print(folder);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- These folders have different purposes. The script outputs both lines without changing the configuration or profile.
return RunScenario();
object? RunScenario()
{
var client = UO.ClientPath();
var profile = UO.ClientProfilePath();
UO.Print("Client: " + client);
if (Truth(profile == ""))
{
UO.Print("No current profile");
}
else
{
UO.Print("Profile: " + profile);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ChildPath is shown in its entirety: folder is the resulting directory, leaf is the file name. This is a string concatenation for a given name, not a universal path normalizer.
- The file is not created or read; First you can check the resulting string.
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 folder = UO.ClientProfilePath();
var filePath = ChildPath(folder, "sample.json");
if (Truth(filePath != ""))
{
UO.Print("Example path: " + filePath);
}
return null;
}
dynamic ChildPath(dynamic folder, dynamic leaf)
{
if (Truth(folder == ""))
{
return "";
}
var last = Right(folder, 1);
if (Truth(last == "/") || Truth(last == "\\"))
{
return folder + leaf;
}
return folder + "/" + leaf;
}
string Right(object? value, int count)
{
string text = Convert.ToString(value) ?? "";
return text[Math.Max(0, text.Length - count)..];
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CurrentProfilePath:bridge.CurrentProfilePath.
Internal implementation code; this is not a standalone script.
case "shardpath":
case "clientprofilepath": return new InjectionValue(bridge.CurrentProfilePath);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ExtChangeProfile(object? profileName);
dynamic UO.ExtChangeProfile(object? profileName, object? shardName);
dynamic UO.ExtChangeProfile(object? profileName, object? shardName, object? charName);Changes the selected profile for the next self-client connection when the session is disconnected.
-
profileName— Saved profile/character name resolved by TryResolveProfileCharacter for the selected shard. An empty/unknown name gives -4. -
shardName— Optional shard name. An empty value uses CurrentProfile.ServerName, World.ServerName, or LastServerName. -
charName- Optional character name. An empty value uses the saved profile name.
int: 0 — selection is prepared; -2 — manager session or connection/game world is active; -3 — more than one script is executed; -4 - profile name/shard is not allowed.
- ChangeProfile passes empty shard/character; ExtChangeProfile allows explicit shard and character. In the manager session, you need to select another session in ClassicUO Manager - the running session saves its profile.
- If successful, saves and unloads the current profile, changes LastServerName, saves the settings and assigns the next character. The connection itself does not start; Connect is called for it 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.
object? result = UO.ExtChangeProfile("ExampleProfile");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Use the actual saved profile name; a negative code describes a failure.
var status = UO.ExtChangeProfile("ExampleProfile");
UO.Print(Convert.ToString(status));Parameters and execution flow:
- A disabled standalone client with no other violation returns -4 for an empty name.
return RunScenario();
object? RunScenario()
{
var status = UO.ExtChangeProfile("");
UO.Print(Convert.ToString(status));
return null;
}Parameters and execution flow:
- Connect is called only after the code 0; The server response has not yet been confirmed.
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 status = UO.ExtChangeProfile("ExampleProfile");
if (Truth(status == 0))
{
UO.Connect();
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: profileName (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ChangeProfileSelection:bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter).
Internal implementation code; this is not a standalone script.
case "extchangeprofile":
{
string requestedProfile = Text(0);
string requestedShard = arguments.Length > 1 ? Text(1) : string.Empty;
string requestedCharacter = arguments.Length > 2 ? Text(2) : string.Empty;
return new InjectionValue(bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter));
}Parameters: profileName (Any), shardName (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ChangeProfileSelection:bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter).
Internal implementation code; this is not a standalone script.
case "extchangeprofile":
{
string requestedProfile = Text(0);
string requestedShard = arguments.Length > 1 ? Text(1) : string.Empty;
string requestedCharacter = arguments.Length > 2 ? Text(2) : string.Empty;
return new InjectionValue(bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter));
}Parameters: profileName (Any), shardName (Any), charName (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ChangeProfileSelection:bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter).
Internal implementation code; this is not a standalone script.
case "extchangeprofile":
{
string requestedProfile = Text(0);
string requestedShard = arguments.Length > 1 ? Text(1) : string.Empty;
string requestedCharacter = arguments.Length > 2 ? Text(2) : string.Empty;
return new InjectionValue(bridge.ChangeProfileSelection(requestedProfile, requestedShard, requestedCharacter));
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GListClear();Clears the entire temporary list before a new series of actions.
There are no parameters.
void - no result. After clearing, GListSize() returns 0.
- The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
- The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
- Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.
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.GListClear");
UO.GListClear();Parameters and execution flow:
- Clear removes both rules, Size confirms emptiness. The character's items remain in place.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
UO.GListClear();
if (Truth(UO.GListSize() == 0))
{
UO.Print("Batch rules cleared");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Old rules are removed before ore is added; search only shows the new rule with graphic 0x19B9.
return RunScenario();
object? RunScenario()
{
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
UO.GListClear();
UO.GListSet("ore", 0x19B9);
var i = 0;
while (Truth(i < UO.GListSize()))
{
var name = UO.GListPosName(i);
var graphic = UO.GListPosValue(i);
UO.Print(name + " | graphic: " + Convert.ToString(graphic));
i = i + 1;
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- A number previously read into retained remains available after the list is cleared. The list already contains 0 entries.
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.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var retained = UO.GListGet("bandage");
UO.GListClear();
UO.Print("Retained graphic: " + Convert.ToString(retained));
UO.Print("Remaining entries: " + Convert.ToString(UO.GListSize()));
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:
Internal implementation code; this is not a standalone script.
public void GListClear() => globalList.Clear();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GListGet(object? nameValue);Reads a value from a temporary list by rule or counter name.
-
nameValue— object? is converted to a string. Names are compared case-insensitively: "bandage" and "BANDAGE" are one key. A non-empty string name is recommended; an empty name is also acceptable.
object? — saved value with the same type. If there is no key, int 0. A stored 0 is indistinguishable from a missing one GListGet; check the names.
- The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
- The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
- Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.
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.
UO.GListSet("simple_value", 42);
object? result = UO.GListGet("simple_value");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- BANDAGE finds the bandage key. 0x0E21 — graphic of the bandage, not its unique serial.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var graphic = UO.GListGet("BANDAGE");
if (Truth(graphic == 0x0E21))
{
UO.Print("Bandage rule selected");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The complete function HasEntry iterates through names; so 0 in processed is different from missing. For own keys, ASCII-names are used here.
return RunScenario();
object? RunScenario()
{
UO.GListClear();
UO.GListSet("processed", 0);
if (Truth(HasEntry("processed")))
{
var count = UO.GListGet("processed");
UO.Print("Recorded count: " + Convert.ToString(count));
}
if (!(Truth(HasEntry("missing"))))
{
UO.Print("No entry named missing");
}
return null;
}
dynamic HasEntry(dynamic name)
{
var i = 0;
while (Truth(i < UO.GListSize()))
{
if (Truth(Convert.ToString(UO.GListPosName(i)) == Convert.ToString(name)))
{
return true;
}
i = i + 1;
}
return false;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- delay — number of milliseconds; UO.Wait is called only for a value in the range 50–5000. The example waits for 350 ms.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
UO.GListClear();
UO.GListSet("delay", 350);
var delayMs = UO.GListGet("delay");
if (Truth(delayMs >= 50) && Truth(delayMs <= 5000))
{
await Delay(delayMs);
}
else
{
UO.Print("Delay outside the accepted range");
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: nameValue (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GListGet. -
InjectionScript.Runtime.InjectionValue.ToString:nameValue.ToString().
Internal implementation code; this is not a standalone script.
public InjectionValue GListGet(InjectionValue nameValue)
{
string name = nameValue.ToString();
int index = globalList.FindIndex(pair => pair.Key.Equals(name, StringComparison.OrdinalIgnoreCase));
return index >= 0 ? globalList[index].Value : InjectionValue.Zero;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GListPosName(object? index);Reads the record name by its position to enumerate the rules.
-
index- int: index from 0 to GListSize()-1 inclusive. It's not serial, graphic, or the number of units in a stack.
string is the name in the last recorded form of the register. Invalid index returns ""; an empty key also returns "".
- The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
- The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
- Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.
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.
UO.GListClear();
UO.GListSet("simple_value", 42);
var result = UO.GListPosName(0);
UO.Print("GListPosName: " + Convert.ToString(result));Parameters and execution flow:
- The index 0 means the first rule. Before reading, it is checked that the list is not empty.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
if (Truth(UO.GListSize() > 0))
{
var first = UO.GListPosName(0);
UO.Print("First rule: " + first);
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- HasEntry returns true for a null counter written and false for a missing name.
return RunScenario();
object? RunScenario()
{
UO.GListClear();
UO.GListSet("processed", 0);
if (Truth(HasEntry("processed")))
{
var count = UO.GListGet("processed");
UO.Print("Recorded count: " + Convert.ToString(count));
}
if (!(Truth(HasEntry("missing"))))
{
UO.Print("No entry named missing");
}
return null;
}
dynamic HasEntry(dynamic name)
{
var i = 0;
while (Truth(i < UO.GListSize()))
{
if (Truth(Convert.ToString(UO.GListPosName(i)) == Convert.ToString(name)))
{
return true;
}
i = i + 1;
}
return false;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Repeating BANDAGE changes the spelling of the name in the first position; gold remains second.
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.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
UO.GListSet("BANDAGE", 0x0E21);
var i = 0;
while (Truth(i < UO.GListSize()))
{
var name = UO.GListPosName(i);
var graphic = UO.GListPosValue(i);
UO.Print(name + " | graphic: " + Convert.ToString(graphic));
i = i + 1;
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: string / String.
During a call:
Internal implementation code; this is not a standalone script.
public string GListPosName(int index) => index >= 0 && index < globalList.Count ? globalList[index].Key : string.Empty;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GListPosValue(object? index);Reads the value of an entry by position, for example graphic, from a pre-populated list.
-
index- int: index from 0 to GListSize()-1 inclusive. It's not serial, graphic, or the number of units in a stack.
object? — value with preserved type; invalid index returns int 0. Check the boundaries, as true 0 is acceptable.
- The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
- The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
- Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.
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.
UO.GListClear();
UO.GListSet("simple_value", 42);
object? result = UO.GListPosValue(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Index 1 selects the second rule gold. Bounds checking precedes reading the value.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var index = 1;
if (Truth(index >= 0) && Truth(index < UO.GListSize()))
{
var graphic = UO.GListPosValue(index);
UO.Print("Second rule graphic: " + Convert.ToString(graphic));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The search looks for a graphic bandage in the rules, not an object in the world; no game requests are sent.
return RunScenario();
object? RunScenario()
{
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var total = UO.GListSize();
var i = 0;
while (Truth(i < total))
{
var graphic = UO.GListPosValue(i);
if (Truth(graphic == 0x0E21))
{
UO.Print("Bandage rule at index " + Convert.ToString(i));
}
i = i + 1;
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The index 0 exists, so the value 0 is a valid counter; checking the value for non-null would be an error here.
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.GListClear();
UO.GListSet("processed", 0);
var index = 0;
if (Truth(index < UO.GListSize()))
{
var count = UO.GListPosValue(index);
UO.Print("Valid zero count: " + Convert.ToString(count));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: index (Integer)
Result: dynamic / Any.
During a call:
Internal implementation code; this is not a standalone script.
public InjectionValue GListPosValue(int index) => index >= 0 && index < globalList.Count ? globalList[index].Value : InjectionValue.Zero;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GListSet(object? nameValue, object? value);Writes a named value to a temporary list: for example, graphic loot rules or a counter for processed items.
-
nameValue— object? is converted to a string. Names are compared case-insensitively: "bandage" and "BANDAGE" are one key. A non-empty string name is recommended; an empty name is also acceptable.
void - no result; a separate command, without assignment.
- The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
- The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
- Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.
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.GListSet");
UO.GListSet("gold", 0x0EED);Parameters and execution flow:
- bandage and gold are the names of the rules, numbers are graphic. BANDAGE replaces the first entry, does not create a third; the output shows the order.
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
UO.GListSet("BANDAGE", 0x0E21);
var i = 0;
while (Truth(i < UO.GListSize()))
{
var name = UO.GListPosName(i);
var graphic = UO.GListPosValue(i);
UO.Print(name + " | graphic: " + Convert.ToString(graphic));
i = i + 1;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- processed starts with 0. Three steps increment the stored counter to 3; game items do not move here.
return RunScenario();
object? RunScenario()
{
UO.GListClear();
UO.GListSet("processed", 0);
for (int i = (int)(1); i <= 3; i += (int)(1))
{
UO.GListSet("processed", UO.GListGet("processed") + 1);
}
UO.Print("Recorded count: " + Convert.ToString(UO.GListGet("processed")));
return null;
}Parameters and execution flow:
- mode — string, limit — number 2. The mode selects the branch, the number limits the processing to two steps.
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.GListClear();
UO.GListSet("mode", "inspect");
UO.GListSet("limit", 2);
if (Truth(UO.GListGet("mode") == "inspect"))
{
for (int i = (int)(1); i <= UO.GListGet("limit"); i += (int)(1))
{
UO.Print("Inspect batch: " + Convert.ToString(i));
}
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: nameValue (Any), value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GListSet. -
InjectionScript.Runtime.InjectionValue.ToString:nameValue.ToString().
Internal implementation code; this is not a standalone script.
public void GListSet(InjectionValue nameValue, InjectionValue value)
{
string name = nameValue.ToString();
int index = globalList.FindIndex(pair => pair.Key.Equals(name, StringComparison.OrdinalIgnoreCase));
var entry = new KeyValuePair<string, InjectionValue>(name, value);
if (index >= 0)
globalList[index] = entry;
else
globalList.Add(entry);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GListSize();Counts named entries in a temporary list to check for emptiness or limit brute force.
There are no parameters.
int >= 0 — the number of unique names, not the number of items or units in the stacks.
- The list belongs to the runtime instance. Other script runs have their own lists. GList is not shared cross-profile storage; these commands do not write a file and do not enter a saved profile state. The new runtime gets an empty list. It is also not var/variable declaration and not UO.SetGlobal.
- The new name is added to the end. Repeating a case-insensitive name replaces the meaning and spelling of the name in its original place. Reading does not delete anything. You cannot clear or add records in the middle of a search if you need stable indexes.
- Operations are local: no packets, no object searches, no latency. Set/Get search for the name sequentially; for larger sets use Dictionary. There is no separate command for deleting one key in this family; Clear clears all entries.
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.GListSize();
UO.Print("GListSize: " + Convert.ToString(result));Parameters and execution flow:
- An empty set stops the procedure before the rules are processed.
UO.GListClear();
if (Truth(UO.GListSize() == 0))
{
UO.Print("No batch rules; stop here");
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The two rules are iterated over the indices 0 and 1; the condition i < Size does not allow access to the index 2.
return RunScenario();
object? RunScenario()
{
UO.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var i = 0;
while (Truth(i < UO.GListSize()))
{
var name = UO.GListPosName(i);
var graphic = UO.GListPosValue(i);
UO.Print(name + " | graphic: " + Convert.ToString(graphic));
i = i + 1;
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Substitution BANDAGE does not increase the number of names; before and after Size is 2.
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.GListClear();
UO.GListSet("bandage", 0x0E21);
UO.GListSet("gold", 0x0EED);
var before = UO.GListSize();
UO.GListSet("BANDAGE", 0x0E21);
if (Truth(UO.GListSize() == before))
{
UO.Print("Existing rule updated without an extra entry");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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: int / Integer.
During a call:
Internal implementation code; this is not a standalone script.
public int GListSize() => globalList.Count;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetEasyUO(object? number);Reads a string from the user's Windows registry EasyUO.
-
numberis the int/value to be converted by NumberConversions.ToInt. Forms the decimal name registry value.
string — value HKCU\Software\EasyUO<number>; if it is not present, the name * is checked. If the key/value is missing or outside of Windows, an empty string is returned.
- Reading does not create a key or access the game world. The legacy registry interface is different from GetGlobal. System registry access error may spread; there is no separate catch in bridge.
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.GetEasyUO(1);
UO.Print("GetEasyUO: " + Convert.ToString(result));Parameters and execution flow:
- The name is read first 1, then *1.
var value = UO.GetEasyUO(1);
UO.Print(value);Parameters and execution flow:
- An empty string can be no value or stored empty text.
return RunScenario();
object? RunScenario()
{
var value = UO.GetEasyUO(999);
if (Truth(Len(value) == 0))
{
UO.Print("empty");
}
return null;
}
int Len(object? value) => Convert.ToString(value)?.Length ?? 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- The number determines the registry value, not the serial of the 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 = 2;
var value = UO.GetEasyUO(number);
UO.Print(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: number (Any)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetEasyUO. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetEasyUO:bridge.GetEasyUO(NumberConversions.ToInt(number)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(number).
Internal implementation code; this is not a standalone script.
public string GetEasyUO(InjectionValue number) => bridge.GetEasyUO(NumberConversions.ToInt(number));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetGlobal(object? name);
dynamic UO.GetGlobal(object? globalRegion, object? varName);-
name— Name in short form. Case is important: "Loot" and "loot" are different keys. This is not a file path. -
globalRegion- GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names. -
varName- GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names.
Always string: GetGlobal(name) returns the stored string or "N/A" if the key is missing. GetGlobal(GlobalRegion, VarName) actually returns a string or "" if absent, although registered as object?. This is not bool or an automatically recovered number.
- The short form and the region form are two independent stores in the current runtime state. SetGlobal("x", value) does not write to GetGlobal(0, "x"). The snapshot includes both stores, but the call itself does not save the file: writing to disk is done by the profile saving mechanism. The other profile does not automatically receive these values. Global var/variable declaration and GList are separate mechanisms.
- The retained "N/A" (short form) and "" (regional form) are indistinguishable from the absence of one GetGlobal. For settings, select valid values other than the absence marker, or create a separate presence key. Check the string first, then convert the number.
- UO.GetGlobal · UO.SetGlobal · UO.GListGet
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.GetGlobal("manual.delay");
UO.Print("GetGlobal: " + Convert.ToString(result));Parameters and execution flow:
- Delay: manual.delay - name; 350/600 - milliseconds. GetGlobal reads the line, IsNumeric checks it before Val. UO.Wait pauses only this script. The example does not change the network speed.
var text = UO.GetGlobal("manual.delay");
var delayMs = 350;
if (Truth(text != "N/A") && Truth(IsNumeric(text)))
{
var parsed = Val(text);
if (Truth(parsed >= 50) && Truth(parsed <= 5000))
{
delayMs = checked((int)parsed);
}
}
await Delay(delayMs);
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;Parameters and execution flow:
- Mode: manual and gather - different area labels; mode - key. Reading MANUAL/MODE finds manual/mode. Only hide mode triggers the Hiding skill; SetGlobal itself does nothing in the game.
return RunScenario();
object? RunScenario()
{
UO.SetGlobal("manual", "mode", "hide");
UO.SetGlobal("gather", "mode", "idle");
var mode = UO.GetGlobal("MANUAL", "MODE");
if (Truth(mode == "hide"))
{
UO.UseSkill("Hiding");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ReadDelay(name, fallback) is shown in full: returns spare 350 ms for missing, non-numeric, or outside the range 50–5000 setting. The cycle is limited to three waiting attempts, not infinite.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
for (int attempt = (int)(1); attempt <= 3; attempt += (int)(1))
{
await Delay(ReadDelay("manual.delay", 350));
}
return null;
}
dynamic ReadDelay(dynamic name, dynamic fallback)
{
var text = UO.GetGlobal(name);
if (Truth(text == "N/A"))
{
return fallback;
}
if (!(Truth(IsNumeric(text))))
{
return fallback;
}
var value = Val(text);
if (Truth(value < 50) || Truth(value > 5000))
{
return fallback;
}
return value;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: name (String)
Result: string / String.
During a call:
Internal implementation code; this is not a standalone script.
public string GetGlobal(string name)
{
lock (globalsLock)
return globals.TryGetValue(name, out var value) ? value : "N/A";
}Parameters: globalRegion (Any), varName (Any)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "getglobal":
return new InjectionValue(state.GlobalVariables.TryGetValue(Text(0) + "\u001F" + Text(1), out string globalValue)
? globalValue : string.Empty);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.GetProfile(object? serial);Reads the public character description that the server sends for the Profile window. Useful for reading notes or searching for text in the description of the selected character. These are not manager profile settings.
-
serial— Character Serial: a number, a string with ID 0x... or an object selector such as "self" or "lasttarget". This is not a body type, a file name, or a manager profile.
string — text of the main description, without title and signature. Empty description is legal; an empty result is also possible if there is no response in 3 seconds. It's not true/false. A request is sent on every call; if the description is already saved in the session, it is returned immediately, including a draft of the open window. This is not a guarantee of a fresh server response.
- The description and its draft belong to the session. Closing the game window saves them without publishing them, opening them restores the Profile window. Explicitly closing your own Profile sends the modified text once; someone else's text is not sent. The new server response replaces the old data, disconnecting the connection clears it. GetProfile does not edit anything itself.
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.GetProfile("self");
UO.Print("GetProfile: " + Convert.ToString(result));Parameters and execution flow:
- "self" - description of your character; not account configuration. The text received from the server or already saved in the session is displayed.
var note = UO.GetProfile("self");
if (Truth(note != ""))
{
UO.Print(note);
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Requires an existing lasttarget. FindText searches for the case-sensitive word "Healer" in free text. If there is a match, AddObject saves the selected serial under the name healerNote. This is a user note, not proof of profession NPC.
return RunScenario();
object? RunScenario()
{
if (!(Truth(UO.Exists("lasttarget"))))
{
return null;
}
var note = UO.GetProfile("lasttarget");
if (Truth(FindText(note, "Healer") > 0))
{
UO.AddObject("healerNote", "lasttarget");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
int FindText(object? text, object? value) => (Convert.ToString(text) ?? "").IndexOf(Convert.ToString(value) ?? "", StringComparison.Ordinal) + 1;
int FindText(int start, object? text, object? value)
{
string input = Convert.ToString(text) ?? "";
return input.IndexOf(Convert.ToString(value) ?? "", Math.Clamp(start - 1, 0, input.Length), StringComparison.Ordinal) + 1;
}Parameters and execution flow:
- The entire function HasPublicNote is given below. Checks the existence of an object and a substring, returns true/false. "Guild" - demo text; an empty response does not confirm the absence of such a record on the server.
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()
{
if (Truth(HasPublicNote("lasttarget", "Guild")))
{
UO.AddObject("guildNote", "lasttarget");
}
return null;
}
dynamic HasPublicNote(dynamic serial, dynamic phrase)
{
if (!(Truth(UO.Exists(serial))))
{
return false;
}
return FindText(UO.GetProfile(serial), phrase) > 0;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
int FindText(object? text, object? value) => (Convert.ToString(text) ?? "").IndexOf(Convert.ToString(value) ?? "", StringComparison.Ordinal) + 1;
int FindText(int start, object? text, object? value)
{
string input = Convert.ToString(text) ?? "";
return input.IndexOf(Convert.ToString(value) ?? "", Math.Clamp(start - 1, 0, input.Length), StringComparison.Ordinal) + 1;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: serial (Any)
Result: string / String.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetProfile. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetProfile:bridge.GetProfile(GetObject(serial)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(serial).
Internal implementation code; this is not a standalone script.
public string GetProfile(InjectionValue serial) => bridge.GetProfile(GetObject(serial));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.LoadHotkeys();Loads saved macros and hotkeys.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- LoadHotkeys calls _world.Macros.Load via Invoke. The current macro table is replaced with local profile data.
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.LoadHotkeys");
UO.LoadHotkeys();Parameters and execution flow:
- Loads saved macros and hotkeys.
UO.LoadHotkeys();Parameters and execution flow:
- LoadHotkeys calls _world.Macros.Load via Invoke. The current macro table is replaced with local profile data.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ProfileName());
UO.LoadHotkeys();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.LoadHotkeys();
UO.Print("Macros loaded");
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. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.LoadHotkeys:bridge.LoadHotkeys().
Internal implementation code; this is not a standalone script.
case "loadhotkeys": bridge.LoadHotkeys(); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ProfileName();Reads the name of the current profile.
There are no parameters.
string — text of the bridge field.ProfileName; without available data, an empty string is possible. This is not a connection sign and is not a numeric ID.
- ExecuteClientApiCompatibility returns bridge.ProfileName without changing the profile or server selection.
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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.ProfileName();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Reads the name of the current profile.
var value = UO.ProfileName();
UO.Print(value);Parameters and execution flow:
- ExecuteClientApiCompatibility returns bridge.ProfileName without changing the profile or server selection.
return RunScenario();
object? RunScenario()
{
var value = UO.ProfileName();
if (Truth(Len(value) > 0))
{
UO.TextPrint(value);
}
return null;
}
int Len(object? value) => Convert.ToString(value)?.Length ?? 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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 before = UO.ProfileName();
UO.Wait(500);
var after = UO.ProfileName();
UO.Print(before = after);
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: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ProfileName:bridge.ProfileName.
Internal implementation code; this is not a standalone script.
case "profilename": return new InjectionValue(bridge.ProfileName);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.ProfileShardName();Reads the shard name.
There are no parameters.
string — text of the bridge field.ShardName; without available data, an empty string is possible. This is not a connection sign and is not a numeric ID.
- ExecuteClientApiCompatibility returns bridge.ShardName without changing the profile or server selection.
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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.ProfileShardName();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Reads the shard name.
var value = UO.ProfileShardName();
UO.Print(value);Parameters and execution flow:
- ExecuteClientApiCompatibility returns bridge.ShardName without changing the profile or server selection.
return RunScenario();
object? RunScenario()
{
var value = UO.ProfileShardName();
if (Truth(Len(value) > 0))
{
UO.TextPrint(value);
}
return null;
}
int Len(object? value) => Convert.ToString(value)?.Length ?? 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- Reads the current local state. There is no package, target or automatic update; individual reads may see different states.
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 before = UO.ProfileShardName();
UO.Wait(500);
var after = UO.ProfileShardName();
UO.Print(before = after);
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: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ShardName:bridge.ShardName.
Internal implementation code; this is not a standalone script.
case "shardname":
case "profileshardname": return new InjectionValue(bridge.ShardName);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ReqProfile();
void UO.ReqProfile(object? mobile);Prints the character's known profile text.
-
mobile— Optional serial/alias. Without argument - "lasttarget". This is not a local ClassicUO settings profile.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls GetProfile, then SystemMessage. Bridge.GetProfile sends RequestProfile, then up to 3 seconds checks CharacterPanels.Profile.CurrentText with pauses 25 ms. Already existing text can be returned immediately; with timeout it displays a message and gives an empty line. This command prints the text but does not return it.
- For string value use UO.GetProfile. The presence of text is not proof of successful renaming or character status.
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.ReqProfile");
UO.ReqProfile();Parameters and execution flow:
- Prints the character's known profile text.
UO.ReqProfile();Parameters and execution flow:
- ExecuteLegacyManualAlias calls GetProfile, then SystemMessage. Bridge.GetProfile sends RequestProfile, then up to 3 seconds checks CharacterPanels.Profile.CurrentText with pauses 25 ms. Already existing text can be returned immediately; with timeout it displays a message and gives an empty line. This command prints the text but does not return it.
return RunScenario();
object? RunScenario()
{
UO.ReqProfile("self");
return null;
}Parameters and execution flow:
- For string value use UO.GetProfile. The presence of text is not proof of successful renaming or character status.
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 id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
UO.ReqProfile(id);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}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(GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget"))). -
InjectionScript.Runtime.InjectionApiUO.GetProfile:GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget")).
Internal implementation code; this is not a standalone script.
case "reqprofile":
SystemMessage(GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget")));
break;Parameters: mobile (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage(GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget"))). -
InjectionScript.Runtime.InjectionApiUO.GetProfile:GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget")).
Internal implementation code; this is not a standalone script.
case "reqprofile":
SystemMessage(GetProfile(arguments.Length > 0 ? arguments[0] : new InjectionValue("lasttarget")));
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ResetProfile();Resets the active profile to default values.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ResetProfile calls ProfileManager.ResetCurrentProfileToDefault; if there is no active profile, an error is displayed. Changes local settings, so saved user values may be lost.
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.ResetProfile");
UO.ResetProfile();Parameters and execution flow:
- Resets the active profile to default values.
UO.ResetProfile();Parameters and execution flow:
- ResetProfile calls ProfileManager.ResetCurrentProfileToDefault; if there is no active profile, an error is displayed. Changes local settings, so saved user values may be lost.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ProfileName());
UO.ResetProfile();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.ResetProfile();
UO.SaveConfig();
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. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ResetProfile:bridge.ResetProfile().
Internal implementation code; this is not a standalone script.
case "resetprofile": bridge.ResetProfile(); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SaveConfig();Saves the current ClassicUO profile.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- SaveConfig calls ProfileManager.SaveCurrentProfile via Invoke. The command writes the local profile settings; the path is taken from ProfileManager.
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.SaveConfig");
UO.SaveConfig();Parameters and execution flow:
- Saves the current ClassicUO profile.
UO.SaveConfig();Parameters and execution flow:
- SaveConfig calls ProfileManager.SaveCurrentProfile via Invoke. The command writes the local profile settings; the path is taken from ProfileManager.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ProfileName());
UO.SaveConfig();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.SaveConfig();
UO.Print(UO.ShardPath());
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.SaveConfig. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SaveConfig:bridge.SaveConfig().
Internal implementation code; this is not a standalone script.
public void SaveConfig() => bridge.SaveConfig();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SaveHotkeys();Saves macros and hotkeys.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- SaveHotkeys calls _world.Macros.Save via Invoke. The local macro table of the current profile is saved.
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.SaveHotkeys");
UO.SaveHotkeys();Parameters and execution flow:
- Saves macros and hotkeys.
UO.SaveHotkeys();Parameters and execution flow:
- SaveHotkeys calls _world.Macros.Save via Invoke. The local macro table of the current profile is saved.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.ProfileName());
UO.SaveHotkeys();
return null;
}Parameters and execution flow:
- Modifies or displays only the specified local data. This command does not have server confirmation.
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.SaveHotkeys();
UO.LoadHotkeys();
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. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SaveHotkeys:bridge.SaveHotkeys().
Internal implementation code; this is not a standalone script.
case "savehotkeys": bridge.SaveHotkeys(); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Set(object? name, object? value);Changes one of three legacy settings.
-
name— Case insensitive string: "finddistance", "grabdelay" or "equipfordress". The unknown name is silently ignored. -
value— int or double/0x-text. For the string form TryStr2Int; incorrect text becomes 0, not an error.
void - no value. Call on a separate line; completion does not confirm the server's action.
- finddistance calls bridge.SetFindDistance, grabdelay calls bridge.SetGrabDelay, equipfordress assigns state.UseEquipForDress. These are three separate settings; There is no universal setter for arbitrary properties.
- The string value is first converted TryStr2Int with fallback=0. Therefore, a typo may write 0 into the recognized setting. Set itself does not look for objects and does not change clothes.
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.Set");
UO.Set("finddistance", 10);Parameters and execution flow:
- Changes one of three legacy settings.
UO.Set("finddistance", 10);Parameters and execution flow:
- finddistance calls bridge.SetFindDistance, grabdelay calls bridge.SetGrabDelay, equipfordress assigns state.UseEquipForDress. These are three separate settings; There is no universal setter for arbitrary properties.
return RunScenario();
object? RunScenario()
{
UO.Set("grabdelay", "250");
return null;
}Parameters and execution flow:
- The string value is first converted TryStr2Int with fallback=0. Therefore, a typo may write 0 into the recognized setting. Set itself does not look for objects and does not change clothes.
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.Set("equipfordress", 1);
UO.Print(UO.FindDistance());
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: name (String), value (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Set. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetFindDistance:bridge.SetFindDistance(value). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGrabDelay:bridge.SetGrabDelay(value).
Internal implementation code; this is not a standalone script.
public void Set(string name, int value)
{
if (name.Equals("finddistance", StringComparison.OrdinalIgnoreCase))
{
bridge.SetFindDistance(value);
}
else if (name.Equals("grabdelay", StringComparison.OrdinalIgnoreCase))
{
bridge.SetGrabDelay(value);
}
else if (name.Equals("equipfordress", StringComparison.OrdinalIgnoreCase))
{
state.UseEquipForDress = value;
}
}Parameters: name (String), value (Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Set. -
InjectionScript.Runtime.NumberConversions.TryStr2Int:NumberConversions.TryStr2Int(valueStr, out var value). -
InjectionScript.Runtime.InjectionApiUO.Set:Set(name, valueInt).
Internal implementation code; this is not a standalone script.
public void Set(string name, string valueStr)
{
int valueInt = NumberConversions.TryStr2Int(valueStr, out var value) ? value : 0;
Set(name, valueInt);
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetDefault(object? name, object? @object);Saves the named alias serial in the runtime state.
-
name— Name alias as text, case handles Objects dictionary. -
object— Serial/alias via Arg/GetObject. Name and serial come in that order.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias calls state.Objects.Set(Text(0),Arg(1)). There is no interactive choice; the existence of serial is not checked.
- This is recording the object name, not resetting the profile or changing all settings to defaults. On subsequent calls, the alias is resolved again.
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded 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 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.SetDefault");
UO.SetDefault("manualObject", UO.Self());Parameters and execution flow:
- Saves the named alias serial in the runtime state.
UO.SetDefault("manualObject", UO.Self());Parameters and execution flow:
- ExecuteLegacyManualAlias calls state.Objects.Set(Text(0),Arg(1)). There is no interactive choice; the existence of serial is not checked.
return RunScenario();
object? RunScenario()
{
UO.SetDefault("manualBag", UO.Backpack());
UO.Print(UO.GetSerial("manualBag"));
return null;
}Parameters and execution flow:
- This is recording the object name, not resetting the profile or changing all settings to defaults. On subsequent calls, the alias is resolved again.
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 id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
UO.SetDefault("manualTarget", id);
UO.Print(UO.GetName("manualTarget"));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: name (Any), object (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.State.RuntimeDictionary.Set:state.Objects.Set(Text(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(1).
Internal implementation code; this is not a standalone script.
case "setdefault":
if (arguments.Length > 1) state.Objects.Set(Text(0), Arg(1));
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetEasyUO(object? number, object? value);Writes a string value to the Windows registry EasyUO.
-
number— int value number, formatted double without *-prefix. -
value— Text through ToString; saved as transmitted.
void - no value. Call on a separate line; completion does not confirm the server's action.
- On Windows, opens/creates HKCU\Software\EasyUO with write permission, SetValue(decimalNumber,value,RegistryValueKind.string). On other OSes it displays a message and does not record it.
- This is an external permanent entry in the registry of the current user, not scoped global runtime and not game serial. Registry access errors are not hidden by this function.
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.SetEasyUO");
UO.SetEasyUO(9001, "manual-example");Parameters and execution flow:
- Writes a string value to the Windows registry EasyUO.
UO.SetEasyUO(9001, "manual-example");Parameters and execution flow:
- On Windows, opens/creates HKCU\Software\EasyUO with write permission, SetValue(decimalNumber,value,RegistryValueKind.String). On other OSes it displays a message and does not record it.
return RunScenario();
object? RunScenario()
{
UO.SetEasyUO(9001, "");
return null;
}Parameters and execution flow:
- This is an external permanent entry in the registry of the current user, not scoped global runtime and not game serial. Registry access errors are not hidden by this function.
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.SetEasyUO(9001, "manual-example");
UO.Print(UO.GetEasyUO(9001));
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: number (Any), value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetEasyUO. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetEasyUO:bridge.SetEasyUO(NumberConversions.ToInt(number), value.ToString()). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(number). -
InjectionScript.Runtime.InjectionValue.ToString:value.ToString().
Internal implementation code; this is not a standalone script.
public void SetEasyUO(InjectionValue number, InjectionValue value)
=> bridge.SetEasyUO(NumberConversions.ToInt(number), value.ToString());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetGlobal(object? name, object? value);
void UO.SetGlobal(object? globalRegion, object? varName, object? varValue);Writes a named script setting for later reading via UO.GetGlobal. A repeated entry replaces the value of the same key.
-
name— Name in short form. Case is important: "Loot" and "loot" are different keys. This is not a file path. -
globalRegion- GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names. -
varName- GlobalRegion - custom area label, VarName - name inside it; both are converted to strings. In this form, the case of both parts is not important. The labels 0 and 1 are valid, but do NOT enable cross-profile sharing and do NOT select server storage. Do not use the U+001F control delimiter in these names.
void - no return value. Call as a separate line, without assigning the result and comparing with true.
- The short form and the region form are two independent stores in the current runtime state. SetGlobal("x", value) does not write to GetGlobal(0, "x"). The snapshot includes both stores, but the call itself does not save the file: writing to disk is done by the profile saving mechanism. The other profile does not automatically receive these values. Global var/variable declaration and GList are separate mechanisms.
- The retained "N/A" (short form) and "" (regional form) are indistinguishable from the absence of one GetGlobal. For settings, select valid values other than the absence marker, or create a separate presence key. Check the string first, then convert the number.
- UO.GetGlobal · UO.SetGlobal · UO.GListGet
- In a regular client host, this state data is taken from the GetPersistentState manager and is common to scripts/chat/macros of the same world/profile, and does not belong to one script. Another process or an apparently separate InjectionRuntimeState has a different state. Loading/clearing a profile can replace it; saved serial are still checked against the loaded 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 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.SetGlobal");
UO.SetGlobal("manual.delay", 350);Parameters and execution flow:
- Delay: manual.delay - name; 350/600 - milliseconds. GetGlobal reads the line, IsNumeric checks it before Val. UO.Wait pauses only this script. The example does not change the network speed.
UO.SetGlobal("manual.delay", 350);
UO.SetGlobal("manual.delay", 600);
var text = UO.GetGlobal("manual.delay");
if (Truth(IsNumeric(text)))
{
await Delay(Val(text));
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;Parameters and execution flow:
- Mode: manual and gather - different area labels; mode - key. Reading MANUAL/MODE finds manual/mode. Only hide mode triggers the Hiding skill; SetGlobal itself does nothing in the game.
return RunScenario();
object? RunScenario()
{
UO.SetGlobal("manual", "mode", "idle");
UO.SetGlobal("gather", "mode", "hide");
UO.SetGlobal("MANUAL", "MODE", "hide");
if (Truth(UO.GetGlobal("manual", "mode") == "hide"))
{
UO.UseSkill("Hiding");
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters and execution flow:
- ReadDelay(name, fallback) is shown in full: returns spare 350 ms for missing, non-numeric, or outside the range 50–5000 setting. The cycle is limited to three waiting attempts, not infinite.
return await new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenarioAsync();
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;
}
async public Task<object?> RunScenarioAsync()
{
UO.SetGlobal("manual.delay", "invalid");
for (int attempt = (int)(1); attempt <= 3; attempt += (int)(1))
{
await Delay(ReadDelay("manual.delay", 350));
}
return null;
}
dynamic ReadDelay(dynamic name, dynamic fallback)
{
var text = UO.GetGlobal(name);
if (Truth(text == "N/A"))
{
return fallback;
}
if (!(Truth(IsNumeric(text))))
{
return fallback;
}
var value = Val(text);
if (Truth(value < 50) || Truth(value > 5000))
{
return fallback;
}
return value;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
bool IsNumeric(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _);
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
double Val(object? value) => double.TryParse(Convert.ToString(value), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var number) ? number : 0;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: name (String), value (Decimal/Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.State.Globals.SetGlobal. -
InjectionScript.Runtime.State.Globals.SetGlobal:SetGlobal(name, value.ToString()).
Internal implementation code; this is not a standalone script.
public void SetGlobal(string name, double value) => SetGlobal(name, value.ToString());Parameters: name (String), value (Decimal/Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.State.Globals.SetGlobal. -
InjectionScript.Runtime.State.Globals.SetGlobal:SetGlobal(name, value.ToString()).
Internal implementation code; this is not a standalone script.
public void SetGlobal(string name, int value) => SetGlobal(name, value.ToString());Parameters: name (String), value (Decimal/Integer/String)
Result: void / Unit.
During a call:
Internal implementation code; this is not a standalone script.
public void SetGlobal(string name, string value)
{
lock (globalsLock)
globals[name] = value;
}Parameters: globalRegion (Any), varName (Any), varValue (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "setglobal":
state.GlobalVariables[Text(0) + "\u001F" + Text(1)] = Text(2);
return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetMulPath(object? pathValue);Saves the path string mulPath at runtime.
-
pathValue— Text through ToString; saved as transmitted.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Assigns mulPath = ToString or the empty string. The file does not open, map data is not reloaded, and path availability is not checked by this function.
- This is the compatibility storage of the current runtime. There are no consumers in the project private mulPath/showZ; the change does not reload assets or change the height display.
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.SetMulPath");
UO.SetMulPath("C:\\Ultima Online");Parameters and execution flow:
- Saves the path string mulPath at runtime.
UO.SetMulPath("C:\\Ultima Online");Parameters and execution flow:
- Assigns mulPath = ToString or the empty string. The file does not open, map data is not reloaded, and path availability is not checked by this function.
return RunScenario();
object? RunScenario()
{
UO.SetMulPath("");
return null;
}Parameters and execution flow:
- This is the compatibility storage of the current runtime. There are no consumers in the project private mulPath/showZ; the change does not reload assets or change the height display.
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()
{
ApplyValue("C:\\Ultima Online");
return null;
}
void ApplyValue(dynamic value)
{
UO.SetMulPath(value);
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: pathValue (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetMulPath. -
InjectionScript.Runtime.InjectionValue.ToString:pathValue.ToString().
Internal implementation code; this is not a standalone script.
public void SetMulPath(InjectionValue pathValue) => mulPath = pathValue.ToString() ?? string.Empty;ClassicUO — Bad Newbie & C# Scripts IDE