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