From 740db6cdc08a2a94a9026512fcdfedb0af137564 Mon Sep 17 00:00:00 2001 From: Shush Date: Sat, 22 Nov 2025 22:57:05 +0200 Subject: [PATCH 1/3] Add verbose script action texts to script actions list --- .../Config/Default/ScriptActions.ini | 2 - src/TSMapEditor/UI/Windows/ScriptsWindow.cs | 69 ++++++++++++++++++- 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/TSMapEditor/Config/Default/ScriptActions.ini b/src/TSMapEditor/Config/Default/ScriptActions.ini index f27d62ec..d8d1d31e 100644 --- a/src/TSMapEditor/Config/Default/ScriptActions.ini +++ b/src/TSMapEditor/Config/Default/ScriptActions.ini @@ -143,12 +143,10 @@ ParamType=Waypoint [ChangeScript] Name=Change Script Description=Instructs the team to execute another script. -ParamType=ScriptType [ChangeTeam] Name=Change Team Description=Instructs the TaskForce to join another TeamType. -ParamType=TeamType [Panic] Name=Panic diff --git a/src/TSMapEditor/UI/Windows/ScriptsWindow.cs b/src/TSMapEditor/UI/Windows/ScriptsWindow.cs index 574c30ab..f5224136 100644 --- a/src/TSMapEditor/UI/Windows/ScriptsWindow.cs +++ b/src/TSMapEditor/UI/Windows/ScriptsWindow.cs @@ -634,6 +634,8 @@ private void SetParameterEntryText(ScriptActionEntry scriptActionEntry, ScriptAc return; } + lbActions.SelectedItem.Text = GetActionEntryText(scriptActionEntry.Action, scriptActionEntry); + if (action.ParamType == TriggerParamType.BuildingWithProperty) { tbParameterValue.Text = GetBuildingWithPropertyText(scriptActionEntry.Argument); @@ -860,11 +862,72 @@ private void EditScript(Script script) private string GetActionEntryText(int index, ScriptActionEntry entry) { - ScriptAction action = GetScriptAction(entry.Action); + string actionEntryText; + string textDetails = null; + + ScriptAction action = GetScriptAction(entry.Action); if (action == null) - return "#" + index + " - Unknown (" + entry.Argument.ToString(CultureInfo.InvariantCulture) + ")"; + { + actionEntryText = $"#{index} - Unknown"; + textDetails = $"({ entry.Argument.ToString(CultureInfo.InvariantCulture)})"; + } + else + { + actionEntryText = $"#{index} - {action.Name}"; + int presetOptionIndex = action.PresetOptions.FindIndex(presetOption => presetOption.Value == entry.Argument); + bool hasValidPresetOption = presetOptionIndex > -1; + + switch (action.ParamType) + { + case TriggerParamType.BuildingWithProperty: + var (buildingTypeIndex, property) = SplitBuildingWithProperty(entry.Argument); + string propertyDescription = property.ToDescription(); + BuildingType buildingType = map.Rules.BuildingTypes.GetElementIfInRange(buildingTypeIndex); + + if (buildingType != null) + textDetails = $"({buildingType.GetEditorDisplayName()} - {propertyDescription})"; + break; + + case TriggerParamType.LocalVariable: + var localVar = map.LocalVariables.GetElementIfInRange(entry.Argument); + if (localVar != null) + textDetails = $"({localVar.Name})"; + break; + + case TriggerParamType.HouseType: + var houseType = map.Houses.GetElementIfInRange(entry.Argument); + if (houseType != null) + textDetails = $"({houseType.ININame})"; + break; + + case TriggerParamType.Animation: + var animation = map.Rules.AnimTypes.GetElementIfInRange(entry.Argument); + if (animation != null) + textDetails = $"({animation.ININame})"; + break; + + case TriggerParamType.Unknown: + // special handling: script actions that have no type but still have presets should be handled by showing the preset value + // otherwise we'll show no text after the name of the action + if (hasValidPresetOption) + goto default; + + textDetails = null; + break; + + default: + if (hasValidPresetOption) + textDetails = $"({action.PresetOptions[presetOptionIndex].Text})"; + else + textDetails = $"({entry.Argument.ToString(CultureInfo.InvariantCulture)})"; + break; + } + } + + if (string.IsNullOrEmpty(textDetails)) + return actionEntryText; - return "#" + index + " - " + action.Name + " (" + entry.Argument.ToString(CultureInfo.InvariantCulture) + ")"; + return $"{actionEntryText} {textDetails}"; } private string GetActionNameFromIndex(int index) From d15978089e234481bbdd0a0cb09d5e4843b0bf01 Mon Sep 17 00:00:00 2001 From: Shush Date: Fri, 28 Nov 2025 16:03:50 +0200 Subject: [PATCH 2/3] Add local var index to local env text --- src/TSMapEditor/UI/Windows/ScriptsWindow.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TSMapEditor/UI/Windows/ScriptsWindow.cs b/src/TSMapEditor/UI/Windows/ScriptsWindow.cs index f5224136..117b2e90 100644 --- a/src/TSMapEditor/UI/Windows/ScriptsWindow.cs +++ b/src/TSMapEditor/UI/Windows/ScriptsWindow.cs @@ -865,7 +865,7 @@ private string GetActionEntryText(int index, ScriptActionEntry entry) string actionEntryText; string textDetails = null; - ScriptAction action = GetScriptAction(entry.Action); + ScriptAction action = GetScriptAction(entry.Action); if (action == null) { actionEntryText = $"#{index} - Unknown"; @@ -891,7 +891,7 @@ private string GetActionEntryText(int index, ScriptActionEntry entry) case TriggerParamType.LocalVariable: var localVar = map.LocalVariables.GetElementIfInRange(entry.Argument); if (localVar != null) - textDetails = $"({localVar.Name})"; + textDetails = $"({localVar.Index} - {localVar.Name})"; break; case TriggerParamType.HouseType: From 3662f04f11670e01da93f6a100919caee8b4cc41 Mon Sep 17 00:00:00 2001 From: Shush Date: Sat, 17 Jan 2026 18:02:45 +0200 Subject: [PATCH 3/3] Added index preview in front of parameter text --- src/TSMapEditor/UI/Windows/ScriptsWindow.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TSMapEditor/UI/Windows/ScriptsWindow.cs b/src/TSMapEditor/UI/Windows/ScriptsWindow.cs index 75e1eca6..959f5308 100644 --- a/src/TSMapEditor/UI/Windows/ScriptsWindow.cs +++ b/src/TSMapEditor/UI/Windows/ScriptsWindow.cs @@ -969,7 +969,7 @@ private string GetActionEntryText(int index, ScriptActionEntry entry) BuildingType buildingType = map.Rules.BuildingTypes.GetElementIfInRange(buildingTypeIndex); if (buildingType != null) - textDetails = $"({buildingType.GetEditorDisplayName()} - {propertyDescription})"; + textDetails = $"({buildingType.Index} - {buildingType.GetEditorDisplayName()} - {propertyDescription})"; break; case TriggerParamType.LocalVariable: @@ -981,13 +981,13 @@ private string GetActionEntryText(int index, ScriptActionEntry entry) case TriggerParamType.HouseType: var houseType = map.Houses.GetElementIfInRange(entry.Argument); if (houseType != null) - textDetails = $"({houseType.ININame})"; + textDetails = $"({houseType.ID} - {houseType.ININame})"; break; case TriggerParamType.Animation: var animation = map.Rules.AnimTypes.GetElementIfInRange(entry.Argument); if (animation != null) - textDetails = $"({animation.ININame})"; + textDetails = $"({animation.Index} - {animation.ININame})"; break; case TriggerParamType.Unknown: @@ -1001,7 +1001,7 @@ private string GetActionEntryText(int index, ScriptActionEntry entry) default: if (hasValidPresetOption) - textDetails = $"({action.PresetOptions[presetOptionIndex].Text})"; + textDetails = $"({presetOptionIndex} - {action.PresetOptions[presetOptionIndex].Text})"; else textDetails = $"({entry.Argument.ToString(CultureInfo.InvariantCulture)})"; break;