Repository navigation
EN UO Topic gumps
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Home · C# · IDE · UO API · A–Z · Examples · Languages
Reading server windows and sending responses: buttons, checkboxes, radio buttons and fields. ID window, serial owner and open window index are not interchangeable.
| Topic | Commands and explanations |
|---|---|
| GetGump | UO.GetGump |
| GetGumpInfo | UO.GetGumpInfo |
| Gump ID / Serial | UO.GetGumpID · UO.GetGumpSerial |
| Text Lines | UO.GetGumpTextLines · UO.GetGumpFullLines · UO.GetGumpShortLines |
| Buttons | UO.GetGumpButtonsDescription · UO.NumGumpButton |
| CheckBox | UO.NumGumpCheckBox · UO.GumpAutoCheckBox |
| RadioButton | UO.NumGumpRadiobutton · UO.GumpAutoRadiobutton |
| TextEntry | UO.NumGumpTextEntry · UO.GumpAutoTextEntry |
| WaitGump | UO.WaitGump |
| SelectGump | UO.SelectGump |
| SendGumpSelect | UO.SendGumpSelect |
| Ignore Gumps | UO.AddGumpIgnoreByID · UO.AddGumpIgnoreBySerial · UO.ClearGumpsIgnore |
| Close Gump | UO.IsGumpCanBeClosed · UO.CloseClientGump · UO.CancelGump |
UO.GetGump · UO.GetGumpID · UO.GetGumpSerial · UO.GetGumpCount · UO.GetGumpsCount · UO.GetGumpInfo · UO.GetGumpButtonsDescription · UO.GetGumpFullLines · UO.GetGumpShortLines · UO.GetGumpTextLines · UO.GumpObject · UO.LastGump · UO.IsGump · UO.GumpExists · UO.IsGumpCanBeClosed
UO.NumGumpButton · UO.NumGumpCheckBox · UO.NumGumpRadiobutton · UO.NumGumpTextEntry · UO.GumpAutoCheckBox · UO.GumpAutoRadiobutton · UO.GumpAutoTextEntry · UO.WaitGump · UO.WaitGumpCheck · UO.WaitGumpEntry · UO.SelectGump · UO.SendGumpSelect · UO.SetGump
UO.AddGumpIgnoreByID · UO.AddGumpIgnoreBySerial · UO.ClearGumpsIgnore · UO.CancelGump · UO.CloseClientGump
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 info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
UO.Print("Serial=" + Hex(info[0]));
UO.Print("GumpID=" + Hex(info[1]));
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
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.WaitGump(100);
UO.UseObject("0x40001234");Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.AddGumpIgnoreByID(object? id);Adds the numeric ID gump to the local exception list used by UO.GetGumpInfo.
-
idis a numeric ID gump that returnsUO.GetGumpInfo.
void. Adding ID does not close the window or confirm that the server has processed it.
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.AddGumpIgnoreByID");
UO.AddGumpIgnoreByID(123);Parameters and execution flow:
- Eliminate gump with ID 123 from the result of UO.GetGumpInfo.
UO.AddGumpIgnoreByID(123);Parameters and execution flow:
- Store ID in a variable before throwing the exception.
return RunScenario();
object? RunScenario()
{
var ignoredId = 123;
UO.AddGumpIgnoreByID(ignoredId);
return null;
}Parameters and execution flow:
- Add some ID; each exception affects GetGumpInfo.
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.AddGumpIgnoreByID(123);
UO.AddGumpIgnoreByID(456);
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: id (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "addgumpignorebyid": state.IgnoredGumpIds.Add(Arg(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.AddGumpIgnoreBySerial(object? serial);Adds serial gump to the local exception list used by UO.GetGumpInfo.
-
serialis a numeric serial gump that returnsUO.GetGumpInfo.
void. Adding serial does not close the window or confirm that the server has processed it.
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.AddGumpIgnoreBySerial");
UO.AddGumpIgnoreBySerial(1073741824);Parameters and execution flow:
- Eliminate gump with serial 1073741824 from the result UO.GetGumpInfo.
UO.AddGumpIgnoreBySerial(1073741824);Parameters and execution flow:
- Pass serial from a variable.
return RunScenario();
object? RunScenario()
{
var ignoredSerial = 1073741824;
UO.AddGumpIgnoreBySerial(ignoredSerial);
return null;
}Parameters and execution flow:
- Exclude two serial gumps from GetGumpInfo output.
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.AddGumpIgnoreBySerial(1073741824);
UO.AddGumpIgnoreBySerial(1073741825);
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: serial (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "addgumpignorebyserial": state.IgnoredGumpSerials.Add(Arg(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.CancelGump();
void UO.CancelGump(object? gumpId);Closes the selected server gump via a compatible resolver CloseSimpleGump.
-
gumpId— Optional int/numeric value. The resolver first looks for a matching server/local serial, then the server gump index. Without an argument, -1 is passed and the last gump is selected.
void - no return value.
- An argument named gumpId does not guarantee to search only ID. CloseGumpUnsafe for server gump sends button 0, then deletes the local window. If gump is not found, there is no action. This is not CancelMenu, nor is it clearing the pending WaitGump.
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.CancelGump");
UO.CancelGump();Parameters and execution flow:
- The form without an argument selects the latest available server gump.
UO.CancelGump();Parameters and execution flow:
- The actual ID of the first gump is used; the list may change between calls.
return RunScenario();
object? RunScenario()
{
var id = UO.GetGumpID(0);
if (Truth(id != 0))
{
UO.CancelGump(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;Parameters and execution flow:
- The value -1 explicitly selects the last gump in the resolver.
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.CancelGump(-1);
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.CloseSimpleGump:bridge.CloseSimpleGump(arguments.Length > 0 ? Arg(0) : -1). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "cancelgump": bridge.CloseSimpleGump(arguments.Length > 0 ? Arg(0) : -1); break;Parameters: gumpId (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CloseSimpleGump:bridge.CloseSimpleGump(arguments.Length > 0 ? Arg(0) : -1). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "cancelgump": bridge.CloseSimpleGump(arguments.Length > 0 ? Arg(0) : -1); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ClearGumpsIgnore();Clears both sets of ignored gump ID and gump serial runtime.
There are no parameters.
void - no return value.
- Doesn't close the windows. Once cleared, GetGumpInfo can again return a snapshot of the previously ignored gump.
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.ClearGumpsIgnore");
UO.ClearGumpsIgnore();Parameters and execution flow:
- Clears both sets of ignored gump ID and gump serial runtime.
UO.ClearGumpsIgnore();Parameters and execution flow:
- Remove the added ignore rule.
return RunScenario();
object? RunScenario()
{
UO.AddGumpIgnoreByID(0x1234);
UO.ClearGumpsIgnore();
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.ClearGumpsIgnore();
UO.ClearGumpsIgnore();
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.
case "cleargumpsignore":
state.IgnoredGumpIds.Clear(); state.IgnoredGumpSerials.Clear(); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.CloseClientGump(object? id);Removes local server gumps whose ServerSerial matches the passed ID.
-
idis an int/numeric ID gump compared to ServerSerial. This is not a list index and not a local serial.
void - no return value.
- Iterates through ServerGumpsUnsafe, creates a snapshot of all matches and calls Dispose. Does not send the 0 button or form result to the server. If there are no matches, nothing changes.
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.CloseClientGump");
UO.CloseClientGump(UO.GetGumpID(0));Parameters and execution flow:
- GetGumpID provides server ID; CloseClientGump removes matched local windows.
if (Truth(UO.GetGumpsCount() > 0))
{
var id = UO.GetGumpID(0);
UO.CloseClientGump(id);
}
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:
- Specify ID of the desired server gump; no matches are acceptable.
return RunScenario();
object? RunScenario()
{
var id = 0x12345678;
UO.CloseClientGump(id);
return null;
}Parameters and execution flow:
- After the first Dispose, the second close usually no longer finds the window.
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.GetGumpID(0);
if (Truth(id != 0))
{
UO.CloseClientGump(id);
UO.CloseClientGump(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: id (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CloseClientGump:bridge.CloseClientGump(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "closeclientgump": bridge.CloseClientGump(Arg(0)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGump(object? identifier);
dynamic UO.GetGump(object? gumpId, object? identifier);
dynamic UO.GetGump(object? gumpId, object? identifier, object? key);Reads one field of the selected server gump. Allows you to explicitly set the window selector.
-
gumpId- Optional first int in the forms (gumpId,identifier) and (gumpId,identifier,key). int or numeric string: Looks for an exact GumpID/serial match first, then the index with 0. -1 is the gump selected by this script, and if it is not there, the last one in the current list. Other negative int retain 32-bit ID. This is a selector, as opposed to the strict GumpIndex in NumGump*. -
identifier- string case insensitive. All supported values and result types are listed in the Returns section. Unknown name returns an empty string. -
key— Optional int, default - 1. Index with 0 for button/text/object/command; this is not ID control. A negative index and out-of-bounds result in 0 for button or an empty string for text fields. Other identifiers do not use key.
The type of the result depends on the identifier. int: buttonlen — number of regular buttons; button — ButtonID by index key; textlen — number of available text elements; injid — current window index; replyed — 0 (response history is not stored); inclient — 1 for a found live window, 0 if absent; objectcount — number of live controls, including nested ones. string: serial and gumpid - hex strings 0xXXXXXXXX; text — element text at index key; object — control type name; command — description of the control (type, page, ID, coordinates, dimensions and supported fields). If there is no window, numeric identifiers give 0, string identifiers give an empty string. injid=0 is also a valid first index: 0 by itself does not prove the absence of a window. This is not Array or Pascal TGumpInfo.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- SelectGump/InfoGump specifies the selected window only in the current runtime. If the selected window is closed, the last item in the current list is used, which is not necessarily the most recent item in time.
- textlen/text refer to the available text controls, not the server package's original string pool. object/command refer to the entire tree of live controls. Indexes from different lists cannot be mixed.
- Each call reads the current state separately. For matched serial, GumpID and lists, use GetGumpInfo.
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.GetGump("gumpid");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- gumpid and serial return strings already formatted in hex; no additional Hex needed. Empty lines mean there is no window when reading.
var id = UO.GetGump("gumpid");
var serial = UO.GetGump("serial");
UO.Print(id + " / " + serial);Parameters and execution flow:
- buttonlen — number of buttons; i is the index of the row from 0 to count-1. button - ID for answer, not graphics or index. When changing windows, re-read the list.
return RunScenario();
object? RunScenario()
{
var count = UO.GetGump("buttonlen");
var i = 0;
while (Truth(i < count))
{
var button = UO.GetGump("button", i);
UO.Print(Convert.ToString(button));
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:
- 0x12345678 is an example of GumpID/serial, replace ID with the desired form. text with key=0 reads the first available text control; this is a different list than button.
- SelectGump reports the absence of the specified window, but does not block subsequent reading: check the returned gumpid separately if necessary.
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.SelectGump(0x12345678);
if (Truth(UO.GetGump("inclient")))
{
var count = UO.GetGump("textlen");
if (Truth(count > 0))
{
UO.Print(UO.GetGump("text", 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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: identifier (String)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetGump. -
InjectionScript.Runtime.InjectionApiUO.LastGump:LastGump(identifier, -1).
Internal implementation code; this is not a standalone script.
public InjectionValue GetGump(string identifier) => LastGump(identifier, -1);Parameters: gumpId (Integer/String), identifier (String/Integer)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetGump. -
InjectionScript.Runtime.InjectionApiUO.GetGump:GetGump(gumpId, identifier, -1).
Internal implementation code; this is not a standalone script.
public InjectionValue GetGump(int gumpId, string identifier) => GetGump(gumpId, identifier, -1);Parameters: gumpId (Integer/String), identifier (String/Integer)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetGump. -
InjectionScript.Runtime.InjectionApiUO.LastGump:LastGump(identifier, key).
Internal implementation code; this is not a standalone script.
public InjectionValue GetGump(string identifier, int key) => LastGump(identifier, key);Parameters: gumpId (Integer), identifier (String), key (Integer)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GetGump. -
InjectionScript.Runtime.InjectionApiUO.ConvertGumpValue:ConvertGumpValue(identifier, bridge.GetGumpValue(gumpId, identifier, key)). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpValue:bridge.GetGumpValue(gumpId, identifier, key).
Internal implementation code; this is not a standalone script.
public InjectionValue GetGump(int gumpId, string identifier, int key)
=> ConvertGumpValue(identifier, bridge.GetGumpValue(gumpId, identifier, key));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGumpButtonsDescription(object? gumpIndex);Returns descriptions of regular server gump buttons.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
Array - descriptions of regular buttons. [] - invalid index or no matching elements. The row index starts with 0; it is not a ID control.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Each line contains ButtonID, action, toPage and graphics. Radio buttons are not regular answer buttons.
- When SilentMode=0 the non-empty result is also added to the text window and opens it. SetSilentMode(1) leaves only returning the array.
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.GetGumpButtonsDescription(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- 0 — window index. ArrayLength checks for the presence of a line before calling lines[0].
var lines = UO.GetGumpButtonsDescription(0);
if (Truth(ArrayLength(lines) > 0))
{
UO.Print(lines[0]);
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- SetSilentMode(1) disables the additional text window. The explicit Print in the example still prints strings.
- i is the array index; Take ID of the desired button/switch from the corresponding description.
return RunScenario();
object? RunScenario()
{
UO.SetSilentMode(1);
var lines = UO.GetGumpButtonsDescription(0);
var i = 0;
while (Truth(i < ArrayLength(lines)))
{
UO.Print(lines[i]);
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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 count is converted to the index of the last window. The data is read from the loaded server gump; local windows are not included 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()
{
int count = UO.GetGumpsCount();
if (count == 0)
return null;
int index = count - 1;
var lines = UO.GetGumpButtonsDescription(index);
foreach (object? line in (object? [])lines)
UO.Print(Convert.ToString(line) ?? "");
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: gumpIndex (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GumpLinesResult:GumpLinesResult(bridge.GetGumpButtonsDescription(Arg(0))). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpButtonsDescription:bridge.GetGumpButtonsDescription(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getgumpbuttonsdescription": return GumpLinesResult(bridge.GetGumpButtonsDescription(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetGumpCount();Short version GetGumpsCount: number of active server gumps.
There are no parameters.
int >= 0 — number of windows, not the index of the last window. 0 — the list is empty.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
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.GetGumpCount();
UO.Print("GetGumpCount: " + Convert.ToString(result));Parameters and execution flow:
- This is the number of server gumps, not the window index; local backpack and map are not included here.
int count = UO.GetGumpCount();
UO.Print($"Active server gumps: {count}");Parameters and execution flow:
- Indexes start from zero. The list may change between calls, so the current quantity is checked before reading.
return RunScenario();
object? RunScenario()
{
int count = UO.GetGumpCount();
for (int index = 0; index < count; index++)
{
if (index >= UO.GetGumpCount())
break;
UO.Print($"Gump {index}: ID={UO.GetGumpID(index)}, serial={UO.GetGumpSerial(index)}");
}
return null;
}Parameters and execution flow:
- The wait is limited by a timeout. The mere presence of a window does not prove that this is a necessary gump; to select, check it ID.
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()
{
bool appeared = await WaitForGump(3000);
UO.Print(appeared ? "A server gump appeared" : "No server gump within the timeout");
return null;
}
async Task<bool> WaitForGump(int timeoutMs)
{
var timer = System.Diagnostics.Stopwatch.StartNew();
while (timer.ElapsedMilliseconds < timeoutMs)
{
if (UO.GetGumpCount() > 0)
return true;
await WaitAsync(50);
}
return false;
}
}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:
-
InjectionScript.Runtime.InjectionApiUO.GetGumpCount. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpCount:bridge.GetGumpCount().
Internal implementation code; this is not a standalone script.
public int GetGumpCount() => bridge.GetGumpCount();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGumpFullLines(object? gumpIndex);Returns descriptions of all living elements, including nested server gumps.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
Array - descriptions of all living elements, including nested ones. [] - invalid index or no matching elements. The row index starts with 0; it is not a ID control.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Descriptions of the current control tree: type, page, ID, X/Y, sizes and supported fields. This is not a raw server markup package.
- When SilentMode=0 the non-empty result is also added to the text window and opens it. SetSilentMode(1) leaves only returning the array.
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.GetGumpFullLines(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- 0 — window index. ArrayLength checks for the presence of a line before calling lines[0].
var lines = UO.GetGumpFullLines(0);
if (Truth(ArrayLength(lines) > 0))
{
UO.Print(lines[0]);
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- SetSilentMode(1) disables the additional text window. The explicit Print in the example still prints strings.
- i is the array index; Take ID of the desired button/switch from the corresponding description.
return RunScenario();
object? RunScenario()
{
UO.SetSilentMode(1);
var lines = UO.GetGumpFullLines(0);
var i = 0;
while (Truth(i < ArrayLength(lines)))
{
UO.Print(lines[i]);
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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 count is converted to the index of the last window. The data is read from the loaded server gump; local windows are not included 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()
{
int count = UO.GetGumpsCount();
if (count == 0)
return null;
int index = count - 1;
var lines = UO.GetGumpFullLines(index);
foreach (object? line in (object? [])lines)
UO.Print(Convert.ToString(line) ?? "");
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: gumpIndex (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GumpLinesResult:GumpLinesResult(bridge.GetGumpFullLines(Arg(0))). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpFullLines:bridge.GetGumpFullLines(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getgumpfulllines": return GumpLinesResult(bridge.GetGumpFullLines(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetGumpID(object? gumpIndex);Reads the GumpID window type ID from the server gump index.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
int — 32-bit window type identifier GumpID. 0 is an invalid index (serial=0 may also be present in the window itself). When the most significant bit is set, int is negative: use Hex(value) to display. This is not a subject's type or an index.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- For a matched serial/GumpID pair, use a single GetGumpInfo: the info[0] and info[1] fields.
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.GetGumpID(0);
UO.Print("GetGumpID: " + Convert.ToString(result));Parameters and execution flow:
- 0 is the first index of the server list. Hex stores the bit representation of a negative int.
var value = UO.GetGumpID(0);
UO.Print(Hex(value));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- With an immutable list, count is after the last index, so missing=0. The last valid index is count-1.
return RunScenario();
object? RunScenario()
{
var count = UO.GetGumpsCount();
var missing = UO.GetGumpID(count);
UO.Print(Hex(missing));
return null;
}
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- 0x999 is an example of ID; replace it with the real ID of the desired window. Index, ID and owner serial are different values.
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()
{
int wantedId = 0x00000999;
int count = UO.GetGumpsCount();
for (int index = 0; index < count; index++)
{
if (index >= UO.GetGumpsCount())
break;
if (UO.GetGumpID(index) == wantedId)
{
UO.Print($"Gump index {index}, serial {UO.GetGumpSerial(index)}");
return index;
}
}
return -1;
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: gumpIndex (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpId:bridge.GetGumpId(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getgumpid": return new InjectionValue(bridge.GetGumpId(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGumpInfo(object? gumpIndex);Returns a consistent snapshot of the identifiers and elements of a single server gump.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
Array - exactly five elements: [0] int serial; [1] int GumpID; [2] Array of non-empty texts; [3] Array descriptions of regular buttons; [4] Array of descriptions of all living elements, including nested ones. An invalid/closed or ignored gump by this script produces an empty array []. ID with the most significant bit is represented by a negative int. An empty text array in itself does not mean there is no window.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- The entire snapshot is copied in one game thread request. Changing/closing the window after returning does not change the saved array.
- The control description indicates the type, page, ID, X/Y, dimensions. Buttons additionally contain ButtonID, action, toPage and graphic; switches - ID, checked, inactive/active. Texts may contain spaces and =; The string cannot be unconditionally parsed by spaces.
- AddGumpIgnoreByID/AddGumpIgnoreBySerial hide the result of only this reading in the current script; ClearGumpsIgnore removes these filters. GetGumpsCount does not decrease.
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.GetGumpInfo(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- GumpIndex=0 — the first server gump. Length checking protects access to missing window fields.
- info[0] — serial, info[1] — GumpID; both belong to the same recording.
var info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
UO.Print("Serial=" + Hex(info[0]));
UO.Print("GumpID=" + Hex(info[1]));
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
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:
- info[3] — array of button descriptions; the ButtonID field in the line specifies ID for the response. i is just the row index, not the ButtonID.
- Radio buttons are radio buttons and appear in info[4], not in the list of regular buttons.
return RunScenario();
object? RunScenario()
{
var info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
var buttons = info[3];
var i = 0;
while (Truth(i < ArrayLength(buttons)))
{
UO.Print(buttons[i]);
i = i + 1;
}
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- info[2] - copy of texts. Closing is only allowed for the non-inhibited window NoClose.
- Closing does not clear saved texts; An empty array of texts is also acceptable for an existing window.
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 info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
var texts = info[2];
UO.CloseSimpleGump(0);
if (Truth(ArrayLength(texts) > 0))
{
UO.Print(texts[0]);
}
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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: gumpIndex (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpId:bridge.GetGumpId(index). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpSerial:bridge.GetGumpSerial(index). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpTextLines:bridge.GetGumpTextLines(index). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpButtonsDescription:bridge.GetGumpButtonsDescription(index). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpFullLines:bridge.GetGumpFullLines(index). -
InjectionScript.Runtime.InjectionApiUO.StringArray:StringArray(snapshot.Text).
Internal implementation code; this is not a standalone script.
case "getgumpinfo":
{
int index = Arg(0);
GumpSnapshot snapshot;
if (bridge is IApiGumpAccess reader)
snapshot = reader.ReadGump(index);
else
{
int id = bridge.GetGumpId(index);
snapshot = id == 0 ? null : new GumpSnapshot(bridge.GetGumpSerial(index), id,
bridge.GetGumpTextLines(index), bridge.GetGumpButtonsDescription(index), bridge.GetGumpFullLines(index));
}
if (snapshot == null || state.IgnoredGumpIds.Contains(snapshot.Id)
|| state.IgnoredGumpSerials.Contains(snapshot.Serial))
return new InjectionValue(Array.Empty<InjectionValue>());
return new InjectionValue(new[]
{
new InjectionValue(snapshot.Serial), new InjectionValue(snapshot.Id), StringArray(snapshot.Text),
StringArray(snapshot.Buttons), StringArray(snapshot.Controls)
});
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetGumpSerial(object? gumpIndex);Reads the serial of the window instance/owner by the server gump index.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
int — 32-bit serial of the window instance/owner. 0 is an invalid index (serial=0 may also be present in the window itself). When the most significant bit is set, int is negative: use Hex(value) to display. This is not an item type or an index.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- For a matched serial/GumpID pair, use a single GetGumpInfo: the info[0] and info[1] fields.
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.GetGumpSerial(0);
UO.Print("GetGumpSerial: " + Convert.ToString(result));Parameters and execution flow:
- 0 is the first index of the server list. Hex stores the bit representation of a negative int.
var value = UO.GetGumpSerial(0);
UO.Print(Hex(value));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- With an immutable list, count is after the last index, so missing=0. The last valid index is count-1.
return RunScenario();
object? RunScenario()
{
var count = UO.GetGumpsCount();
var missing = UO.GetGumpSerial(count);
UO.Print(Hex(missing));
return null;
}
string Hex(object? value) => Convert.ToInt64(value).ToString("X");Parameters and execution flow:
- Serial is owned by the server window or its owner under the command contract. It cannot be used instead of the gump index.
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()
{
int count = UO.GetGumpsCount();
for (int index = 0; index < count; index++)
{
if (index >= UO.GetGumpsCount())
break;
int serial = UO.GetGumpSerial(index);
UO.Print($"Window {index}: serial={UO.Int2Hex(serial)}, ID={UO.GetGumpID(index)}");
}
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: gumpIndex (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpSerial:bridge.GetGumpSerial(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getgumpserial": return new InjectionValue(bridge.GetGumpSerial(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGumpShortLines(object? gumpIndex);Returns descriptions of text elements and buttons of the server gump.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
Array - descriptions of text elements and buttons. [] - invalid index or no matching elements. The row index starts with 0; it is not a ID control.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- The short list excludes decorations without text and without the Button type; includes radio buttons.
- When SilentMode=0 the non-empty result is also added to the text window and opens it. SetSilentMode(1) leaves only returning the array.
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.GetGumpShortLines(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- 0 — window index. ArrayLength checks for the presence of a line before calling lines[0].
var lines = UO.GetGumpShortLines(0);
if (Truth(ArrayLength(lines) > 0))
{
UO.Print(lines[0]);
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- SetSilentMode(1) disables the additional text window. The explicit Print in the example still prints strings.
- i is the array index; Take ID of the desired button/switch from the corresponding description.
return RunScenario();
object? RunScenario()
{
UO.SetSilentMode(1);
var lines = UO.GetGumpShortLines(0);
var i = 0;
while (Truth(i < ArrayLength(lines)))
{
UO.Print(lines[i]);
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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 count is converted to the index of the last window. The data is read from the loaded server gump; local windows are not included 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()
{
int count = UO.GetGumpsCount();
if (count == 0)
return null;
int index = count - 1;
var lines = UO.GetGumpShortLines(index);
foreach (object? line in (object? [])lines)
UO.Print(Convert.ToString(line) ?? "");
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: gumpIndex (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.GumpLinesResult:GumpLinesResult(bridge.GetGumpShortLines(Arg(0))). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpShortLines:bridge.GetGumpShortLines(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getgumpshortlines": return GumpLinesResult(bridge.GetGumpShortLines(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetGumpTextLines(object? gumpIndex);Returns non-empty texts of labels, HTML, input fields and labels of server gump switches.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
Array — non-empty texts of labels, HTML, input fields and switch labels. [] - invalid index or no matching elements. The row index starts with 0; it is not ID control.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Text only; ButtonID, dimensions and structure are not included. Doesn't print anything extra.
- GetGumpTextLines does not open a text window.
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.GetGumpTextLines(0);
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- 0 — window index. ArrayLength checks for the presence of a line before calling lines[0].
var lines = UO.GetGumpTextLines(0);
if (Truth(ArrayLength(lines) > 0))
{
UO.Print(lines[0]);
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- SetSilentMode(1) disables the additional text window. The explicit Print in the example still prints strings.
- i is the array index; Take ID of the desired button/switch from the corresponding description.
return RunScenario();
object? RunScenario()
{
UO.SetSilentMode(1);
var lines = UO.GetGumpTextLines(0);
var i = 0;
while (Truth(i < ArrayLength(lines)))
{
UO.Print(lines[i]);
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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 count is converted to the index of the last window. The data is read from the loaded server gump; local windows are not included 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()
{
int count = UO.GetGumpsCount();
if (count == 0)
return null;
int index = count - 1;
var lines = UO.GetGumpTextLines(index);
foreach (object? line in (object? [])lines)
UO.Print(Convert.ToString(line) ?? "");
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: gumpIndex (Any)
Result: dynamic / Array.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.StringArray:StringArray(bridge.GetGumpTextLines(Arg(0))). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpTextLines:bridge.GetGumpTextLines(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "getgumptextlines": return StringArray(bridge.GetGumpTextLines(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GetGumpsCount();Returns the number of active server gumps.
There are no parameters.
int >= 0 — number of windows, not the index of the last window. 0 — the list is empty.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
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.GetGumpsCount();
UO.Print("GetGumpsCount: " + Convert.ToString(result));Parameters and execution flow:
- There are no arguments. count=0 means there are no server windows in the current list.
var count = UO.GetGumpsCount();
if (Truth(count == 0))
{
UO.Print("No server gumps");
}
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:
- i is the index with 0. The resulting ID identifies window types rather than positions in the list.
- If windows change during the walk, the list needs to be re-read; count does not block the interface.
return RunScenario();
object? RunScenario()
{
var count = UO.GetGumpsCount();
var i = 0;
while (Truth(i < count))
{
UO.Print(Hex(UO.GetGumpID(i)));
i = i + 1;
}
return null;
}
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
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:
- count-1 is the last index of the current list, not a guarantee of the newest window. info is empty if the window disappeared before reading.
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 count = UO.GetGumpsCount();
if (Truth(count > 0))
{
var info = UO.GetGumpInfo(count - 1);
UO.Print(ArrayLength(info));
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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: No parameters.
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpCount:bridge.GetGumpCount().
Internal implementation code; this is not a standalone script.
case "getgumpscount": return new InjectionValue(bridge.GetGumpCount());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GumpAutoCheckBox(object? checkBoxID, object? value);Sets the value of the element once in the first suitable server gump; if the element does not exist yet, saves the wait.
-
checkBoxID- int - exact ID of the element of the corresponding type. This is not an index, not a GumpID, and not a serial window; 0 is the usual ID, without substitution of the first element. -
value- int - 1 enable, 0 disable. Non-zero numeric values also include; 0/1 are recommended. Selecting a radio button deselects the neighboring radio buttons of its group.
void - returns nothing: neither success, nor a new value, nor server confirmation.
- First checks existing windows in the current interface order, then new or updated server layouts. Fires once on the first match of type and ID. For a specific window, use NumGump* with an index.
- All pending fields are applied before automatic button responses. Repeat of the same type and ID in one script replaces a value that has not yet been executed. Limit — 1024 pending client fields; exceeding causes a script error.
- Normal completion of the procedure saves the wait. Canceling an owner or Terminate with its name removes its pendings; TerminateAll deletes everything, including those remaining after completion of procedures. Changing the world clears the queue. Expectations are not saved to the profile.
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.GumpAutoCheckBox");
UO.GumpAutoCheckBox(33, 1);Parameters and execution flow:
- The first parameter 33 is an example ID of the desired element; replace it with the real ID from InfoGump. The second is the value to be set. If there is no element, the action remains pending.
UO.GumpAutoCheckBox(33, 1);Parameters and execution flow:
- 33 — ID of the element, 100 — example of ButtonID confirmation, 0x40001234 — serial of the object that opens the form. Replace all three values with your own. The field will be filled before the answer, even if the window arrived later.
return RunScenario();
object? RunScenario()
{
UO.GumpAutoCheckBox(33, 1);
UO.WaitGump(100);
UO.UseObject("0x40001234");
return null;
}Parameters and execution flow:
- Both calls use ID 33. If the element has not yet appeared, the last value applies. If the window is already open, both changes are performed immediately in order.
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.GumpAutoCheckBox(33, 1);
UO.GumpAutoCheckBox(33, 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: checkBoxID (Any), value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.QueueGumpControl:QueueGumpControl("checkbox", Arg(0), Text(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(1).
Internal implementation code; this is not a standalone script.
case "gumpautocheckbox": QueueGumpControl("checkbox", Arg(0), Text(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GumpAutoRadiobutton(object? radiobuttonID, object? value);Sets the value of the element once in the first suitable server gump; if the element does not exist yet, saves the wait.
-
radiobuttonID- int - exact ID of the element of the corresponding type. This is not an index, not a GumpID, and not a serial window; 0 is the usual ID, without substitution of the first element. -
value- int - 1 enable, 0 disable. Non-zero numeric values also include; 0/1 are recommended. Selecting a radio button deselects the neighboring radio buttons of its group.
void - returns nothing: neither success, nor a new value, nor server confirmation.
- First checks existing windows in the current interface order, then new or updated server layouts. Fires once on the first match of type and ID. For a specific window, use NumGump* with an index.
- All pending fields are applied before automatic button responses. Repeat of the same type and ID in one script replaces a value that has not yet been executed. Limit — 1024 pending client fields; exceeding causes a script error.
- Normal completion of the procedure saves the wait. Canceling an owner or Terminate with its name removes its pendings; TerminateAll deletes everything, including those remaining after completion of procedures. Changing the world clears the queue. Expectations are not saved to the profile.
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.GumpAutoRadiobutton");
UO.GumpAutoRadiobutton(33, 1);Parameters and execution flow:
- The first parameter 33 is an example ID of the desired element; replace it with the real ID from InfoGump. The second is the value to be set. If there is no element, the action remains pending.
UO.GumpAutoRadiobutton(33, 1);Parameters and execution flow:
- 33 — ID of the element, 100 — example of ButtonID confirmation, 0x40001234 — serial of the object that opens the form. Replace all three values with your own. The field will be filled before the answer, even if the window arrived later.
return RunScenario();
object? RunScenario()
{
UO.GumpAutoRadiobutton(33, 1);
UO.WaitGump(100);
UO.UseObject("0x40001234");
return null;
}Parameters and execution flow:
- Both calls use ID 33. If the element has not yet appeared, the last value applies. If the window is already open, both changes are performed immediately in order.
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.GumpAutoRadiobutton(33, 1);
UO.GumpAutoRadiobutton(33, 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: radiobuttonID (Any), value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.QueueGumpControl:QueueGumpControl("radio", Arg(0), Text(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(1).
Internal implementation code; this is not a standalone script.
case "gumpautoradiobutton": QueueGumpControl("radio", Arg(0), Text(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GumpAutoTextEntry(object? textEntryID, object? value);Sets the value of the element once in the first suitable server gump; if the element does not exist yet, saves the wait.
-
textEntryID- int - exact ID of the element of the corresponding type. This is not an index, not a GumpID, and not a serial window; 0 is the usual ID, without substitution of the first element. -
value— string — field text, including an empty line for clearing. Restrictions on the length and allowed characters of the field itself are preserved.
void - returns nothing: neither success, nor a new value, nor server confirmation.
- First checks existing windows in the current interface order, then new or updated server layouts. Fires once on the first match of type and ID. For a specific window, use NumGump* with an index.
- All pending fields are applied before automatic button responses. Repeat of the same type and ID in one script replaces a value that has not yet been executed. Limit — 1024 pending client fields; exceeding causes a script error.
- Normal completion of the procedure saves the wait. Canceling an owner or Terminate with its name removes its pendings; TerminateAll deletes everything, including those remaining after completion of procedures. Changing the world clears the queue. Expectations are not saved to the profile.
- Text delimited by a field can be shortened or rejected; the found element still consumes a one-time action. The command does not send a button response and does not wait for the server. To check, use GetGumpInfo/NumGumpTextEntry.
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.GumpAutoTextEntry");
UO.GumpAutoTextEntry(33, "500");Parameters and execution flow:
- The first parameter 33 is an example ID of the desired element; replace it with the real ID from InfoGump. The second is the value to be set. If there is no element, the action remains pending.
UO.GumpAutoTextEntry(33, "500");Parameters and execution flow:
- 33 — ID of the element, 100 — example of ButtonID confirmation, 0x40001234 — serial of the object that opens the form. Replace all three values with your own. The field will be filled before the answer, even if the window arrived later.
return RunScenario();
object? RunScenario()
{
UO.GumpAutoTextEntry(33, "500");
UO.WaitGump(100);
UO.UseObject("0x40001234");
return null;
}Parameters and execution flow:
- Both calls use ID 33. If the element has not yet appeared, the last value applies. If the window is already open, both changes are performed immediately in order.
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.GumpAutoTextEntry(33, "500");
UO.GumpAutoTextEntry(33, "");
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: textEntryID (Any), value (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.QueueGumpControl:QueueGumpControl("textentry", Arg(0), Text(1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(1).
Internal implementation code; this is not a standalone script.
case "gumpautotextentry": QueueGumpControl("textentry", Arg(0), Text(1)); return InjectionValue.Unit;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.GumpExists(object? id);
int UO.GumpExists(object? firstId, object? secondId);Checks for the presence of a server gump using one selector or an exact serial/GumpID pair.
-
id— One-argument form: numeric serial, GumpID or index with 0. -1 does not select the last gump here. -
firstId— Two-argument form: numeric 32-bit serial, including negative int with most significant bit. -
secondId— Two-argument form: exact 32-bit GumpID. 0 is an exact number, not a wildcard. Only -1 switches back to the one-argument check of firstId as serial/GumpID/index.
int — 1, if the corresponding window exists now; 0 otherwise. Does not return index, serial, or number of matches.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- The check does not select a window and does not reserve it. The pair ID is checked as a whole; ID with the most significant bit does not disable the filter.
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.GumpExists(0x87654321);
UO.Print("GumpExists: " + Convert.ToString(result));Parameters and execution flow:
- 0x87654321 — the desired GumpID or serial. One argument does not distinguish between these spaces ID.
var exists = UO.GumpExists(0x87654321);
UO.Print(Convert.ToString(exists));Parameters and execution flow:
- The first number is serial, the second is GumpID. Both are negative in a signed int, but the comparison preserves all 32 bits.
return RunScenario();
object? RunScenario()
{
var exists = UO.GumpExists(0x87654321, 0x98765432);
if (Truth(exists))
{
UO.Print("Matching pair exists");
}
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:
- info[0]/info[1] belong to the same image. exists=1 means the pair exists now; a re-opened window with the same pair is no different from the previous one.
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 info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
var exists = UO.GumpExists(info[0], info[1]);
UO.Print(Convert.ToString(exists));
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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: id (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GumpExists. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GumpExists:bridge.GumpExists(NumberConversions.ToInt(id), -1). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(id).
Internal implementation code; this is not a standalone script.
public int GumpExists(InjectionValue id) => bridge.GumpExists(NumberConversions.ToInt(id), -1);Parameters: firstId (Any), secondId (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.GumpExists. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GumpExists:bridge.GumpExists(NumberConversions.ToInt(firstId), NumberConversions.ToInt(secondId)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(firstId).
Internal implementation code; this is not a standalone script.
public int GumpExists(InjectionValue firstId, InjectionValue secondId)
=> bridge.GumpExists(NumberConversions.ToInt(firstId), NumberConversions.ToInt(secondId));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.GumpObject(object? gumpId);Selects an existing server gump for subsequent calls.
-
gumpId- int: Matches LocalSerial or ServerSerial first, then index zero in the current gumps list. These are not ID buttons.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.SelectGump saves _selectedServerGump. If serial does not match, takes the index 0..count-1. Not found - the selected gump becomes null and a message is displayed.
- Gump does not open and no response is sent to the server. Indexes change when windows are opened/closed; to select stable, use the current serial/id.
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.GumpObject");
UO.GumpObject(0);Parameters and execution flow:
- Selects an existing server gump for subsequent calls.
if (Truth(UO.GumpExists(0)))
{
UO.GumpObject(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:
- Bridge.SelectGump saves _selectedServerGump. If serial does not match, takes the index 0..count-1. Not found - the selected gump becomes null and a message is displayed.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpsCount() > 0))
{
var serial = UO.GetGumpSerial(0);
UO.GumpObject(serial);
}
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:
- Gump does not open and no response is sent to the server. Indexes change when windows are opened/closed; to select stable, use the current serial/id.
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(UO.GetGumpsCount() > 0))
{
UO.GumpObject(0);
UO.Print(UO.LastGump("gumpid"));
}
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: gumpId (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SelectGump:bridge.SelectGump(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "gumpobject": bridge.SelectGump(Arg(0)); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsGump();Checks if there is at least one active server gump.
There are no parameters.
int — 1, if the list is not empty; 0 if empty. This is a sign of availability, not the number of windows.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
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.IsGump();
UO.Print("IsGump: " + Convert.ToString(result));Parameters and execution flow:
- There are no arguments. GetGumpInfo(0) reads the first element and may return an empty array if the window has already been closed.
if (Truth(UO.IsGump()))
{
var info = UO.GetGumpInfo(0);
UO.Print(ArrayLength(info));
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- With three stable windows present=1, count=3.
return RunScenario();
object? RunScenario()
{
var present = UO.IsGump();
var count = UO.GetGumpsCount();
UO.Print(Convert.ToString(present) + "/" + Convert.ToString(count));
return null;
}Parameters and execution flow:
- Wait no longer than approximately 3000 ms, check every 50 ms. The final present shows the state after waiting.
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()
{
var started = Now();
while (Truth(UO.IsGump() == 0) && Truth(Now() - started < 3000))
{
await Delay(50);
}
var present = UO.IsGump();
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;
private int Now() => global::ClassicUO.CSharp.CSharpScriptContext.Current.Now();
}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:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpCount:bridge.GetGumpCount().
Internal implementation code; this is not a standalone script.
case "isgump": return new InjectionValue(bridge.GetGumpCount() > 0 ? 1 : 0);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsGumpCanBeClosed(object? gumpIndex);Checks whether local right-click closing of server gump is allowed.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting.
int — 1, if the window exists and CanCloseWithRightClick is enabled; otherwise 0. This is not a result of closing or the presence of a Cancel button.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- NoClose prohibits CloseSimpleGump; the ability to send ButtonID to the server is a separate action.
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.IsGumpCanBeClosed(0);
UO.Print("IsGumpCanBeClosed: " + Convert.ToString(result));Parameters and execution flow:
- 0 — window index. Verification and closure are different challenges; the index may change between them.
if (Truth(UO.IsGumpCanBeClosed(0)))
{
UO.CloseSimpleGump(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:
- closable=0 on an existing window means the window cannot be closed, not the absence of the window.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpsCount() > 0))
{
var closable = UO.IsGumpCanBeClosed(0);
UO.Print(Convert.ToString(closable));
}
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:
- -1 is not valid for this index command and gives 0; this is not the last window selection.
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 result = UO.IsGumpCanBeClosed(-1);
UO.Print(Convert.ToString(result));
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: gumpIndex (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsGumpCanBeClosed:bridge.IsGumpCanBeClosed(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
Internal implementation code; this is not a standalone script.
case "isgumpcanbeclosed": return new InjectionValue(bridge.IsGumpCanBeClosed(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LastGump(object? identifier);
dynamic UO.LastGump(object? identifier, object? key);Reads one field of the selected server gump. Uses the window selected by this script or the last element of the current list.
-
identifier- string case insensitive. All supported values and result types are listed in the Returns section. Unknown name returns an empty string. -
key— Optional int, default - 1. Index with 0 for button/text/object/command; this is not ID control. A negative index and out-of-bounds result in 0 for button or an empty string for text fields. Other identifiers do not use key.
The type of the result depends on the identifier. int: buttonlen — number of regular buttons; button — ButtonID by index key; textlen — number of available text elements; injid — current window index; replyed — 0 (response history is not stored); inclient — 1 for a found live window, 0 if absent; objectcount — number of live controls, including nested ones. string: serial and gumpid - hex strings 0xXXXXXXXX; text — element text at index key; object — control type name; command — description of the control (type, page, ID, coordinates, dimensions and supported fields). If there is no window, numeric identifiers give 0, string identifiers give an empty string. injid=0 is also a valid first index: 0 by itself does not prove the absence of a window. This is not Array or Pascal TGumpInfo.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- SelectGump/InfoGump specifies the selected window only in the current runtime. If the selected window is closed, the last item in the current list is used, which is not necessarily the most recent item in time.
- textlen/text refer to the available text controls, not the server package's original string pool. object/command refer to the entire tree of live controls. Indexes from different lists cannot be mixed.
- Each call reads the current state separately. For matched serial, GumpID and lists, use GetGumpInfo.
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.LastGump("gumpid");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));Parameters and execution flow:
- gumpid and serial return strings already formatted in hex; no additional Hex needed. Empty lines mean there is no window when reading.
var id = UO.LastGump("gumpid");
var serial = UO.LastGump("serial");
UO.Print(id + " / " + serial);Parameters and execution flow:
- buttonlen — number of buttons; i is the index of the row from 0 to count-1. button - ID for answer, not graphics or index. When changing windows, re-read the list.
return RunScenario();
object? RunScenario()
{
var count = UO.LastGump("buttonlen");
var i = 0;
while (Truth(i < count))
{
var button = UO.LastGump("button", i);
UO.Print(Convert.ToString(button));
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:
- 0x12345678 is an example of GumpID/serial, replace ID with the desired form. text with key=0 reads the first available text control; this is a different list than button.
- SelectGump reports the absence of the specified window, but does not block subsequent reading: check the returned gumpid separately if necessary.
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.SelectGump(0x12345678);
if (Truth(UO.LastGump("inclient")))
{
var count = UO.LastGump("textlen");
if (Truth(count > 0))
{
UO.Print(UO.LastGump("text", 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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: identifier (String)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.LastGump. -
InjectionScript.Runtime.InjectionApiUO.LastGump:LastGump(identifier, -1).
Internal implementation code; this is not a standalone script.
public InjectionValue LastGump(string identifier) => LastGump(identifier, -1);Parameters: identifier (String), key (Integer)
Result: dynamic / Any.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.LastGump. -
InjectionScript.Runtime.InjectionApiUO.ConvertGumpValue:ConvertGumpValue(identifier, bridge.GetGumpValue(-1, identifier, key)). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetGumpValue:bridge.GetGumpValue(-1, identifier, key).
Internal implementation code; this is not a standalone script.
public InjectionValue LastGump(string identifier, int key) => ConvertGumpValue(identifier, bridge.GetGumpValue(-1, identifier, key));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.NumGumpButton(object? gumpIndex, object? value);Activates an existing server gump button based on the strict window index and exact ButtonID.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting. -
value- int - ButtonID from the description of a regular button. Not a line number, not a graphic button, not a GumpID.
int (bool) - 1, if the window and button are found and the local action is performed; 0 if there is no window/button. Changing the page also returns 1. This is not confirmation of server processing.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- The SwitchPage button switches the page locally. The Activate button causes a gump response; the window usually closes. Unlike SendGumpSelect, this command requires an existing ButtonID in the control tree.
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.NumGumpButton(0, 77);
UO.Print("NumGumpButton: " + Convert.ToString(result));Parameters and execution flow:
- 0 is the window index, 77 is an example ButtonID from the inspector. Your form needs its real ID.
var ok = UO.NumGumpButton(0, 77);
if (Truth(ok == 0))
{
UO.Print("Button not found");
}
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:
- 0x12345678 is the expected GumpID, 100 is the ButtonID. These two numbers belong to different spaces ID.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpID(0) == 0x12345678))
{
var ok = UO.NumGumpButton(0, 100);
}
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:
- 33 - ID checkbox, 1 - enable, 100 - ID button. The checkbox state will be included in the response only for the Activate button.
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(UO.NumGumpCheckBox(0, 33, 1)))
{
var ok = UO.NumGumpButton(0, 100);
}
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: gumpIndex (Any), value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ActivateGumpButton:bridge.ActivateGumpButton(Arg(0), Arg(1)).
Internal implementation code; this is not a standalone script.
case "numgumpbutton": return (bridge is IApiGumpAccess buttons
? buttons.ActivateGumpButtonAtIndex(Arg(0), Arg(1)) : bridge.ActivateGumpButton(Arg(0), Arg(1))) != 0 ? InjectionValue.True : InjectionValue.False;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.NumGumpCheckBox(object? gumpIndex, object? cbid, object? value);Sets the state of the flag in the server gump by index.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting. -
cbid- int - the exact ID element from the gump description. This is not the element's serial number; the missing ID is not replaced with an index. -
value— int — 1 enable/select, 0 disable. Numeric non-zero values, true and checked are also recognized. 0 and 1 are recommended.
int (bool) — 1, if the required element is found and its final value matches the specified one; 0 if the index is invalid, the ID/element type is missing, or if the field has not taken an exact value. Re-setting an already set value is also successful.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Changes the local state. The fields and checked radio buttons are sent followed by the button response.
- Selecting a radio button deselects the adjacent radio button of the same group; regular checkboxes are independent.
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.NumGumpCheckBox(0, 33, 1);
UO.Print("NumGumpCheckBox: " + Convert.ToString(result));Parameters and execution flow:
- 0 — window index; 33 — exact CBID; 1 - new value. Replace 33 with ID from your gump.
var ok = UO.NumGumpCheckBox(0, 33, 1);
if (Truth(ok == 0))
{
UO.Print("Control missing or value rejected");
}
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:
- 0 clears the field or unchecks it. The success of the change is returned, not the new value of the field.
return RunScenario();
object? RunScenario()
{
var ok = UO.NumGumpCheckBox(0, 33, 0);
UO.Print(Convert.ToString(ok));
return null;
}Parameters and execution flow:
- 100 - example of server ButtonID confirmation; it needs to be replaced ID of your window. 0 to SendGumpSelect(0,100) is the window index.
- The answer can close the gump and change the indexes. sent means local sending, the result of an operation not confirmed by 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(UO.NumGumpCheckBox(0, 33, 1)))
{
var sent = UO.SendGumpSelect(0, 100);
UO.Print(Convert.ToString(sent));
}
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: gumpIndex (Any), cbid (Any), value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SetIndexedGumpValue:SetIndexedGumpValue(Arg(0), "checkbox", Arg(1), Text(2)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(2).
Internal implementation code; this is not a standalone script.
case "numgumpcheckbox": return SetIndexedGumpValue(Arg(0), "checkbox", Arg(1), Text(2));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.NumGumpRadiobutton(object? gumpIndex, object? radiobuttonID, object? value);Sets the state of a radio button in a server gump by index.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting. -
radiobuttonID- int - the exact ID element from the gump description. This is not the element's serial number; the missing ID is not replaced with an index. -
value— int — 1 enable/select, 0 disable. Numeric non-zero values, true and checked are also recognized. 0 and 1 are recommended.
int (bool) — 1, if the required element is found and its final value matches the specified one; 0 if the index is invalid, the ID/element type is missing, or if the field has not taken an exact value. Re-setting an already set value is also successful.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Changes the local state. The fields and checked radio buttons are sent followed by the button response.
- Selecting a radio button deselects the adjacent radio button of the same group; regular checkboxes are independent.
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.NumGumpRadiobutton(0, 33, 1);
UO.Print("NumGumpRadiobutton: " + Convert.ToString(result));Parameters and execution flow:
- 0 — window index; 33 — exact RadiobuttonID; 1 - new value. Replace 33 with ID from your gump.
var ok = UO.NumGumpRadiobutton(0, 33, 1);
if (Truth(ok == 0))
{
UO.Print("Control missing or value rejected");
}
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:
- 0 clears the field or unchecks it. The success of the change is returned, not the new value of the field.
return RunScenario();
object? RunScenario()
{
var ok = UO.NumGumpRadiobutton(0, 33, 0);
UO.Print(Convert.ToString(ok));
return null;
}Parameters and execution flow:
- 100 - example of server ButtonID confirmation; it needs to be replaced ID of your window. 0 to SendGumpSelect(0,100) is the window index.
- The answer can close the gump and change the indexes. sent means local sending, the result of an operation not confirmed by 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(UO.NumGumpRadiobutton(0, 33, 1)))
{
var sent = UO.SendGumpSelect(0, 100);
UO.Print(Convert.ToString(sent));
}
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: gumpIndex (Any), radiobuttonID (Any), value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SetIndexedGumpValue:SetIndexedGumpValue(Arg(0), "radio", Arg(1), Text(2)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(2).
Internal implementation code; this is not a standalone script.
case "numgumpradiobutton": return SetIndexedGumpValue(Arg(0), "radio", Arg(1), Text(2));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.NumGumpTextEntry(object? gumpIndex, object? textEntryID, object? value);Sets the text of the input field in the server gump by index.
-
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting. -
textEntryID- int - the exact ID element from the gump description. This is not the element's serial number; the missing ID is not replaced with an index. -
value- string - new text. An empty string clears the field; length/character restrictions on the field itself are preserved.
int (bool) — 1, if the required element is found and its final value matches the specified one; 0 if the index is invalid, the ID/element type is missing, or if the field has not taken an exact value. Re-setting an already set value is also successful.
The result of the command is a numeric flag: 1 means a fulfilled condition, 0 means an unfulfilled one. After var result = command(...) check if (result != 0) or if (result == 0). Save the result of one call: a repeated call can perform the action again or read the state that has already changed.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- Changes the local state. The fields and checked radio buttons are sent followed by the button response.
- Selecting a radio button deselects the adjacent radio button of the same group; regular checkboxes are independent.
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.NumGumpTextEntry(0, 33, "500");
UO.Print("NumGumpTextEntry: " + Convert.ToString(result));Parameters and execution flow:
- 0 — window index; 33 — exact TextEntryID; '500' is the new value. Replace 33 with ID from your gump.
var ok = UO.NumGumpTextEntry(0, 33, "500");
if (Truth(ok == 0))
{
UO.Print("Control missing or value rejected");
}
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:
- '' clears the field or unchecks it. The success of the change is returned, not the new value of the field.
return RunScenario();
object? RunScenario()
{
var ok = UO.NumGumpTextEntry(0, 33, "");
UO.Print(Convert.ToString(ok));
return null;
}Parameters and execution flow:
- 100 - example of server ButtonID confirmation; it needs to be replaced ID of your window. 0 to SendGumpSelect(0,100) is the window index.
- The answer can close the gump and change the indexes. sent means local sending, the result of an operation not confirmed by 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(UO.NumGumpTextEntry(0, 33, "500")))
{
var sent = UO.SendGumpSelect(0, 100);
UO.Print(Convert.ToString(sent));
}
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: gumpIndex (Any), textEntryID (Any), value (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.SetIndexedGumpValue:SetIndexedGumpValue(Arg(0), "textentry", Arg(1), Text(2)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(2).
Internal implementation code; this is not a standalone script.
case "numgumptextentry": return SetIndexedGumpValue(Arg(0), "textentry", Arg(1), Text(2));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SelectGump(object? id);Selects an existing server gump for subsequent calls.
-
id- int: Matches LocalSerial or ServerSerial first, then index zero in the current gumps list. These are not ID buttons.
void - no value. Call on a separate line; completion does not confirm the server's action.
- Bridge.SelectGump saves _selectedServerGump. If serial does not match, takes the index 0..count-1. Not found - the selected gump becomes null and a message is displayed.
- Gump does not open and no response is sent to the server. Indexes change when windows are opened/closed; to select stable, use the current serial/id.
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.SelectGump");
UO.SelectGump(0);Parameters and execution flow:
- Selects an existing server gump for subsequent calls.
if (Truth(UO.GumpExists(0)))
{
UO.SelectGump(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:
- Bridge.SelectGump saves _selectedServerGump. If serial does not match, takes the index 0..count-1. Not found - the selected gump becomes null and a message is displayed.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpsCount() > 0))
{
var serial = UO.GetGumpSerial(0);
UO.SelectGump(serial);
}
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:
- Gump does not open and no response is sent to the server. Indexes change when windows are opened/closed; to select stable, use the current serial/id.
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(UO.GetGumpsCount() > 0))
{
UO.SelectGump(0);
UO.Print(UO.LastGump("gumpid"));
}
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: id (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SelectGump. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SelectGump:bridge.SelectGump(NumberConversions.ToInt(id)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(id).
Internal implementation code; this is not a standalone script.
public void SelectGump(InjectionValue id) => bridge.SelectGump(NumberConversions.ToInt(id));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.SendGumpSelect(object? triggerId);
int UO.SendGumpSelect(object? gumpIndex, object? triggerId);
int UO.SendGumpSelect(object? serial, object? gumpId, object? triggerId);
int UO.SendGumpSelect(object? serial, object? gumpId, object? triggerId, object? timeout);Sends the ButtonID for the selected server gump.
-
triggerId- int or numeric string - server ButtonID. 0 usually means close/fail, but the exact action is determined by the server. A visible ButtonID in the tree is not required. -
gumpIndex— Mandatory int — index of the active server gump, from 0 to GetGumpsCount()-1. This is not GumpID/serial. Negative number and index outside the list are invalid. Opening, closing, and reordering windows can change the index; check GetGumpID/GetGumpSerial before acting. Used only in two-argument form (gumpIndex, triggerId). -
serial— In the 3/4 argument forms, a numeric 32-bit serial. 0 or -1 disables the serial filter; the remaining numbers, including negative ones with the most significant bit, are compared exactly. -
gumpId— In the 3/4 argument forms, the numeric 32-bit GumpID. 0 or -1 disables the GumpID filter. Hex strings are allowed; names AddObject are not allowed here. -
timeout— Optional fourth argument, int milliseconds to wait for a matching ID pair. By default, 0 is one immediate attempt; the negative is limited to 0. Recheck interval 20 ms.
int — 1, if a live server gump is found and the response is called; 0 if the window is not found before the timeout expires. Does not return the selected ID and does not wait for the server to confirm the result.
- Works with active server gumps. Backpack, map, settings and other local windows are not included in this list. One call reads data in the game thread; different calls may see different states of the list.
- One argument selects the gump previously selected by this script; if it is closed/not selected - the last element of the current list. Two arguments specify a strict index. Three/four - a pair of ID with filters.
- Selecting and calling a response occurs in one game thread request. The wait is canceled by stopping the procedure. Don't confuse direct server response with page change: the SwitchPage button requires NumGumpButton.
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.SendGumpSelect(100);
UO.Print("SendGumpSelect: " + Convert.ToString(result));Parameters and execution flow:
- SelectGump selects type/serial 0x12345678 or reports absence; 100 - ButtonID.
- If there is no longer a selected window, the one-argument form uses the last available window. For strict identity, use a form with two ID.
UO.SelectGump(0x12345678);
var sent = UO.SendGumpSelect(100);
UO.Print(Convert.ToString(sent));Parameters and execution flow:
- 0 — index, 100 — ButtonID. This is not serial=0 and not GumpID=100.
return RunScenario();
object? RunScenario()
{
var sent = UO.SendGumpSelect(0, 100);
if (Truth(sent == 0))
{
UO.Print("No gump at index zero");
}
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:
- info[0] - serial, info[1] - GumpID, 100 - ButtonID. Changing the index will not redirect the response to a different type/owner.
- Serial/GumpID values 0/-1 are unconstrained filters; identical pairs do not distinguish reopened instances.
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 info = UO.GetGumpInfo(0);
if (Truth(ArrayLength(info) == 5))
{
var sent = UO.SendGumpSelect(info[0], info[1], 100);
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.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:
- 0 disables the serial filter; 0x87654321 — exact ID with the most significant bit; 100 — button; 2000 — maximum wait in ms. Not used as an unconditional wildcard.
var sent = UO.SendGumpSelect(0, 0x87654321, 100, 2000);
UO.Print(Convert.ToString(sent));C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: triggerId (Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SendGumpSelect. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SendGumpSelect:bridge.SendGumpSelect(triggerId).
Internal implementation code; this is not a standalone script.
public int SendGumpSelect(int triggerId) => bridge.SendGumpSelect(triggerId);Parameters: triggerId (Integer/String)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SendGumpSelect. -
InjectionScript.Runtime.InjectionApiUO.SendGumpSelect:SendGumpSelect(NumberConversions.ToInt(triggerId)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(triggerId).
Internal implementation code; this is not a standalone script.
public int SendGumpSelect(string triggerId) => SendGumpSelect(NumberConversions.ToInt(triggerId));Parameters: gumpIndex (Any), triggerId (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SendGumpSelect. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SendGumpSelect:bridge.SendGumpSelect(NumberConversions.ToInt(gumpIndex), NumberConversions.ToInt(triggerId)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(gumpIndex).
Internal implementation code; this is not a standalone script.
public int SendGumpSelect(InjectionValue gumpIndex, InjectionValue triggerId)
=> bridge.SendGumpSelect(NumberConversions.ToInt(gumpIndex), NumberConversions.ToInt(triggerId));Parameters: serial (Any), gumpId (Any), triggerId (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SendGumpSelect. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SendGumpSelect:bridge.SendGumpSelect(NumberConversions.ToInt(serial), NumberConversions.ToInt(gumpId), NumberConversions.ToInt(triggerId)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(serial).
Internal implementation code; this is not a standalone script.
public int SendGumpSelect(InjectionValue serial, InjectionValue gumpId, InjectionValue triggerId)
=> bridge.SendGumpSelect(NumberConversions.ToInt(serial), NumberConversions.ToInt(gumpId), NumberConversions.ToInt(triggerId));Parameters: serial (Any), gumpId (Any), triggerId (Any), timeout (Any)
Result: int / Integer.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SendGumpSelect. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SendGumpSelect:bridge.SendGumpSelect(NumberConversions.ToInt(serial), NumberConversions.ToInt(gumpId), NumberConversions.ToInt(triggerId), Math.Max(0, NumberConversions.ToInt(timeout))). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(serial).
Internal implementation code; this is not a standalone script.
public int SendGumpSelect(InjectionValue serial, InjectionValue gumpId, InjectionValue triggerId, InjectionValue timeout)
=> bridge.SendGumpSelect(NumberConversions.ToInt(serial), NumberConversions.ToInt(gumpId),
NumberConversions.ToInt(triggerId), Math.Max(0, NumberConversions.ToInt(timeout)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetGump(object? identifier, object? key, object? stateValue);
void UO.SetGump(object? gumpId, object? identifier, object? key, object? stateValue);Changes the field of an existing server gump.
-
gumpId- Only form with four arguments: serial/id or zero gump index. The form with three uses -1—the selected/last gump. -
identifier— String "checkbox", "radio" or "textentry", case is not important. An unsupported name does not change the field. -
key- int: first LocalSerial/ID element, then zero index among elements of the specified kind. No element - error message. -
stateValue— For checkbox/radio: "checked", "true" case insensitive or non-zero recognized int includes; the other turns off. For textentry - all text through ToString.
void - no value. Call on a separate line; completion does not confirm the server's action.
- SetGumpValue calls TrySetGumpValue; with 0 displays a message. Changes the local field of an already existing gump and does not register a hook waiting for a new window.
- Changing checkbox/textentry does not send a response to the server by itself. To answer, select the button via SendGumpSelect/WaitGump; Radio buttons are processed in a separate view.
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.SetGump");
UO.SetGump("checkbox", 0, 1);Parameters and execution flow:
- Changes the field of an existing server gump.
if (Truth(UO.GetGumpsCount() > 0))
{
UO.SetGump("checkbox", 0, 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:
- SetGumpValue calls TrySetGumpValue; with 0 displays a message. Changes the local field of an already existing gump and does not register a hook waiting for a new window.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpsCount() > 0))
{
UO.SetGump(0, "textentry", 0, "Example");
}
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:
- Changing checkbox/textentry does not send a response to the server by itself. To answer, select the button via SendGumpSelect/WaitGump; Radio buttons are processed in a separate view.
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(UO.GetGumpsCount() > 0))
{
UO.SetGump("radio", 0, "true");
UO.SetGump("checkbox", 0, 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;
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: identifier (Any), key (Any), stateValue (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetGump. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, identifier.ToString(), NumberConversions.ToInt(key), stateValue.ToString()). -
InjectionScript.Runtime.InjectionValue.ToString:identifier.ToString(). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(key).
Internal implementation code; this is not a standalone script.
public void SetGump(InjectionValue identifier, InjectionValue key, InjectionValue stateValue)
=> bridge.SetGumpValue(-1, identifier.ToString(), NumberConversions.ToInt(key), stateValue.ToString());Parameters: gumpId (Any), identifier (Any), key (Any), stateValue (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.SetGump. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(NumberConversions.ToInt(gumpId), identifier.ToString(), NumberConversions.ToInt(key), stateValue.ToString()). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(gumpId). -
InjectionScript.Runtime.InjectionValue.ToString:identifier.ToString().
Internal implementation code; this is not a standalone script.
public void SetGump(InjectionValue gumpId, InjectionValue identifier, InjectionValue key, InjectionValue stateValue)
=> bridge.SetGumpValue(NumberConversions.ToInt(gumpId), identifier.ToString(), NumberConversions.ToInt(key), stateValue.ToString());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.WaitGump(object? value);
void UO.WaitGump(object? trigger1, object? trigger2);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10, object? trigger11);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10, object? trigger11, object? trigger12);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10, object? trigger11, object? trigger12, object? trigger13);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10, object? trigger11, object? trigger12, object? trigger13, object? trigger14);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10, object? trigger11, object? trigger12, object? trigger13, object? trigger14, object? trigger15);
void UO.WaitGump(object? trigger1, object? trigger2, object? trigger3, object? trigger4, object? trigger5, object? trigger6, object? trigger7, object? trigger8, object? trigger9, object? trigger10, object? trigger11, object? trigger12, object? trigger13, object? trigger14, object? trigger15, object? trigger16);Registers a sequence of one-time responses to buttons. The script continues running immediately; the absence of a window does not cause a 30-second delay.
-
value— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger1— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger2— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger3— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger4— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger5— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger6— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger7— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger8— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger9— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger10— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger11— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger12— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger13— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger14— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger15— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array. -
trigger16— Sequence element: int ButtonID, numeric string, string with |/comma, or Array of such elements. The order is from left to right. General boundaries and rules triggerId apply. Value is the name of the only parameter of the form object?, which also accepts an array.
void - returns nothing: neither success, nor a new value, nor server confirmation.
- Looks for a real Activate button with the desired ButtonID; Buttons for switching pages and windows without the required button are skipped. Subsequent ID do not bypass the first one waiting. For one markup delivery - no more than one response in one window. The updated markup can use the same window object.
- The next WaitGump of the same script completes its pending sequence. The search is not limited to GumpID: use NumGumpButton or SendGumpSelect for precise selection. ButtonID=0 will only work if there is an existing Activate button with ID 0; This is not a universal closure.
- Normal completion of the procedure saves the wait. Canceling an owner or Terminate with its name removes its pendings; TerminateAll deletes everything, including those remaining after completion of procedures. Changing the world clears the queue. Expectations are not saved to the profile.
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.WaitGump");
UO.WaitGump(100);Parameters and execution flow:
- 100 — ButtonID of the response. WaitGump registers it before UseObject; further execution does not mean that the server has already accepted the response.
UO.WaitGump(100);
UO.UseObject("0x40001234");Parameters and execution flow:
- 7, 22 and 1 are the ButtonIDs of the sequential forms. These ID are checked in order. The number of arguments does not specify the delay; the call logs the entire sequence.
return RunScenario();
object? RunScenario()
{
UO.WaitGump(7, 22, 1);
UO.UseObject("0x40001234");
return null;
}Parameters and execution flow:
- The line 7|22|1 specifies the same sequence. TerminateAll then clears all pending gumps and stops all procedures; this is a global 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()
{
UO.WaitGump("7|22|1");
UO.TerminateAll();
return null;
}
}C# is case sensitive. Use the exact UO name. Compare numeric flags with 0; use bool only where the signature returns bool.
Parameters: value (Any/Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(arguments).
Internal implementation code; this is not a standalone script.
case "waitgump": CompactWaitGump(arguments); return InjectionValue.Unit;Parameters: value (Any/Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.WaitGump. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.WaitGumpSelect:bridge.WaitGumpSelect(triggerId, 30_000).
Internal implementation code; this is not a standalone script.
public void WaitGump(int triggerId)
{
if (bridge is IApiGumpAutomation automation) automation.QueueGumpButtons(new[] { triggerId });
else bridge.WaitGumpSelect(triggerId, 30_000);
}Parameters: value (Any/Integer/String)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.WaitGump. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(chain). -
InjectionScript.Runtime.InjectionApiUO.WaitGump:WaitGump(NumberConversions.ToInt(triggerId)). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(triggerId).
Internal implementation code; this is not a standalone script.
public void WaitGump(string triggerId)
{
string text = (triggerId ?? string.Empty).Trim();
if (text.Contains('|') || text.Contains(','))
{
InjectionValue[] chain = text.Split(new[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(value => new InjectionValue(value.Trim())).ToArray();
CompactWaitGump(chain);
return;
}
WaitGump(NumberConversions.ToInt(triggerId));
}Parameters: trigger1 (Any), trigger2 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6) — UO.WaitGump(Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10, trigger11) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any), trigger11 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10, trigger11, trigger12) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any), trigger11 (Any), trigger12 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10, trigger11, trigger12, trigger13) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any), trigger11 (Any), trigger12 (Any), trigger13 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10, trigger11, trigger12, trigger13, trigger14) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any), trigger11 (Any), trigger12 (Any), trigger13 (Any), trigger14 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10, trigger11, trigger12, trigger13, trigger14, trigger15) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any), trigger11 (Any), trigger12 (Any), trigger13 (Any), trigger14 (Any), trigger15 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}
UO.WaitGump(trigger1, trigger2, trigger3, trigger4, trigger5, trigger6, trigger7, trigger8, trigger9, trigger10, trigger11, trigger12, trigger13, trigger14, trigger15, trigger16) — UO.WaitGump(Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any,Any)
Parameters: trigger1 (Any), trigger2 (Any), trigger3 (Any), trigger4 (Any), trigger5 (Any), trigger6 (Any), trigger7 (Any), trigger8 (Any), trigger9 (Any), trigger10 (Any), trigger11 (Any), trigger12 (Any), trigger13 (Any), trigger14 (Any), trigger15 (Any), trigger16 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.Register [WaitGump]. -
InjectionScript.Runtime.InjectionApiUO.CompactWaitGump:CompactWaitGump(values).
The call executes the stored handler delegate. The registration method creates this delegate while building the API.
Internal implementation code; this is not a standalone script.
values =>
{
CompactWaitGump(values);
return InjectionValue.Unit;
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.WaitGumpCheck(object? index, object? state);
void UO.WaitGumpCheck(object? index, object? state, object? index2, object? state2);
void UO.WaitGumpCheck(object? index, object? state, object? index2, object? state2, object? index3, object? state3);Changes up to three checkbox fields of the current gump.
-
index— int ID element or zero index, like SetGump. The arguments come in pairs: selector, value. -
index2— int ID element or zero index, like SetGump. The arguments come in pairs: selector, value. -
index3— int ID element or zero index, like SetGump. The arguments come in pairs: selector, value. -
state— Field value through ToString. Checkbox includes "checked"/"true"/non-zero number; textentry accepts text. -
state2— Field value through ToString. Checkbox includes "checked"/"true"/non-zero number; textentry accepts text. -
state3— Field value through ToString. Checkbox includes "checked"/"true"/non-zero number; textentry accepts text.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias goes through the arguments in pairs and calls SetGumpValue(-1, "checkbox", selector, value) for each one. All registered forms are 2, 4 or 6 arguments.
- The name UO.Wait does not mean waiting: there is no blocking and no queue for future gump. If the field is missing, an error is displayed. The button response is not sent.
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.WaitGumpCheck");
UO.WaitGumpCheck(0, 1);Parameters and execution flow:
- Changes up to three checkbox fields of the current gump.
if (Truth(UO.GetGumpsCount() > 0))
{
UO.WaitGumpCheck(0, 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:
- ExecuteLegacyManualAlias goes through the arguments in pairs and calls SetGumpValue(-1, "checkbox", selector, value) for each one. All registered forms are 2, 4 or 6 arguments.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpsCount() > 0))
{
UO.WaitGumpCheck(0, 1, 1, 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:
- The name UO.Wait does not mean waiting: there is no blocking and no queue for future gump. If the field is missing, an error is displayed. The button response is not sent.
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(UO.GetGumpsCount() > 0))
{
UO.WaitGumpCheck(0, 1, 1, 0, 2, 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 (Any), state (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, "checkbox", Arg(index), Text(index + 1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(index). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(index + 1).
Internal implementation code; this is not a standalone script.
case "waitgumpcheck":
for (int index = 0; index + 1 < arguments.Length; index += 2)
bridge.SetGumpValue(-1, "checkbox", Arg(index), Text(index + 1));
break;Parameters: index (Any), state (Any), index2 (Any), state2 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, "checkbox", Arg(index), Text(index + 1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(index). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(index + 1).
Internal implementation code; this is not a standalone script.
case "waitgumpcheck":
for (int index = 0; index + 1 < arguments.Length; index += 2)
bridge.SetGumpValue(-1, "checkbox", Arg(index), Text(index + 1));
break;
UO.WaitGumpCheck(index, state, index2, state2, index3, state3) — UO.WaitGumpCheck(Any,Any,Any,Any,Any,Any)
Parameters: index (Any), state (Any), index2 (Any), state2 (Any), index3 (Any), state3 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, "checkbox", Arg(index), Text(index + 1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(index). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(index + 1).
Internal implementation code; this is not a standalone script.
case "waitgumpcheck":
for (int index = 0; index + 1 < arguments.Length; index += 2)
bridge.SetGumpValue(-1, "checkbox", Arg(index), Text(index + 1));
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.WaitGumpEntry(object? index, object? text);
void UO.WaitGumpEntry(object? index, object? text, object? index2, object? text2);
void UO.WaitGumpEntry(object? index, object? text, object? index2, object? text2, object? index3, object? text3);Changes up to three textentry fields of the current gump.
-
index— int ID element or zero index, like SetGump. The arguments come in pairs: selector, value. -
index2— int ID element or zero index, like SetGump. The arguments come in pairs: selector, value. -
index3— int ID element or zero index, like SetGump. The arguments come in pairs: selector, value. -
text— Field value through ToString. Checkbox includes "checked"/"true"/non-zero number; textentry accepts text. -
text2— Field value through ToString. Checkbox includes "checked"/"true"/non-zero number; textentry accepts text. -
text3— Field value through ToString. Checkbox includes "checked"/"true"/non-zero number; textentry accepts text.
void - no value. Call on a separate line; completion does not confirm the server's action.
- ExecuteLegacyManualAlias goes through the arguments in pairs and calls SetGumpValue(-1, "textentry", selector, value) for each. All registered forms are 2, 4 or 6 arguments.
- The name UO.Wait does not mean waiting: there is no blocking and no queue for future gump. If the field is missing, an error is displayed. The button response is not sent.
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.WaitGumpEntry");
UO.WaitGumpEntry(0, "Example");Parameters and execution flow:
- Changes up to three textentry fields of the current gump.
if (Truth(UO.GetGumpsCount() > 0))
{
UO.WaitGumpEntry(0, "Example");
}
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:
- ExecuteLegacyManualAlias goes through the arguments in pairs and calls SetGumpValue(-1, "textentry", selector, value) for each. All registered forms are 2, 4 or 6 arguments.
return RunScenario();
object? RunScenario()
{
if (Truth(UO.GetGumpsCount() > 0))
{
UO.WaitGumpEntry(0, "First", 1, "Second");
}
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 name UO.Wait does not mean waiting: there is no blocking and no queue for future gump. If the field is missing, an error is displayed. The button response is not sent.
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(UO.GetGumpsCount() > 0))
{
UO.WaitGumpEntry(0, "First", 1, "Second", 2, "Third");
}
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 (Any), text (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, "textentry", Arg(index), Text(index + 1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(index). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(index + 1).
Internal implementation code; this is not a standalone script.
case "waitgumpentry":
for (int index = 0; index + 1 < arguments.Length; index += 2)
bridge.SetGumpValue(-1, "textentry", Arg(index), Text(index + 1));
break;Parameters: index (Any), text (Any), index2 (Any), text2 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, "textentry", Arg(index), Text(index + 1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(index). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(index + 1).
Internal implementation code; this is not a standalone script.
case "waitgumpentry":
for (int index = 0; index + 1 < arguments.Length; index += 2)
bridge.SetGumpValue(-1, "textentry", Arg(index), Text(index + 1));
break;
UO.WaitGumpEntry(index, text, index2, text2, index3, text3) — UO.WaitGumpEntry(Any,Any,Any,Any,Any,Any)
Parameters: index (Any), text (Any), index2 (Any), text2 (Any), index3 (Any), text3 (Any)
Result: void / Unit.
During a call:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetGumpValue:bridge.SetGumpValue(-1, "textentry", Arg(index), Text(index + 1)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Arg:Arg(index). -
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias::Text:Text(index + 1).
Internal implementation code; this is not a standalone script.
case "waitgumpentry":
for (int index = 0; index + 1 < arguments.Length; index += 2)
bridge.SetGumpValue(-1, "textentry", Arg(index), Text(index + 1));
break;ClassicUO — Bad Newbie & C# Scripts IDE