-
Notifications
You must be signed in to change notification settings - Fork 0
API Chr en
Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
ClassicUO • Runtime API
Creates a Unicode character or a control character for composing text.
Chr(value:Integer) -> String
-
value— Integer Unicode scalar code. Values below 0 clamp to 0; values above 0x10FFFF clamp to 0x10FFFF. Surrogates 0xD800..0xDFFF cause a catchable error.
String of one or two UTF-16 code units. Chr(0) contains a NUL character, not an empty string. Chr(0x1F600) occupies two units; ASC of that result does not recover its full scalar code.
- Runs locally. Examples process sample data and return a value; they do not send chat, stop a script, move items or contact the server.
- Use Integer codes; this typed overload does not accept a Decimal code directly. Tabs and line breaks are text characters, not keyboard actions. How a displayed control character appears depends on the destination widget.
BasicChr clamps the Integer code and calls ConvertFromUtf32. The conversion rejects surrogate codes and produces a surrogate pair for a valid scalar above 0xFFFF.
BasicChr clamps the Integer code and calls ConvertFromUtf32. The conversion rejects surrogate codes and produces a surrogate pair for a valid scalar above 0xFFFF.
String of one or two UTF-16 code units. Chr(0) contains a NUL character, not an empty string. Chr(0x1F600) occupies two units; ASC of that result does not recover its full scalar code.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApi.cs; function BasicChr / Char.ConvertFromUtf32.
Use Integer codes; this typed overload does not accept a Decimal code directly. Tabs and line breaks are text characters, not keyboard actions. How a displayed control character appears depends on the destination widget.
# Prepare a tab-separated record
#
# Creates a Unicode character or a control character for composing text.
#
# String of one or two UTF-16 code units. Chr(0) contains a NUL character, not an empty string.
# Chr(0x1F600) occupies two units; ASC of that result does not recover its full scalar code.
SUB Main()
# Chr(9) inserts one tab between ore and 50. Main returns the text ore<TAB>50 for later file or
# message use.
# Runs locally. Examples process sample data and return a value; they do not send chat, stop a
# script, move items or contact the server.
Dim resource = "ore"
Dim amount = 50
Return resource & Chr(9) & CStr(amount)
END SUBParameter and execution notes:
- Chr(9) inserts one tab between ore and 50. Main returns the text ore50 for later file or message use.
- Runs locally. Examples process sample data and return a value; they do not send chat, stop a script, move items or contact the server.
# Prepare two lines
#
# Creates a Unicode character or a control character for composing text.
#
# String of one or two UTF-16 code units. Chr(0) contains a NUL character, not an empty string.
# Chr(0x1F600) occupies two units; ASC of that result does not recover its full scalar code.
SUB Main()
# Chr(13) and Chr(10) build CRLF between First and Second. The example composes text without
# sending it.
# Runs locally. Examples process sample data and return a value; they do not send chat, stop a
# script, move items or contact the server.
Dim summary = "First" & Chr(13) & Chr(10) & "Second"
Return summary
END SUBParameter and execution notes:
- Chr(13) and Chr(10) build CRLF between First and Second. The example composes text without sending it.
- Runs locally. Examples process sample data and return a value; they do not send chat, stop a script, move items or contact the server.
# Handle an invalid character
#
# Creates a Unicode character or a control character for composing text.
#
# String of one or two UTF-16 code units. Chr(0) contains a NUL character, not an empty string.
# Chr(0x1F600) occupies two units; ASC of that result does not recover its full scalar code.
SUB Main()
# SafeCharacter catches invalid surrogate codes and returns empty text on error. With 0x1F600 it
# succeeds; Len returns 2 UTF-16 units, although this is one Unicode scalar.
# Runs locally. Examples process sample data and return a value; they do not send chat, stop a
# script, move items or contact the server.
Dim symbol = SafeCharacter(0x1F600)
Return Len(symbol)
END SUB
Function SafeCharacter(code)
Try
Return Chr(code)
Catch problem
Return ""
End Try
End FunctionParameter and execution notes:
- SafeCharacter catches invalid surrogate codes and returns empty text on error. With 0x1F600 it succeeds; Len returns 2 UTF-16 units, although this is one Unicode scalar.
- Runs locally. Examples process sample data and return a value; they do not send chat, stop a script, move items or contact the server.
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь