-
Notifications
You must be signed in to change notification settings - Fork 0
API Basic SafeCall en
ClassicUO • Basic
Safe Call is a compatibility prefix for an ordinary call. It adds no error protection, timeout, lock, or background execution.
Safe Call FunctionName(arguments)
VAR value = Safe Call FunctionName(arguments)
-
FunctionName— The name of an existing procedure/function. Game calls require UO.; BASIC built-ins use no prefix. -
arguments— The normal arguments of the selected function. Parentheses are required. Use spaces between Safe and Call.
The original function result is returned. Unit still means no value; Safe Call does not convert the result to true/false.
- Execution stays in the current script flow with normal argument, ByRef, return and cancellation rules. No separate task is created.
- Errors are not suppressed. Use Try/Catch to handle them; Safe Call alone is not an error handler.
- The prefix is not allowed in RaiseEvent. New code can normally use FunctionName(...) directly. This is engine compatibility syntax, not a standard VB.NET construct.
# Sum receives x=20 and y=22 and returns 42. Safe Call changes neither the result type nor the number.
FUNCTION Sum(x, y)
RETURN x + y
END FUNCTION
SUB Main()
RETURN Safe Call Sum(20, 22)
END SUBParameter and execution notes:
Sum receives x=20 and y=22 and returns 42. Safe Call changes neither the result type nor the number.
# Val receives "123" and returns a number. Adding 7 gives 130. Val is a BASIC built-in, so do not add UO.
SUB Main()
VAR text = "123"
RETURN Safe Call Val(text) + 7
END SUBParameter and execution notes:
Val receives "123" and returns a number. Adding 7 gives 130. Val is a BASIC built-in, so do not add UO.
# Fail explicitly throws an error. Catch receives it and sets caught to TRUE (1). Without Try/Catch it would propagate. The full Fail implementation is included below.
FUNCTION Fail()
THROW "sample error"
END FUNCTION
SUB Main()
VAR caught = FALSE
TRY
VAR value = Safe Call Fail()
CATCH problem
caught = TRUE
END TRY
RETURN caught
END SUBParameter and execution notes:
Fail explicitly throws an error. Catch receives it and sets caught to TRUE (1). Without Try/Catch it would propagate. The full Fail implementation is included below.
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь