-
Notifications
You must be signed in to change notification settings - Fork 0
API CDbl en
ClassicUO / Basic IDE
Reads a numeric setting for calculations, for example a delay expressed in seconds.
CDbl(value:Any) -> Decimal
-
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.
Decimal backed by a 64-bit double. CDbl and CSng use the same conversion and precision; CSng does not reduce the value to a 32-bit Single. Invalid input becomes 0, so 0 alone cannot tell you whether parsing succeeded. NaN and Infinity can be returned; validate the allowed range separately.
- 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 backed by a 64-bit double. CDbl and CSng use the same conversion and precision; CSng does not reduce the value to a 32-bit Single. Invalid input becomes 0, so 0 alone cannot tell you whether parsing succeeded. NaN and Infinity can be returned; validate the allowed range separately.
Reads a numeric setting for calculations, for example a delay expressed in seconds.
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 backed by a 64-bit double. CDbl and CSng use the same conversion and precision; CSng does not reduce the value to a 32-bit Single. Invalid input becomes 0, so 0 alone cannot tell you whether parsing succeeded. NaN and Infinity can be returned; validate the allowed range separately.
Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApi.cs; function BasicDouble.
# CDbl — 1
#
# Reads a numeric setting for calculations, for example a delay expressed in seconds.
#
# Decimal backed by a 64-bit double. CDbl and CSng use the same conversion and precision; CSng
# does not reduce the value to a 32-bit Single. Invalid input becomes 0, so 0 alone cannot tell
# you whether parsing succeeded. NaN and Infinity can be returned; validate the allowed range
# separately.
SUB Main()
# value="0.35" is text with a decimal point. Main returns Decimal 0.35 seconds; no waiting
# occurs.
RETURN CDbl("0.35")
END SUBParameter and execution notes:
- value="0.35" is text with a decimal point. Main returns Decimal 0.35 seconds; no waiting occurs.
# CDbl — 2
#
# Reads a numeric setting for calculations, for example a delay expressed in seconds.
#
# Decimal backed by a 64-bit double. CDbl and CSng use the same conversion and precision; CSng
# does not reduce the value to a 32-bit Single. Invalid input becomes 0, so 0 alone cannot tell
# you whether parsing succeeded. NaN and Infinity can be returned; validate the allowed range
# separately.
SUB Main()
# value="3e1" means 30. Dividing by 4 produces Decimal 7.5. Exponent notation is accepted
# independently of the interface language.
VAR total = CDbl("3e1")
RETURN total / 4
END SUBParameter and execution notes:
- value="3e1" means 30. Dividing by 4 produces Decimal 7.5. Exponent notation is accepted independently of the interface language.
# CDbl — 3
#
# Reads a numeric setting for calculations, for example a delay expressed in seconds.
#
# Decimal backed by a 64-bit double. CDbl and CSng use the same conversion and precision; CSng
# does not reduce the value to a 32-bit Single. Invalid input becomes 0, so 0 alone cannot tell
# you whether parsing succeeded. NaN and Infinity can be returned; validate the allowed range
# separately.
SUB Main()
# Milliseconds receives secondsText="0.35". It rejects nonnumeric text, NaN and values outside
# 0.1..5 seconds with -1. Otherwise it multiplies by 1000 and returns Decimal 350, suitable for
# a later wait. It does not call Wait itself.
RETURN Milliseconds("0.35")
END SUB
SUB Milliseconds(secondsText)
IF NOT IsNumeric(secondsText) THEN
RETURN -1
END IF
VAR seconds = CDbl(secondsText)
IF CStr(seconds) = "NaN" OR seconds < 0.1 OR seconds > 5 THEN
RETURN -1
END IF
RETURN seconds * 1000
END SUBParameter and execution notes:
- Milliseconds receives secondsText="0.35". It rejects nonnumeric text, NaN and values outside 0.1..5 seconds with -1. Otherwise it multiplies by 1000 and returns Decimal 350, suitable for a later wait. It does not call Wait itself.
Русский · English · Українська · Français · Deutsch · Italiano · Español · 繁體中文 · 日本語 · 한국어
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь