import { Plus, Trash2 } from 'lucide-react'; import type { NPCConfiguration, MoLangConfigVariable } from '../types/npc'; interface ConfigVariablesEditorProps { config: NPCConfiguration; onChange: (config: NPCConfiguration) => void; } export function ConfigVariablesEditor({ config, onChange }: ConfigVariablesEditorProps) { const addVariable = () => { const newVariable: MoLangConfigVariable = { variableName: '', displayName: '', description: '', type: 'TEXT', defaultValue: '' }; onChange({ ...config, config: [...config.config, newVariable] }); }; const removeVariable = (index: number) => { onChange({ ...config, config: config.config.filter((_, i) => i !== index) }); }; const updateVariable = (index: number, field: keyof MoLangConfigVariable, value: any) => { const newConfig = [...config.config]; newConfig[index] = { ...newConfig[index], [field]: value }; onChange({ ...config, config: newConfig }); }; return (

Configuration Variables

Configuration variables allow for customizable NPC behavior through MoLang expressions. These variables can be referenced in dialogues, scripts, and other configurations.

{config.config.length === 0 ? (
No configuration variables defined. Click "Add Variable" to create one.
) : (
{config.config.map((variable, index) => (

Variable {index + 1}

updateVariable(index, 'variableName', e.target.value)} className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" placeholder="challenge_cooldown" />

Internal identifier for the variable

updateVariable(index, 'displayName', e.target.value)} className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500" placeholder="Challenge Cooldown" />

Human-readable name shown in UI