Skip to content

EN API UO GetGlobal

Bad Newbie edited this page Oct 16, 2026 · 3 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

UO.GetGlobal

C# signatures

string UO.GetGlobal(object? name);
dynamic UO.GetGlobal(object? globalRegion, object? varName);

Behavior and result

SetGlobal and GetGlobal share one namespace across every script/profile, including separate Full Client and Client processes. Values are strings; an absent key returns "N/A". Keys are case sensitive; region overloads identify a region/name pair. Manager/Game Manager/CSharp/globals.json is read fresh under a process-shared lock and survives restart. Shared forms explicitly alias this same store.

Parameters

  • globalRegion — Namespace combined with the key name.
  • name — Case-sensitive shared key name.
  • varName — Case-sensitive shared key name.

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

Chat commands

#getglobal team.target
#get global team.message

Complete C# examples

Each block is a complete standalone .csx. Replace demonstration serials, types and coordinates. Arguments follow the signature order; named C# arguments make their roles explicit.

1

string value = UO.GetGlobal("team.target");
UO.Print(value);

2

string value = UO.GetGlobal("team.delay");
if (int.TryParse(value, out int milliseconds))
    UO.Print(milliseconds.ToString());

3

UO.Print(Convert.ToString(UO.GetGlobal("team", "delay")));

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        string value = api.GetGlobal("team.target");
        api.Print(value);
    }
}

Internal calls

CSharpGameApi.GetGlobal
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.RegisterClientApiCompatibility
  -> InjectionScript.Runtime.State.Globals.GetGlobal
Globals -> SharedGlobalStore -> named mutex -> atomic JSON replacement

InjectionScript.Runtime.State.SharedGlobalStore.Get

Clone this wiki locally