-
Notifications
You must be signed in to change notification settings - Fork 0
API CBool en
ClassicUO / Basic IDE
Converts a numeric value into a condition flag, for example whether a quantity is nonzero.
CBool(value:Any) -> Integer
-
value— One required Integer/Decimal or numeric String. Text uses a dot and optional exponent, independent of UI language; "0x0EED" is not numeric text here. Invalid text, Array, Object and Unit become 0. Validate user input with IsNumeric before converting.
Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result. The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give 1; this function does not validate numbers.
- Local computation: no packet, target or game action. BasicDouble parses invariant floating-point text first. These are this engine’s rules; they are not identical to VB.NET conversions. Decimal stores a double, and CInt/CLng use midpoint-away-from-zero rounding.
Local computation: no packet, target or game action. BasicDouble parses invariant floating-point text first. These are this engine’s rules; they are not identical to VB.NET conversions. Decimal stores a double, and CInt/CLng use midpoint-away-from-zero rounding.
One required Integer/Decimal or numeric String. Text uses a dot and optional exponent, independent of UI language; "0x0EED" is not numeric text here. Invalid text, Array, Object and Unit become 0. Validate user input with IsNumeric before converting.
Decimal / double
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApi.cs; function BasicDouble.
Converts a numeric value into a condition flag, for example whether a quantity is nonzero.
Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result. The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give 1; this function does not validate numbers.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApi.cs; function Register.
# CBool — 1
#
# Converts a numeric value into a condition flag, for example whether a quantity is nonzero.
#
# Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The
# literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result.
# The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give
# 1; this function does not validate numbers.
SUB Main()
# Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The
# literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result.
# The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give
# 1; this function does not validate numbers.
RETURN CBool(-5)
END SUBParameter and execution notes:
- Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result. The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give 1; this function does not validate numbers.
# CBool — 2
#
# Converts a numeric value into a condition flag, for example whether a quantity is nonzero.
#
# Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The
# literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result.
# The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give
# 1; this function does not validate numbers.
SUB Main()
# The String "true" is not numeric, so CBool returns 0. For a real flag pass the unquoted
# literal True, which represents 1, or a numeric comparison.
RETURN CBool("true")
END SUBParameter and execution notes:
- The String "true" is not numeric, so CBool returns 0. For a real flag pass the unquoted literal True, which represents 1, or a numeric comparison.
# CBool — 3
#
# Converts a numeric value into a condition flag, for example whether a quantity is nonzero.
#
# Integer 1 when the converted number is nonzero; otherwise 0. Negative numbers also give 1. The
# literals True/False mean 1/0 here, so IF flag, flag = True and flag = 1 can test this result.
# The text "true" is not the literal True: it converts to 0. NaN/Infinity are nonzero and give
# 1; this function does not validate numbers.
SUB Main()
# NeedRefill receives current=2 and minimum=5. current < minimum is true; CBool returns 1. Main
# compares that result with True and returns 1. Replace the sample counts with your own loaded
# quantities; no inventory is read or moved by this helper.
IF NeedRefill(2,5) = True THEN
RETURN 1
END IF
RETURN 0
END SUB
SUB NeedRefill(current,minimum)
RETURN CBool(current < minimum)
END SUBParameter and execution notes:
- NeedRefill receives current=2 and minimum=5. current < minimum is true; CBool returns 1. Main compares that result with True and returns 1. Replace the sample counts with your own loaded quantities; no inventory is read or moved by this helper.
Русский · English · Українська · Français · Deutsch · Italiano · Español · 繁體中文 · 日本語 · 한국어
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь