-
Notifications
You must be signed in to change notification settings - Fork 0
API UO FunRunning en
Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
UO.CallSub · UO.FunRunning · UO.SubExists
ClassicUO • Runtime API
Checks whether the selected procedure has an active execution, including a paused one. Use it to avoid restarting an existing monitor.
UO.FunRunning(subrutineName:String) -> Integer
-
subrutineName— Required String subrutineName is the catalogue's Sub/Function name, such as WeightWatch. Not a path, file name, run index, source text or label changed with SetScriptName. Matching ignores case but does not trim spaces. This call cannot pass procedure arguments.
Integer: 1 (True) if the selected run exists and is not cancelled, including manual or connection-loss pause; 0 (False) if unknown, not started, finished or cancelling. If UO.FunRunning(name), = 1 and = True are valid. GetScriptState distinguishes running (1) from paused (2).
- Only this session's catalogue is searched. Duplicate names select the first match: give independent procedures unique names. These three commands neither load an unknown file nor search the disk.
- CallSub supplies zero arguments. Private access, syntax errors, required parameters, disabled Basic or the single-procedure rule can reject the launch; inspect IDE status/errors. Calling an active procedure again neither duplicates nor resumes it. A start after cancellation may wait for prior cleanup. The controller's next statement does not wait for completion.
- FunRunning resolves the source procedure name/key, not a renamed display label. Pausing retains the run and returns 1. Cancellation returns 0 even while cleanup continues. A check and a subsequent call are not atomic: the task can finish between them.
- SubExists can return 1 for a Private or invalid definition: existence is not launch permission. Stopping a run or closing its editor tab does not necessarily remove its catalogue entry. Reloading a changed file removes obsolete definitions. A function loaded only into a separate runtime need not be registered with the manager.
These are real implementation stages; their C# names are not additional UO commands. All executable Basic helpers are fully defined in the examples.
Required String subrutineName is the catalogue's Sub/Function name, such as WeightWatch. Not a path, file name, run index, source text or label changed with SetScriptName. Matching ignores case but does not trim spaces. This call cannot pass procedure arguments.
Integer: 1 (True) if the selected run exists and is not cancelled, including manual or connection-loss pause; 0 (False) if unknown, not started, finished or cancelling. If UO.FunRunning(name), = 1 and = True are valid. GetScriptState distinguishes running (1) from paused (2).
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function FunRunning.
Only this session's catalogue is searched. Duplicate names select the first match: give independent procedures unique names. These three commands neither load an unknown file nor search the disk.
SubExists can return 1 for a Private or invalid definition: existence is not launch permission. Stopping a run or closing its editor tab does not necessarily remove its catalogue entry. Reloading a changed file removes obsolete definitions. A function loaded only into a separate runtime need not be registered with the manager.
Project source: src/ClassicUO.Client/Game/Managers/YokoInjectionManager.cs; function FindProcedureByName.
Checks whether the selected procedure has an active execution, including a paused one. Use it to avoid restarting an existing monitor.
FunRunning resolves the source procedure name/key, not a renamed display label. Pausing retains the run and returns 1. Cancellation returns 0 even while cleanup continues. A check and a subsequent call are not atomic: the task can finish between them.
Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function FunRunning.
These are real implementation stages; their C# names are not additional UO commands. All executable Basic helpers are fully defined in the examples.
# Start only when no execution is active
#
# Checks whether the selected procedure has an active execution, including a paused one. Use it
# to avoid restarting an existing monitor.
#
# Integer: 1 (True) if the selected run exists and is not cancelled, including manual or
# connection-loss pause; 0 (False) if unknown, not started, finished or cancelling. If
# UO.FunRunning(name), = 1 and = True are valid. GetScriptState distinguishes running (1) from
# paused (2).
SUB Main()
# FunRunning = 0 permits a start request. A paused monitor returns 1, so this example does not
# resume it.
# Save each example as a separate file, load it in the IDE/manager and start Main so the other
# procedures are registered. WeightWatch/ManaWatch are fully defined teaching helpers: three
# weight/mana samples, Wait(1000) meaning 1000 ms, output only while in the world. They are
# finite monitors; pauses can extend elapsed time. The two-task example requires concurrent
# procedures to be enabled.
If Not UO.FunRunning("WeightWatch") Then
UO.CallSub("WeightWatch")
End If
END SUB
Sub WeightWatch()
Dim sample
For sample = 1 To 3
If UO.Connected() Then
UO.Print("Weight: " & CStr(UO.Weight()))
End If
UO.Wait(1000)
Next
End SubParameter and execution notes:
- FunRunning = 0 permits a start request. A paused monitor returns 1, so this example does not resume it.
- Save each example as a separate file, load it in the IDE/manager and start Main so the other procedures are registered. WeightWatch/ManaWatch are fully defined teaching helpers: three weight/mana samples, Wait(1000) meaning 1000 ms, output only while in the world. They are finite monitors; pauses can extend elapsed time. The two-task example requires concurrent procedures to be enabled.
# Distinguish running and paused
#
# Checks whether the selected procedure has an active execution, including a paused one. Use it
# to avoid restarting an existing monitor.
#
# Integer: 1 (True) if the selected run exists and is not cancelled, including manual or
# connection-loss pause; 0 (False) if unknown, not started, finished or cancelling. If
# UO.FunRunning(name), = 1 and = True are valid. GetScriptState distinguishes running (1) from
# paused (2).
SUB Main()
# NamedRunState finds the WeightWatch display label and returns GetScriptState: 1, 2 or 0. It
# assumes a unique unchanged label and no concurrent list mutation. After SetScriptName, search
# the new label or refine by path; FunRunning still uses the source name.
# Save each example as a separate file, load it in the IDE/manager and start Main so the other
# procedures are registered. WeightWatch/ManaWatch are fully defined teaching helpers: three
# weight/mana samples, Wait(1000) meaning 1000 ms, output only while in the world. They are
# finite monitors; pauses can extend elapsed time. The two-task example requires concurrent
# procedures to be enabled.
If UO.FunRunning("WeightWatch") Then
Return NamedRunState("WeightWatch")
End If
Return 0
END SUB
Function NamedRunState(name) As Integer
Dim indices = UO.GetScriptsList()
For Each index In indices
If UO.GetScriptName(index) = name Then
Return UO.GetScriptState(index)
End If
Next
Return 0
End Function
Sub WeightWatch()
Dim sample
For sample = 1 To 3
If UO.Connected() Then
UO.Print("Weight: " & CStr(UO.Weight()))
End If
UO.Wait(1000)
Next
End SubParameter and execution notes:
- NamedRunState finds the WeightWatch display label and returns GetScriptState: 1, 2 or 0. It assumes a unique unchanged label and no concurrent list mutation. After SetScriptName, search the new label or refine by path; FunRunning still uses the source name.
- Save each example as a separate file, load it in the IDE/manager and start Main so the other procedures are registered. WeightWatch/ManaWatch are fully defined teaching helpers: three weight/mana samples, Wait(1000) meaning 1000 ms, output only while in the world. They are finite monitors; pauses can extend elapsed time. The two-task example requires concurrent procedures to be enabled.
# Stop one monitor only
#
# Checks whether the selected procedure has an active execution, including a paused one. Use it
# to avoid restarting an existing monitor.
#
# Integer: 1 (True) if the selected run exists and is not cancelled, including manual or
# connection-loss pause; 0 (False) if unknown, not started, finished or cancelling. If
# UO.FunRunning(name), = 1 and = True are valid. GetScriptState distinguishes running (1) from
# paused (2).
SUB Main()
# Terminate receives the original WeightWatch name and cancels that task, including a paused
# one. Other tasks continue. Run Main as a separate controller.
# Save each example as a separate file, load it in the IDE/manager and start Main so the other
# procedures are registered. WeightWatch/ManaWatch are fully defined teaching helpers: three
# weight/mana samples, Wait(1000) meaning 1000 ms, output only while in the world. They are
# finite monitors; pauses can extend elapsed time. The two-task example requires concurrent
# procedures to be enabled.
If UO.FunRunning("WeightWatch") Then
UO.Terminate("WeightWatch")
End If
END SUB
Sub WeightWatch()
Dim sample
For sample = 1 To 3
If UO.Connected() Then
UO.Print("Weight: " & CStr(UO.Weight()))
End If
UO.Wait(1000)
Next
End SubParameter and execution notes:
- Terminate receives the original WeightWatch name and cancels that task, including a paused one. Other tasks continue. Run Main as a separate controller.
- Save each example as a separate file, load it in the IDE/manager and start Main so the other procedures are registered. WeightWatch/ManaWatch are fully defined teaching helpers: three weight/mana samples, Wait(1000) meaning 1000 ms, output only while in the world. They are finite monitors; pauses can extend elapsed time. The two-task example requires concurrent procedures to be enabled.
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь