Skip to content
TheChatArchiveThe Chat Archive
Qwenqwen3-235b-a22b-no-thinking· Alibaba (Qwen)Hugging Face LMArena Human Preference 140K

Es soll in der roblox comand box funktionieren

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with o3-2025-04-16’s answer.
  1. User

    Es soll in der roblox comand box funktionieren

  2. Qwen Assistant

    Ah, verstehe! Du möchtest, dass der Simulator in Roblox funktioniert, und zwar über eine Command-Box, also z.B. in einem Spiel, in dem Spieler Befehle in einen Chat oder eine GUI-Textbox eingeben können. Die KI soll dann auf diese Befehle reagieren oder sogar autonom Entscheidungen treffen, z.B. um NPCs oder Spiellogik zu steuern.

    Da Roblox mit Lua programmiert wird (im Roblox Studio), müssen wir den Simulator und die KI-Logik in Lua schreiben.


    ✅ Ziel:

    Ein einfacher Simulator in Roblox Lua, der:

    • Befehle aus einer Command-Box entgegennimmt (z.B. /move north)
    • diese Befehle interpretiert
    • die KI entscheiden lässt (auch autonom)
    • und Aktionen ausführt (z.B. ein Part bewegen)

    🧱 Grundstruktur des Projekts in Roblox:

    1. Roblox-Objekte im Explorer (Struktur):

    • Workspace
      • SimulatorPart (ein Part, der sich bewegen soll)
    • StarterGui
      • CommandBox (TextBox, wo Spieler Befehle eingeben)

    🧠 Lua-Code: Serverseitig (im ServerScriptService)

    -- ServerScriptService/SimulatorScript.lua
    
    local simulatorPart = workspace:FindFirstChild("SimulatorPart")
    if not simulatorPart then
        warn("SimulatorPart nicht gefunden!")
        return
    end
    
    local obstacles = {} -- Hindernisse können hier definiert werden
    local goal = Vector3.new(10, 0, 10) -- Zielposition
    
    local state = {
        position = simulatorPart.Position,
        obstacles = obstacles,
        goal = goal
    }
    
    -- Funktion: Befehl verarbeiten
    local function processCommand(command)
        local action = nil
        if command:lower() == "/move north" then
            action = "north"
        elseif command:lower() == "/move south" then
            action = "south"
        elseif command:lower() == "/move east" then
            action = "east"
        elseif command:lower() == "/move west" then
            action = "west"
        elseif command:lower() == "/start ai" then
            print("KI wird gestartet...")
            spawn(function()
                while true do
                    local aiAction = autonomousDecision()
                    if aiAction then
                        moveSimulator(aiAction)
                    else
                        print("Keine Aktion möglich.")
                    end
                    wait(1) -- Alle 1 Sekunde eine Aktion
                end
            end)
            return
        else
            print("Unbekannter Befehl.")
            return
        end
    
        moveSimulator(action)
    end
    
    -- Funktion: Simulator bewegen
    local function moveSimulator(direction)
        local step = 5
        local pos = simulatorPart.Position
    
        if direction == "north" then
            simulatorPart.Position = pos + Vector3.new(0, 0, -step)
        elseif direction == "south" then
            simulatorPart.Position = pos + Vector3.new(0, 0, step)
        elseif direction == "east" then
            simulatorPart.Position = pos + Vector3.new(step, 0, 0)
        elseif direction == "west" then
            simulatorPart.Position = pos + Vector3.new(-step, 0, 0)
        end
    
        print("Neue Position:", simulatorPart.Position)
    end
    
    -- Funktion: Autonome Entscheidung (KI)
    local function autonomousDecision()
        local pos = simulatorPart.Position
        local goalPos = goal
    
        if pos.X < goalPos.X then return "east"
        elseif pos.X > goalPos.X then return "west"
        elseif pos.Z < goalPos.Z then return "north"
        elseif pos.Z > goalPos.Z then return "south"
        else
            return nil -- Ziel erreicht
        end
    end
    
    -- GUI-Event: CommandBox
    game.Players.PlayerAdded:Connect(function(player)
        player.Chatted:Connect(function(message, recipient)
            if recipient == nil then
                processCommand(message)
            end
        end)
    end)
    

    📦 Clientseitig (optional): CommandBox im StarterGui

    Du kannst eine TextBox im StarterGui platzieren und per LocalScript den eingegebenen Text an den Server senden.


    🧪 Testen

    1. Füge einen Part namens SimulatorPart in den Workspace ein.
    2. Starte das Spiel.
    3. Gib im Chat ein:
      • /move north
      • /move east
      • /start ai

    Die KI versucht dann, den Part zum Ziel (Vector3.new(10, 0, 10)) zu bewegen.


    🚀 Erweiterungsideen

    • Hindernisse erkennen (mit Touched oder Raycasting)
    • GUI mit einer echten Textbox (statt Chat)
    • KI lernt aus Fehlern (z.B. mit Pfadfindungsalgorithmus)
    • Befehle wie /setgoal x y z hinzufügen

    ✅ Fazit

    Du hast jetzt einen funktionierenden Simulator in Roblox, der:

    • Befehle aus dem Chat verarbeitet
    • Aktionen ausführt
    • Und autonom Entscheidungen trifft

    Wenn du möchtest, kann ich dir auch zeigen, wie du eine echte CommandBox (GUI) baust oder wie du KI mit Pfadfindung (z.B. A*) einbaust.

    Möchtest du das? 😊

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.