Repository navigation
EN API UO ProfileName
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
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);ClassicUO — Bad Newbie & C# Scripts IDE