Skip to main content

Overview

The /exit command allows you to quickly leave the current world and return to the main menu without manually using the in-game exit button.

Syntax

/exit
This command takes no arguments.

Description

When executed, the /exit command sends a QuitToExit packet to the game client, which triggers the same action as clicking the exit button in-game. This immediately disconnects you from the current world and returns you to the main menu.

Use Cases

Quick Exit

Instantly leave a world without navigating menus

Script Automation

Exit worlds programmatically in automated workflows

Emergency Disconnect

Quickly leave dangerous or unwanted situations

World Testing

Rapidly exit during world development and testing

Examples

Basic Usage

/exit
Immediately exits the current world and returns to the main menu.

Scripted Exit

You can also trigger the exit action from Lua scripts:
-- Exit world after completing a task
event.on("server:OnConsoleMessage", function(ctx)
    local pkt = ctx:parse()
    if pkt.msg:find("Task completed") then
        -- Send exit packet
        local exit_pkt = QuitToExit.new()
        send.to_client(exit_pkt)
    end
end)

Implementation Details

The command is implemented in /home/daytona/workspace/source/src/command/commands/exit_command.hpp:7-18.
class ExitCommand final : public ICommand {
public:
    [[nodiscard]] std::string_view name() const override { return "exit"; }
    [[nodiscard]] std::string description() const override { 
        return "Exit the current world."; 
    }

    Result execute(const Context& ctx) override {
        packet::message::QuitToExit pkt{};
        packet::PacketHelper::write(pkt, ctx.client);
        return Result::Success;
    }
};
The command creates a QuitToExit packet and sends it to the client, which triggers the exit action.

Behavior

  • Result: Always returns Success
  • Side effects: Disconnects from current world, returns to main menu
  • Network: Sends packet to client only (not to server)

/warp

Warp to a different world

/help

Show all available commands