Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

StartScript

Launches a script from the specified file path.

ScriptPath — path to the script file (.dsc, .sc, .py, etc.). Can be absolute or relative to the Stealth scripts directory.

Returns the new total number of running scripts after the launch, or $FFFF (65535) if the launch failed (e.g., file not found, character object not available).

The method waits until the scripts pool count increases, confirming the script has started.

Запускает скрипт из указанного файла.

ScriptPath — путь к файлу скрипта (.dsc, .sc, .py и т.д.). Может быть абсолютным или относительным к каталогу скриптов Stealth.

Возвращает новое общее количество запущенных скриптов после запуска, или $FFFF (65535) при неудаче (файл не найден, объект персонажа недоступен и т.д.).

Метод ожидает увеличения числа скриптов в пуле, подтверждая успешный запуск.

Pascal

function StartScript(ScriptPath: String): Word;

Python

def StartScript(ScriptPath: str) -> int: ...

Pascal Example

var
  Count: Word;
begin
  Count := StartScript('Scripts\helper.sc');
  if Count <> $FFFF then
    AddToSystemJournal('Script started. Total running: ' + IntToStr(Count))
  else
    AddToSystemJournal('Failed to start script');
end.

Python Example

count = StartScript('Scripts/helper.py')
if count != 0xFFFF:
    AddToSystemJournal(f'Script started. Total running: {count}')
else:
    AddToSystemJournal('Failed to start script')

See Also

StopScript, GetScriptsList