Repository navigation
EN UO Topic speech chat
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Character speech, emotions, chat channels and filters. Local message printing in the client is located in Client UI.
| Topic | Commands and explanations |
|---|---|
| Say | UO.Say |
| SayU | UO.SayU |
| UOSay | UO.UOSay |
| Emote | UO.EmoteAction · UO.Bow · UO.Salute |
| Speech Filters | UO.FilterSpeech |
| Global Chat | UO.GlobalChatSendMsg · UO.GlobalChatActiveChannel |
| Channels | UO.GlobalChatChannelsList · UO.GlobalChatJoinChannel · UO.GlobalChatLeaveChannel |
| Ignore Users | UO.AddChatUserIgnore · UO.ClearChatUserIgnore |
UO.Say · UO.SayU · UO.UOSay · UO.UOSayColor · UO.Msg · UO.UOAMessage · UO.FixTalk
UO.Bow · UO.Salute · UO.EmoteAction
UO.FilterSpeech · UO.AddChatUserIgnore · UO.ClearChatUserIgnore · UO.GlobalChatActiveChannel · UO.GlobalChatChannelsList · UO.GlobalChatJoinChannel · UO.GlobalChatLeaveChannel · UO.GlobalChatSendMsg
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
if (Truth(UO.Connected()))
{
UO.Say("bank");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parameters, result and all scenarios
UO.GlobalChatSendMsg("Hello");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.AddChatUserIgnore(object? userName);Adds the sender's name to the local log message filtering list. The filter operates on this client and does not send a request to the server.
-
userNameis the name of the log sender. A value that is empty or contains spaces is ignored; edge spaces are removed.
void. The command does not return a successful addition.
- The sender name comparison is not case sensitive. Messages from a matched name are hidden by a local log filter; This is not blocking a player on the server.
UO.ClearChatUserIgnore()clears the entire local list of names. Clearing the filter does not restore records that have already been excluded from 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.AddChatUserIgnore");
UO.AddChatUserIgnore("ExampleVendor");Parameters and execution flow:
- Hide new log entries under this name in the current tenant.
UO.AddChatUserIgnore("ExampleVendor");Parameters and execution flow:
- Pass the name via a string variable.
return RunScenario();
object? RunScenario()
{
var sender = "ExampleVendor";
UO.AddChatUserIgnore(sender);
return null;
}Parameters and execution flow:
- Add two names to the local filter; the call does not block them 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()
{
UO.AddChatUserIgnore("ExampleVendor");
UO.AddChatUserIgnore("ExamplePlayer");
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: userName (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.AddChatUserIgnore:bridge.AddChatUserIgnore(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "addchatuserignore": bridge.AddChatUserIgnore(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Bow();Sends the bow character's action via GameActions.EmoteAction.
There are no parameters.
void - no return value.
- This is the character's animation/action. The command does not return a server confirmation and does not wait for the animation to finish.
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.Bow");
UO.Bow();Parameters and execution flow:
- Send one bow.
UO.Bow();Parameters and execution flow:
- Checking the connection precedes sending the action.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Connected()))
{
UO.Bow();
}
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 fully declared procedure dispatches the same action.
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()
{
Greet();
return null;
}
void Greet()
{
UO.Bow();
}
}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.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Bow:bridge.Bow().
Internal implementation code; this is not a standalone script.
case "bow": bridge.Bow(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearChatUserIgnore();Removes all case-insensitive sender name filters JournalManager.
There are no parameters.
void - no return value.
- Removing filters does not delete history entries or cancel AddJournalIgnore text filters.
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.ClearChatUserIgnore");
UO.ClearChatUserIgnore();Parameters and execution flow:
- Removes all case-insensitive sender name filters JournalManager.
UO.ClearChatUserIgnore();Parameters and execution flow:
- Re-enable display of messages on behalf of Vendor.
return RunScenario();
object? RunScenario()
{
UO.AddChatUserIgnore("Vendor");
UO.ClearChatUserIgnore();
return null;
}Parameters and execution flow:
- Clearing an empty set is acceptable and does not create a new setting.
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.ClearChatUserIgnore();
UO.ClearChatUserIgnore();
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.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ClearChatUserIgnore:bridge.ClearChatUserIgnore().
Internal implementation code; this is not a standalone script.
case "clearchatuserignore": bridge.ClearChatUserIgnore(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.EmoteAction(object? action);Sends the character action/animation string name to GameActions.EmoteAction.
-
action— Action name, such as bow or salute; is converted to string. Action recognition is performed by GameActions.
void - no return value.
- This is a character action, not printing a phrase into a journal. The command does not return a server confirmation and does not wait for animation.
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.EmoteAction");
UO.EmoteAction("bow");Parameters and execution flow:
- The action name is bow.
UO.EmoteAction("bow");Parameters and execution flow:
- The action name salute is passed.
return RunScenario();
object? RunScenario()
{
UO.EmoteAction("salute");
return null;
}Parameters and execution flow:
- The action string is passed without assigning an object target.
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 action = "bow";
UO.EmoteAction(action);
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: action (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.EmoteAction:bridge.EmoteAction(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "emoteaction": bridge.EmoteAction(Text(0)); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.FilterSpeech();
void UO.FilterSpeech(object? enabled);Enables or disables the client speech filter.
-
enabled— Optional value: without an argument, the filter is turned on; 0 turns off, non-zero int turns on.
void - no return value.
- Writes the normalized flag to the runtime state and passes it to the manager. The filter affects the client's processing; server events and other log settings remain separate.
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.FilterSpeech");
UO.FilterSpeech();Parameters and execution flow:
- A zero number of arguments means include, not read.
UO.FilterSpeech();Parameters and execution flow:
- An explicit 0 turns off the client filter.
return RunScenario();
object? RunScenario()
{
UO.FilterSpeech(0);
return null;
}Parameters and execution flow:
- The filter turns on and clearly returns to the off state.
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.FilterSpeech(1);
UO.FilterSpeech(0);
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetSpeechFilter:bridge.SetSpeechFilter(state.SpeechFilter).
Internal implementation code; this is not a standalone script.
case "filterspeech": state.SpeechFilter = arguments.Length == 0 || Arg(0) != 0 ? 1 : 0; bridge.SetSpeechFilter(state.SpeechFilter); break;Parameters: enabled (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetSpeechFilter:bridge.SetSpeechFilter(state.SpeechFilter).
Internal implementation code; this is not a standalone script.
case "filterspeech": state.SpeechFilter = arguments.Length == 0 || Arg(0) != 0 ? 1 : 0; bridge.SetSpeechFilter(state.SpeechFilter); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.FixTalk();Prints a notice that the legacy native client patch FixTalk is not required by ClassicUO.
There are no parameters.
void - no return value.
- The ExecuteLegacyManualAlias branch only calls SystemMessage. It does not correct motion, speech, containers, or network protocol.
Each example can be saved as a separate file .csx and run in IDE. The UO object and wait functions provide the host of the current game session. Replace demo serial names, coordinates and addresses with your own.
Run this code as a separate .csx file. Arguments appear directly in the call; replace demonstration names, serials and addresses with your own.
The command is a separate statement. The message before it marks the start of the call; it does not confirm a server action.
UO.Print("Calling UO.FixTalk");
UO.FixTalk();Parameters and execution flow:
- The message describes the lack of need for the old patch.
UO.FixTalk();Parameters and execution flow:
- The compatibility procedure does not change the game world.
return RunScenario();
object? RunScenario()
{
CompatibilityNotice();
return null;
}
void CompatibilityNotice()
{
UO.FixTalk();
}Parameters and execution flow:
- After the diagnostic message, execution continues.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.FixTalk();
UO.Print("continued");
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: No parameters.
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SystemMessage:SystemMessage($"{name}: obsolete native-client patch; ClassicUO does not require it.").
Internal implementation code; this is not a standalone script.
case "boxhack":
case "fixtalk":
case "fixwalk":
SystemMessage($"{name}: obsolete native-client patch; ClassicUO does not require it.");
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GlobalChatActiveChannel();Reads ChatManager.CurrentChannelName.
There are no parameters.
string - CurrentChannelName or an empty line if the channel is not selected.
- Reads ChatManager.CurrentChannelName. Empty line - no name, no error code; the channel itself is not entered.
- 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.GlobalChatActiveChannel();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Reads ChatManager.CurrentChannelName.
UO.Print(UO.GlobalChatActiveChannel());Parameters and execution flow:
- Reads ChatManager.CurrentChannelName. Empty line - no name, no error code; the channel itself is not entered.
return RunScenario();
object? RunScenario()
{
var channel = UO.GlobalChatActiveChannel();
if (Truth(Len(channel) > 0))
{
UO.Print(channel);
}
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.GlobalChatActiveChannel();
UO.Wait(500);
var after = UO.GlobalChatActiveChannel();
UO.Print(before);
UO.Print(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.GlobalChatActiveChannel:bridge.GlobalChatActiveChannel().
Internal implementation code; this is not a standalone script.
case "globalchatactivechannel": return new InjectionValue(bridge.GlobalChatActiveChannel());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GlobalChatChannelsList();Bridge returns ChatManager.Channels.Keys.OrderBy(name => name).
There are no parameters.
Array of channel name strings, sorted by name. An empty local table produces an empty array.
- Bridge returns ChatManager.Channels.Keys.OrderBy(name => name). The list is known to the client and may not be complete until the server updates.
- 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.GlobalChatChannelsList();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- Bridge returns ChatManager.Channels.Keys.OrderBy(name => name).
var channels = UO.GlobalChatChannelsList();
UO.Print(UO.GetArrayLength(channels));Parameters and execution flow:
- Bridge returns ChatManager.Channels.Keys.OrderBy(name => name). The list is known to the client and may not be complete until the server updates.
return RunScenario();
object? RunScenario()
{
var channels = UO.GlobalChatChannelsList();
if (Truth(UO.GetArrayLength(channels) > 0))
{
UO.Print(channels[0]);
}
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:
- 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.GlobalChatChannelsList();
UO.Wait(500);
var after = UO.GlobalChatChannelsList();
UO.Print(before);
UO.Print(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. -
InjectionScript.Runtime.InjectionApiUO.StringArray:StringArray(bridge.GlobalChatChannels()). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GlobalChatChannels:bridge.GlobalChatChannels().
Internal implementation code; this is not a standalone script.
case "globalchatchannelslist": return StringArray(bridge.GlobalChatChannels());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GlobalChatJoinChannel(object? chName);Requests entry into the global chat channel.
-
chName— Text through ToString; saved as transmitted.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Sends a Send_ChatJoinCommand with the given channel name. The presence of a channel and permission to enter is determined by the server. The name of the local active channel is read separately.
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for 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.GlobalChatJoinChannel");
UO.GlobalChatJoinChannel("General");Parameters and execution flow:
- Requests entry into the global chat channel.
UO.GlobalChatJoinChannel("General");Parameters and execution flow:
- Sends a Send_ChatJoinCommand with the given channel name. The presence of a channel and permission to enter is determined by the server. The name of the local active channel is read separately.
return RunScenario();
object? RunScenario()
{
var message = "General";
if (Truth(UO.IsOnline()))
{
UO.GlobalChatJoinChannel(message);
}
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:
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for 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()
{
SendText("General");
return null;
}
void SendText(dynamic message)
{
if (Truth(Len(message) > 0))
{
UO.GlobalChatJoinChannel(message);
}
}
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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: chName (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GlobalChatJoin:bridge.GlobalChatJoin(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "globalchatjoinchannel": bridge.GlobalChatJoin(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GlobalChatLeaveChannel();Requests to leave the global chat channel.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- GlobalChatLeave sends Send_ChatLeaveChannelCommand. The local channel name will change after the chat data is processed.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.GlobalChatLeaveChannel");
UO.GlobalChatLeaveChannel();Parameters and execution flow:
- Requests to leave the global chat channel.
UO.GlobalChatLeaveChannel();Parameters and execution flow:
- GlobalChatLeave sends Send_ChatLeaveChannelCommand. The local channel name will change after the chat data is processed.
return RunScenario();
object? RunScenario()
{
UO.Print(UO.GlobalChatActiveChannel());
UO.GlobalChatLeaveChannel();
return null;
}Parameters and execution flow:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.GlobalChatLeaveChannel();
UO.Wait(500);
UO.Print(UO.GlobalChatActiveChannel());
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.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GlobalChatLeave:bridge.GlobalChatLeave().
Internal implementation code; this is not a standalone script.
case "globalchatleavechannel": bridge.GlobalChatLeave(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GlobalChatSendMsg(object? msgText);Sends a message to the global chat.
-
msgText— Text through ToString; saved as transmitted.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Sends a Send_ChatMessageCommand with the transmitted text. The channel uses the client/server chat state; the team does not choose the channel itself.
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for 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.GlobalChatSendMsg");
UO.GlobalChatSendMsg("Hello");Parameters and execution flow:
- Sends a message to the global chat.
UO.GlobalChatSendMsg("Hello");Parameters and execution flow:
- Sends a Send_ChatMessageCommand with the transmitted text. The channel uses the client/server chat state; the team does not choose the channel itself.
return RunScenario();
object? RunScenario()
{
var message = "Hello";
if (Truth(UO.IsOnline()))
{
UO.GlobalChatSendMsg(message);
}
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:
- Bridge sends the request on the game thread. Server rules apply; There is no built-in waiting for 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()
{
SendText("Hello");
return null;
}
void SendText(dynamic message)
{
if (Truth(Len(message) > 0))
{
UO.GlobalChatSendMsg(message);
}
}
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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: msgText (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GlobalChatSend:bridge.GlobalChatSend(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "globalchatsendmsg": bridge.GlobalChatSend(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Msg(object? message);Shows a local message about script progress or stopping condition. You see it, not other players.
A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.
- The message goes to the lower left area of the game window and the local log. A copy is available in output IDE. In the manager's general log, enable the script message filter: the entry is available without the game window. The server system message filter does not select such records. The network voice packet is not sent. For the inscription above the head there is UO.CharPrint.
-
UO.Printadds a new entry to the game message log: first read or save the desired search string/result, then record the diagnostic message. In a fast loop, record messages when changes occur rather than every iteration. - Without color, hue 0x03B2 is used. UO.Print(text, color) accepts text first; UO.ColorPrint(color, text) – color first.
- Despite the Server in the name or the similarity to a network message, the command only prints local text. To speak to the world, use UO.Say.
- UO.Print · UO.CharPrint · UO.Say · UO.ConColor
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 and has no return value (void). The message text appears directly in the call.
UO.Msg("Hello from C#");Parameters and execution flow:
- processed=12 — demo number of items already processed. Convert.ToString turns it into a string. This example only reports a number; it does not transfer the objects themselves.
var processed = 12;
UO.Msg("Processed item entries: " + Convert.ToString(processed));Parameters and execution flow:
- The character's weight and maximum are read. A zero/unknown maximum is not considered an overload. If weight >= maximum, one line is printed and Main ends; items are not thrown away.
return RunScenario();
object? RunScenario()
{
var weight = UO.Weight();
var maximum = UO.MaxWeight();
if (Truth(maximum > 0) && Truth(weight >= maximum))
{
UO.Msg("Too heavy: " + Convert.ToString(weight) + "/" + Convert.ToString(maximum));
return null;
}
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:
- Main remembers the weight, waits 1000 milliseconds, and calls the fully declared ReportWeight. The assistant prints only if the weight has changed and returns the new weight for the next check. It does not itself create an infinite loop.
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 previous = UO.Weight();
UO.Wait(1000);
previous = ReportWeight(previous, UO.Weight());
return null;
}
dynamic ReportWeight(dynamic previous, dynamic current)
{
if (Truth(previous != current))
{
UO.Msg("Weight changed: " + Convert.ToString(current));
}
return current;
}
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: message (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Msg. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ServerPrint:bridge.ServerPrint(message).
Internal implementation code; this is not a standalone script.
public void Msg(string message) => bridge.ServerPrint(message);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Salute();Requests a greeting animation.
There are no parameters.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Salute calls GameActions.EmoteAction("salute") via Invoke. This is a character action, not UO.Say text.
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.Salute");
UO.Salute();Parameters and execution flow:
- Requests a greeting animation.
UO.Salute();Parameters and execution flow:
- Salute calls GameActions.EmoteAction("salute") via Invoke. This is a character action, not UO.Say text.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.IsOnline()))
{
UO.Salute();
}
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:
- In the examples, UO.Wait specifies only a script pause; the end of the pause does not prove that the server has completed the request.
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.Salute();
UO.Wait(1000);
UO.Print("Salute requested");
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.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Salute:bridge.Salute().
Internal implementation code; this is not a standalone script.
case "salute": bridge.Salute(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.Say(object? message);Sends the character's normal speech to the server: for example, an address to a banker or a command to a pet.
A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.
- For protocol version 2.0.0 and later, the client sends Unicode speech; for the older one - ASCII speech. The name SayU does not force the old protocol to Unicode. Without an explicit color, SpeechHue of the profile is taken; 0xFFFF in UO.UOSayColor also selects this color. The text is sent to the server, but the script does not execute it as code.
- UO.Print · UO.CharPrint · UO.Say · UO.ConColor
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.Say");
UO.Say("bank");Parameters and execution flow:
- Connected is checked before sending. bank is one line of speech, not the name API. To open a bank you usually need a suitable NPC nearby; if the server uses a different phrase, replace it.
if (Truth(UO.Connected()))
{
UO.Say("bank");
}
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:
- petName is the name of your pet, here Shadow. It makes up one line Shadow follow me. This is an order for your pet to follow you, rather than UO.Follow, which moves your character.
return RunScenario();
object? RunScenario()
{
var petName = "Shadow";
if (Truth(UO.Connected()))
{
UO.Say(petName + " follow me");
}
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:
- RequestBankIfHeavy checks connection and reliable positive maximum weight. Only when overloaded, it sends bank and returns 1 as a sign of a sent request. 0—request not sent. This result belongs to the assistant, not the speech command.
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()
{
return RequestBankIfHeavy();
return null;
}
dynamic RequestBankIfHeavy()
{
if (!(Truth(UO.Connected())))
{
return 0;
}
var maximum = UO.MaxWeight();
if (Truth(maximum <= 0) || Truth(UO.Weight() < maximum))
{
return 0;
}
UO.Say("bank");
return 1;
}
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: message (String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Say. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Say:bridge.Say(message).
Internal implementation code; this is not a standalone script.
public void Say(string message) => bridge.Say(message);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SayU(object? text);Sends the character's normal speech to the server: for example, an address to a banker or a command to a pet.
A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.
- For protocol version 2.0.0 and later, the client sends Unicode speech; for the older one - ASCII speech. The name SayU does not force the old protocol to Unicode. Without an explicit color, SpeechHue of the profile is taken; 0xFFFF in UO.UOSayColor also selects this color. The text is sent to the server, but the script does not execute it as code.
- UO.Print · UO.CharPrint · UO.Say · UO.ConColor
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.SayU");
UO.SayU("bank");Parameters and execution flow:
- Connected is checked before sending. bank is one line of speech, not the name API. To open a bank you usually need a suitable NPC nearby; if the server uses a different phrase, replace it.
if (Truth(UO.Connected()))
{
UO.SayU("bank");
}
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:
- petName is the name of your pet, here Shadow. It makes up one line Shadow follow me. This is an order for your pet to follow you, rather than UO.Follow, which moves your character.
return RunScenario();
object? RunScenario()
{
var petName = "Shadow";
if (Truth(UO.Connected()))
{
UO.SayU(petName + " follow me");
}
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:
- RequestBankIfHeavy checks connection and reliable positive maximum weight. Only when overloaded, it sends bank and returns 1 as a sign of a sent request. 0—request not sent. This result belongs to the assistant, not the speech command.
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()
{
return RequestBankIfHeavy();
return null;
}
dynamic RequestBankIfHeavy()
{
if (!(Truth(UO.Connected())))
{
return 0;
}
var maximum = UO.MaxWeight();
if (Truth(maximum <= 0) || Truth(UO.Weight() < maximum))
{
return 0;
}
UO.SayU("bank");
return 1;
}
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: text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.Say:Say(arguments.Length > 0 ? arguments[0].ToString() : string.Empty). -
InjectionScript.Runtime.InjectionValue.ToString:arguments[0].ToString().
Internal implementation code; this is not a standalone script.
case "sayu": Say(arguments.Length > 0 ? arguments[0].ToString() : string.Empty); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UOAMessage(object? text);Prints a local message in ClassicUO with hue set to UO.FontColor. Suitable for script notifications about inventory, route status or stage completion.
void: Does not return text, log index, or true/false. The call performs local output; There is no display confirmation returned.
- Uses state.FontColor of the current runtime, originally 0x03B2. The recording goes through the lower message area and the client log, as well as the IDE output.
- Does not send speech to the server, does not cause a pop-up window, does not send a message to another player. The regular UO.Print has its own color.
- For the color of one message without changing state.FontColor you can use UO.Print(text,color).
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 and has no return value (void). The message text appears directly in the call.
UO.UOAMessage("Hello from C#");Parameters and execution flow:
- 0x0021 — hue index; The final shade depends on the client's hues files. The message is visible locally; it is not spoken by the character.
UO.FontColor(0x0021);
var first = UO.FindList("0x0EED", "backpack");
if (Truth(first == ""))
{
UO.UOAMessage("No gold in the loaded backpack");
}
else
{
UO.UOAMessage("Gold units: " + Convert.ToString(UO.FindFullQuantity()));
}
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:
- Full Notice accepts text and hue. The last set hue remains for the next UOAMessage of this runtime. There is no built-in FontColor() for reading here.
return RunScenario();
object? RunScenario()
{
Notice("Supplies checked", 0x0044);
Notice("Restock needed", 0x0021);
return null;
}
void Notice(dynamic text, dynamic hue)
{
UO.FontColor(hue);
UO.UOAMessage(text);
}Parameters and execution flow:
- 0x03B2 — initial value FontColor of the new runtime. Finally returns exactly the selected base on normal completion/error handling; it does not restore the unknown previous value.
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 baseHue = 0x03B2;
try
{
UO.FontColor(0x0021);
UO.UOAMessage("Check the route before moving");
}
finally
{
UO.FontColor(baseHue);
}
UO.UOAMessage("Ready");
UO.Print("Regular Print keeps its own color");
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: text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Print:bridge.Print(state.FontColor, Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "uoamessage": bridge.Print(state.FontColor, Text(0)); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UOSay(object? text);Sends the character's normal speech to the server: for example, an address to a banker or a command to a pet.
A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.
- For protocol version 2.0.0 and later, the client sends Unicode speech; for the older one - ASCII speech. The name SayU does not force the old protocol to Unicode. Without an explicit color, SpeechHue of the profile is taken; 0xFFFF in UO.UOSayColor also selects this color. The text is sent to the server, but the script does not execute it as code.
- UO.Print · UO.CharPrint · UO.Say · UO.ConColor
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.UOSay");
UO.UOSay("bank");Parameters and execution flow:
- Connected is checked before sending. bank is one line of speech, not the name API. To open a bank you usually need a suitable NPC nearby; if the server uses a different phrase, replace it.
if (Truth(UO.Connected()))
{
UO.UOSay("bank");
}
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:
- petName is the name of your pet, here Shadow. It makes up one line Shadow follow me. This is an order for your pet to follow you, rather than UO.Follow, which moves your character.
return RunScenario();
object? RunScenario()
{
var petName = "Shadow";
if (Truth(UO.Connected()))
{
UO.UOSay(petName + " follow me");
}
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:
- RequestBankIfHeavy checks connection and reliable positive maximum weight. Only when overloaded, it sends bank and returns 1 as a sign of a sent request. 0—request not sent. This result belongs to the assistant, not the speech command.
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()
{
return RequestBankIfHeavy();
return null;
}
dynamic RequestBankIfHeavy()
{
if (!(Truth(UO.Connected())))
{
return 0;
}
var maximum = UO.MaxWeight();
if (Truth(maximum <= 0) || Truth(UO.Weight() < maximum))
{
return 0;
}
UO.UOSay("bank");
return 1;
}
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: text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.Say:Say(Text(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0).
Internal implementation code; this is not a standalone script.
case "uosay": Say(Text(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UOSayColor(object? text, object? color);Sends the character's normal speech to the server: for example, an address to a banker or a command to a pet.
-
coloris UO hue, not RGB. Number or hex string; the bridge uses the low 16 bits. Not to be confused with graphic/type. 0x0044 in the example is the selected hue. For protocol version 2.0.0 and later, the client sends Unicode speech; for the older one - ASCII speech. The name SayU does not force the old protocol to Unicode. Without an obvious color, SpeechHue of the profile is taken; 0xFFFF in UO.UOSayColor also selects this color. The text is sent to the server, but the script does not execute it as code.
A call to a method with a return type void is written as a standalone statement C#; the result cannot be assigned or checked. Completing the statement does not constitute confirmation from the game server.
- For protocol version 2.0.0 and later, the client sends Unicode speech; for the older one - ASCII speech. The name SayU does not force the old protocol to Unicode. Without an explicit color, SpeechHue of the profile is taken; 0xFFFF in UO.UOSayColor also selects this color. The text is sent to the server, but the script does not execute it as code.
- UO.Print · UO.CharPrint · UO.Say · UO.ConColor
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.UOSayColor");
UO.UOSayColor("bank", 0x0044);Parameters and execution flow:
- Connected is checked before sending. bank is one line of speech, not the name API. To open a bank you usually need a suitable NPC nearby; if the server uses a different phrase, replace it.
if (Truth(UO.Connected()))
{
UO.UOSayColor("bank", 0x0044);
}
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:
- petName is the name of your pet, here Shadow. It makes up one line Shadow follow me. This is an order for your pet to follow you, rather than UO.Follow, which moves your character.
return RunScenario();
object? RunScenario()
{
var petName = "Shadow";
if (Truth(UO.Connected()))
{
UO.UOSayColor(petName + " follow me", 0x0044);
}
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:
- RequestBankIfHeavy checks connection and reliable positive maximum weight. Only when overloaded, it sends bank and returns 1 as a sign of a sent request. 0—request not sent. This result belongs to the assistant, not the speech command.
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()
{
return RequestBankIfHeavy();
return null;
}
dynamic RequestBankIfHeavy()
{
if (!(Truth(UO.Connected())))
{
return 0;
}
var maximum = UO.MaxWeight();
if (Truth(maximum <= 0) || Truth(UO.Weight() < maximum))
{
return 0;
}
UO.UOSayColor("bank", 0x0044);
return 1;
}
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: text (Any), color (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Say:bridge.Say(Text(0), Arg(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(1).
Internal implementation code; this is not a standalone script.
case "uosaycolor": bridge.Say(Text(0), Arg(1)); return InjectionValue.Unit;ClassicUO — Bad Newbie & C# Scripts IDE