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

ChangeProfile

Switches the current profile to the one named Name.

Prerequisites:

  • The current character must be disconnected.
  • Only one script should be running.
  • The profile name is case-sensitive and must match an existing profile exactly.

Returns 0 on success, or a negative error code:

Code Meaning
0 Success
-1 Internal error
-2 Character is connected or in the process of connecting
-3 More than one script is running
-4 The specified profile does not exist

For an extended version that additionally supports changing the shard, see ExtChangeProfile.

Переключает текущий профиль на профиль с именем Name.

Требования:

  • Текущий персонаж должен быть отключён.
  • Должен работать только один скрипт.
  • Имя профиля чувствительно к регистру и должно точно соответствовать существующему профилю.

Возвращает 0 при успехе или отрицательный код ошибки (см. таблицу выше).

Для расширенной версии с поддержкой смены шарда см. ExtChangeProfile.

Pascal

function ChangeProfile(Name: String): Integer;

Parameters:

  • Name — profile name (case-sensitive).

Python

def ChangeProfile(Name: str) -> int: ...

Pascal Example

begin
  Disconnect;
  Wait(2000);
  if ChangeProfile('Test1') = 0 then
  begin
    AddToSystemJournal('Profile changed to Test1');
    Connect;
  end
  else
    AddToSystemJournal('Failed to change profile');
end.

Python Example

Disconnect()
Wait(2000)
result = ChangeProfile('Test1')
if result == 0:
    AddToSystemJournal('Profile changed to Test1')
    Connect()
else:
    AddToSystemJournal(f'Failed to change profile, error: {result}')

See Also

ExtChangeProfile, ProfileName