-
Notifications
You must be signed in to change notification settings - Fork 0
API ArrayContains en
Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
ClassicUO • Runtime API
Checks whether a value is in an allowed or already processed array.
ArrayContains(array:Any, pattern:Any) -> Integer
-
array— Array to inspect. A non-Array first argument returns 0. -
pattern— Any value to find among the direct elements.
Integer Boolean: 1/True for a match, 0/False otherwise. Use If ArrayContains(...) or compare with True/1. This is not an index or match count.
- Local query: no server request, item movement or modification of the array. Examples use sample data, not a live inventory.
- Checks the value kind, then compares direct elements until the first equal value. Integer 1 equals Decimal 1.0; String "1" does not equal either. Strings use exact case-sensitive comparison.
- Nested Arrays and reference Objects compare by identity. Structure values are an exception: the same declared Structure type and equal field values compare equal (Array/Object fields keep their own equality rules). No recursive search. An empty array returns 0; uninitialized Array slots contain Unit and can match Unit.
Checks the value kind, then compares direct elements until the first equal value. Integer 1 equals Decimal 1.0; String "1" does not equal either. Strings use exact case-sensitive comparison.
Checks the value kind, then compares direct elements until the first equal value. Integer 1 equals Decimal 1.0; String "1" does not equal either. Strings use exact case-sensitive comparison.
Integer Boolean: 1/True for a match, 0/False otherwise. Use If ArrayContains(...) or compare with True/1. This is not an index or match count.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApi.cs; function ArrayContains.
Checks the value kind, then compares direct elements until the first equal value. Integer 1 equals Decimal 1.0; String "1" does not equal either. Strings use exact case-sensitive comparison.
Nested Arrays and reference Objects compare by identity. Structure values are an exception: the same declared Structure type and equal field values compare equal (Array/Object fields keep their own equality rules). No recursive search. An empty array returns 0; uninitialized Array slots contain Unit and can match Unit.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionValue.cs; function Equals.
Nested Arrays and reference Objects compare by identity. Structure values are an exception: the same declared Structure type and equal field values compare equal (Array/Object fields keep their own equality rules). No recursive search. An empty array returns 0; uninitialized Array slots contain Unit and can match Unit.
Integer Boolean: 1/True for a match, 0/False otherwise. Use If ArrayContains(...) or compare with True/1. This is not an index or match count.
Project source: external/InjectionScript/src/InjectionScript/Runtime/ObjectTypes/StructureObject.cs; function ValueEquals.
Nested Arrays and reference Objects compare by identity. Structure values are an exception: the same declared Structure type and equal field values compare equal (Array/Object fields keep their own equality rules). No recursive search. An empty array returns 0; uninitialized Array slots contain Unit and can match Unit.
# Allow selected item graphics
#
# Checks whether a value is in an allowed or already processed array.
#
# Integer Boolean: 1/True for a match, 0/False otherwise. Use If ArrayContains(...) or compare
# with True/1. This is not an index or match count.
SUB Main()
# The numeric graphic 0x0EED is in the sample list: Main returns allowed. This classifies a
# graphic; it neither searches nor transfers items.
# Local query: no server request, item movement or modification of the array. Examples use
# sample data, not a live inventory.
Dim allowed(1)
allowed[0] = 0x0EED
allowed[1] = 0x0F7A
Dim graphic = 0x0EED
If ArrayContains(allowed, graphic) = True Then
Return "allowed"
End If
Return "skip"
END SUBParameter and execution notes:
- The numeric graphic 0x0EED is in the sample list: Main returns allowed. This classifies a graphic; it neither searches nor transfers items.
- Local query: no server request, item movement or modification of the array. Examples use sample data, not a live inventory.
# Avoid processing a serial twice
#
# Checks whether a value is in an allowed or already processed array.
#
# Integer Boolean: 1/True for a match, 0/False otherwise. Use If ArrayContains(...) or compare
# with True/1. This is not an index or match count.
SUB Main()
# ASC explicitly converts the hexadecimal setting to an Integer serial before searching. The
# known serial returns already queued. Searching the original String would not match the
# Integer.
# Local query: no server request, item movement or modification of the array. Examples use
# sample data, not a live inventory.
Dim queued(1)
queued[0] = 0x40001234
queued[1] = 0x40005678
Dim incoming = "0x40001234"
Dim serial = ASC(incoming, 0)
If serial = 0 Then
Return "invalid"
End If
If ArrayContains(queued, serial) Then
Return "already queued"
End If
Return "new"
END SUBParameter and execution notes:
- ASC explicitly converts the hexadecimal setting to an Integer serial before searching. The known serial returns already queued. Searching the original String would not match the Integer.
- Local query: no server request, item movement or modification of the array. Examples use sample data, not a live inventory.
# Understand nested route points
#
# Checks whether a value is in an allowed or already processed array.
#
# Integer Boolean: 1/True for a match, 0/False otherwise. Use If ArrayContains(...) or compare
# with True/1. This is not an index or match count.
SUB Main()
# route contains the same point reference, not sameCoordinates. Equal coordinates do not make
# distinct arrays identical: Main returns 1|0.
# Local query: no server request, item movement or modification of the array. Examples use
# sample data, not a live inventory.
Dim point(1)
point[0] = 100
point[1] = 200
Dim sameCoordinates(1)
sameCoordinates[0] = 100
sameCoordinates[1] = 200
Dim route(0)
route[0] = point
Return CStr(ArrayContains(route, point)) & "|" & CStr(ArrayContains(route, sameCoordinates))
END SUBParameter and execution notes:
- route contains the same point reference, not sameCoordinates. Equal coordinates do not make distinct arrays identical: Main returns 1|0.
- Local query: no server request, item movement or modification of the array. Examples use sample data, not a live inventory.
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь