API UO SetEventProc - LIHACHTETAN/ClassicUO-BadNewbie-BasicIDE GitHub Wiki
ClassicUO / Basic IDE
Оглавление · Алфавитный указатель · Scripts & Runtime
Registers a repeating handler through the same live-state event engine as UO.SetEvent. Procname='' unregisters the event. Registration does not execute the handler immediately; the handler is evaluated on subsequent UO.Wait yields when the documented event transition occurs.
UO.SetEventProc(Eventname:Any, Procname:Any) -> Unit
Регистр имени не важен. Any — динамическое значение Basic; Unit — отсутствие возвращаемого значения. Integer — знаковое 32-битное число, Decimal — число с плавающей точкой. Правила типов, serial, индексов и ожиданий.
| Имя | Назначение |
|---|---|
Eventname |
Позиционный аргумент этой перегрузки. Подробности использования указаны в описании/фактической ветви runtime ниже. |
Procname |
Loaded Basic SUB name to execute; an empty string unregisters the handler. |
Параметры обязательны внутри каждой показанной сигнатуры. Опустить аргумент можно только при наличии более короткой перегрузки; пропуск позиции посередине не подразумевается.
Eventname — Current Basic compatibility events: SeeNewPlayer, Death, ChangeHitPoints, ChangeMana, ChangeStamina; optional leading ev; other historical TPacketEvent names are rejected.
-
Procname— Loaded zero-argument Basic SUB name; empty string unregisters the handler.
Both parameters are required. Procname='' unregisters the handler; a non-empty Procname registers a repeating handler for a supported current Basic event.
This Basic compatibility route does not claim the complete historical Stealth TPacketEvent callback surface. The current supported event names are SeeNewPlayer, Death, ChangeHitPoints, ChangeMana, and ChangeStamina (case-insensitive; optional leading ev is accepted). Unsupported names are rejected with a system message instead of being silently registered. The handler must be a loaded zero-argument Basic SUB.
Возвращает: Unit — значения нет. Выполняйте вызов отдельной строкой; его нельзя использовать как проверку успеха. Эффект и ограничения зависят от команды.
Каждый блок — самостоятельный скрипт из мануала проекта. Параметры демонстрационного объекта/контейнера и условия действия необходимо сопоставить с вашей игровой ситуацией.
SUB Main()
UO.SetEventProc('ChangeHitPoints', 'OnHpChange')
END SUBSUB Main()
UO.SetEventProc('ChangeHitPoints', '')
END SUBSUB Main()
UO.SetEventProc(1, 2)
END SUBSUB Main()
VAR arg1 = 1 # Eventname
VAR arg2 = 2 # Procname
UO.SetEventProc(arg1, arg2)
END SUBSUB ReadResult()
VAR arg1 = 1 # Eventname
VAR arg2 = 2 # Procname
UO.SetEventProc(arg1, arg2)
END SUB
SUB Main()
ReadResult()
END SUBРеализация и проверка контракта
InjectionScript.Runtime.InjectionApiUO+<>c__DisplayClass38_0.<RegisterStealthCompatibility>b__0
Соответствующая ветвь совместимого обработчика в InjectionApiUO.cs. Arg(i)/Text(i) читают позицию с нуля; bridge обращается к клиенту. Прямые типизированные перегрузки перечислены выше и могут иметь отдельный маршрут.
{
if (string.IsNullOrWhiteSpace(Text(1)))
SetEvent(arguments[0], InjectionValue.False);
else
SetEvent(arguments[0], InjectionValue.True, InjectionValue.True, arguments[1]);
return InjectionValue.Unit;
}Источник реестра и отчёт сверки. Примеры проверяются загрузчиком/парсером включённого runtime. Действия на игровом сервере этой проверкой не исполняются.