-
Notifications
You must be signed in to change notification settings - Fork 0
API UO HTTP_Body en
Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
UO.HTTP_Get · UO.HTTP_Post · UO.HTTP_Body · UO.HTTP_Header
ClassicUO • Runtime API
Reads this script's last HTTP response text, for example to parse downloaded JSON settings or compare a service response. Reading does not contact the network.
UO.HTTP_Body() -> Any
No parameters.
String — cached text. Empty before this runtime's first request, after GET into a stream, or after a network failure. A valid response such as HTTP 204 may also have no body. Do not treat it as a True/False delivery result.
- The last response belongs to the current script runtime. Its next GET/POST replaces it; other concurrent scripts do not. It is not saved in the profile. Copy body and headers to local variables before another request if needed.
- GET/POST wait in the executing script thread. One 20-second deadline covers the request and body read. Stopping the script cancels the wait; HTTP_Body/HTTP_Header never wait. The whole response is buffered in memory even with File; this is not streaming for large downloads.
- Response charset controls text decoding; missing/unknown charset falls back to UTF-8. HTTP 4xx/5xx bodies are read too. A network failure/timeout logs an error and empties body and headers; Try/Catch does not replace checking the expected response. Script cancellation propagates. Local file-write or argument errors may be caught by Try/Catch.
- HTTP_Body only reads the last buffer: it neither repeats the request, clears it, nor reads another script's data. After binary GET, use MemoryStream.ToArray() or the saved file instead.
These are actual client stages, not extra UO commands. GET/POST call HttpRequest; HTTP_Body/HTTP_Header only read its result within their runtime.
HTTP_Body only reads the last buffer: it neither repeats the request, clears it, nor reads another script's data. After binary GET, use MemoryStream.ToArray() or the saved file instead.
String — cached text. Empty before this runtime's first request, after GET into a stream, or after a network failure. A valid response such as HTTP 204 may also have no body. Do not treat it as a True/False delivery result.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function ExecuteClientApiCompatibility.
These are actual client stages, not extra UO commands. GET/POST call HttpRequest; HTTP_Body/HTTP_Header only read its result within their runtime.
# Allow an action only for expected text
#
# Reads this script's last HTTP response text, for example to parse downloaded JSON settings or
# compare a service response. Reading does not contact the network.
#
# String — cached text. Empty before this runtime's first request, after GET into a stream, or
# after a network failure. A valid response such as HTTP 204 may also have no body. Do not treat
# it as a True/False delivery result.
SUB Main()
# The service must return allow. Any other response, including empty, yields False. This
# computes permission only; it does not start movement or combat.
# The example.com URLs are illustrative and do not provide this service. Replace them with your
# endpoints; running an example performs real HTTP requests. No game actions are performed.
UO.HTTP_Get("https://example.com/basic-permission")
Dim permission = Trim(UO.HTTP_Body())
Return permission = "allow"
END SUBParameter and execution notes:
- The service must return allow. Any other response, including empty, yields False. This computes permission only; it does not start movement or combat.
- The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.
# Combine two service responses
#
# Reads this script's last HTTP response text, for example to parse downloaded JSON settings or
# compare a service response. Reading does not contact the network.
#
# String — cached text. Empty before this runtime's first request, after GET into a stream, or
# after a network failure. A valid response such as HTTP 204 may also have no body. Do not treat
# it as a True/False delivery result.
SUB Main()
# Save the route name first, then request its description. Without routeName, the second GET
# would overwrite the first response.
# The example.com URLs are illustrative and do not provide this service. Replace them with your
# endpoints; running an example performs real HTTP requests. No game actions are performed.
UO.HTTP_Get("https://example.com/route-name")
Dim routeName = UO.HTTP_Body()
UO.HTTP_Get("https://example.com/route-description")
Return routeName & ": " & UO.HTTP_Body()
END SUBParameter and execution notes:
- Save the route name first, then request its description. Without routeName, the second GET would overwrite the first response.
- The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.
# Distinguish bytes from cached text
#
# Reads this script's last HTTP response text, for example to parse downloaded JSON settings or
# compare a service response. Reading does not contact the network.
#
# String — cached text. Empty before this runtime's first request, after GET into a stream, or
# after a network failure. A valid response such as HTTP 204 may also have no body. Do not treat
# it as a True/False delivery result.
SUB Main()
# After GET into MemoryStream, the text buffer is empty. Three downloaded bytes produce the
# string 3:; the bytes remain in data until Using ends.
# The example.com URLs are illustrative and do not provide this service. Replace them with your
# endpoints; running an example performs real HTTP requests. No game actions are performed.
Dim data = MemoryStream()
Using data
UO.HTTP_Get("https://example.com/route-data.bin", data)
Return CStr(data.Length()) & ":" & UO.HTTP_Body()
End Using
END SUBParameter and execution notes:
- After GET into MemoryStream, the text buffer is empty. Three downloaded bytes produce the string 3:; the bytes remain in data until Using ends.
- The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь