-
Notifications
You must be signed in to change notification settings - Fork 0
API UO GetFlying en
ClassicUO / Basic IDE
Checks whether a character is currently flying. This is usually useful for a Gargoyle, for example before a route or a request to start flying. With no argument it answers “am I flying now?”. It only reads state; it does not take off, land or move the character.
UO.GetFlying() -> Integer
UO.GetFlying(value:Any) -> Integer
-
value— Optional mobile serial: a number, hex string, self, lasttarget or a name saved with UO.AddObject. Omit it for your character. This is an object ID, not a graphic/type or Z coordinate. An unknown name, missing/destroyed mobile or item returns 0.
Integer Boolean: 1 = TRUE, 0 = FALSE. Compare with numbers or unquoted logical constants. 1 means the mobile has IsFlying; otherwise, or without a mobile, 0. Height Z alone does not mean flight.
This is a logical result: 1 = TRUE, 0 = FALSE. After VAR result = command(...), use IF result = TRUE THEN or IF result = 1 THEN; for a negative result, IF result = FALSE THEN or IF result = 0 THEN. Do not quote TRUE/FALSE. Call once and save the result: another call can repeat the action or read changed state.
- The main gameplay use is Gargoyle flight, but the getter does not test race. It reads mobile flag 0x04 with protocol 7.0.0.0 or later; older protocols return 0. A roof, high Z, wing animation or Gargoyle race alone does not prove flight is enabled.
- UO.ToggleFly() is the separate action: it requests a toggle, not “enable flight”. Calling it while flying requests landing. The server can refuse; read Flying again with a bounded wait. FALSE can also mean no character/data, so check Connected before a game action.
- Reads the local model: no target, status request, flag change or outgoing packet. A destroyed object is absent even before its dictionary entry is removed.
- Each result is a separate read. The world may change between Exists and the next call; several queries do not form an atomic snapshot.
These are actual internal C# stages. ReadState is a fully defined helper in the example, not an undocumented built-in command.
At runtime creation, RegisterCharacterGetterAliases registers names and overloads. Omission selects bridge.Self; an argument selects its serial. Existing registrations are retained.
1 means the mobile has IsFlying; otherwise, or without a mobile, 0. Height Z alone does not mean flight.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function RegisterCharacterGetterAliases.
TryGetObject resolves numbers, hex strings and saved names. An AddObject name is resolved again on each call; this neither searches graphic/type nor opens an interactive selector.
Optional mobile serial: a number, hex string, self, lasttarget or a name saved with UO.AddObject. Omit it for your character. This is an object ID, not a graphic/type or Z coordinate. An unknown name, missing/destroyed mobile or item returns 0.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function TryGetObject.
Invoke reads on the game thread; a worker waits for the manager to process the request. Script cancellation interrupts that wait. No extra delay or network query is added.
Each result is a separate read. The world may change between Exists and the next call; several queries do not form an atomic snapshot.
Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function Invoke.
Checks whether a character is currently flying. This is usually useful for a Gargoyle, for example before a route or a request to start flying. With no argument it answers “am I flying now?”. It only reads state; it does not take off, land or move the character.
The main gameplay use is Gargoyle flight, but the getter does not test race. It reads mobile flag 0x04 with protocol 7.0.0.0 or later; older protocols return 0. A roof, high Z, wing animation or Gargoyle race alone does not prove flight is enabled.
Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function Flying.
Reads the local model: no target, status request, flag change or outgoing packet. A destroyed object is absent even before its dictionary entry is removed.
# Empty parentheses select self. TRUE equals 1 and FALSE equals 0; IF UO.Flying() THEN is valid. Nothing is toggled here.
SUB Main()
# Read once; no toggle request is sent.
VAR active = UO.GetFlying()
IF active = TRUE THEN
UO.Print("Flying mode active")
ELSE
UO.Print("Ground mode or character data unavailable")
END IF
END SUBParameter and execution notes:
- Empty parentheses select self. TRUE equals 1 and FALSE equals 0; IF UO.Flying() THEN is valid. Nothing is toggled here.
# ReadState(obj) accepts a serial/alias and returns the state. Its complete definition checks existence first. Other characters are read from data already loaded by the client.
SUB Main()
# Previously selected mobile; no target cursor is opened.
VAR target = ASC(UO.GetSerial("lasttarget"), 0)
IF target <> 0 AndAlso UO.Exists(target) THEN
IF ReadState(target) THEN
UO.AddObject("flying_mobile", target)
END IF
END IF
END SUB
FUNCTION ReadState(obj)
IF NOT UO.Exists(obj) THEN
RETURN FALSE
END IF
RETURN UO.GetFlying(obj)
END FUNCTIONParameter and execution notes:
- ReadState(obj) accepts a serial/alias and returns the state. Its complete definition checks existence first. Other characters are read from data already loaded by the client.
# For your Gargoyle on a server supporting flight. EnsureFlight(timeoutMs) returns 1/TRUE once flight is observed, otherwise 0/FALSE. 2000 is the millisecond wait limit, polled every 50 ms. An already flying character sends no toggle; otherwise at most one request is sent. Pausing the script or scheduler delays can extend wall-clock time.
SUB Main()
# timeoutMs = 2000; poll interval = 50 ms; at most one toggle request.
IF EnsureFlight(2000) THEN
UO.Print("Flight confirmed; ready for the next stage")
ELSE
UO.Print("Flight not confirmed; route was not started")
END IF
END SUB
FUNCTION EnsureFlight(timeoutMs)
IF NOT UO.Connected() OrElse UO.Dead() THEN
RETURN FALSE
END IF
IF UO.GetFlying() THEN
RETURN TRUE
END IF
UO.ToggleFly()
VAR waited = 0
WHILE waited < timeoutMs
IF NOT UO.Connected() THEN
RETURN FALSE
END IF
IF UO.GetFlying() THEN
RETURN TRUE
END IF
WAIT(50)
waited += 50
WEND
RETURN UO.GetFlying()
END FUNCTIONParameter and execution notes:
- For your Gargoyle on a server supporting flight. EnsureFlight(timeoutMs) returns 1/TRUE once flight is observed, otherwise 0/FALSE. 2000 is the millisecond wait limit, polled every 50 ms. An already flying character sends no toggle; otherwise at most one request is sent. Pausing the script or scheduler delays can extend wall-clock time.
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь