@@ -634,6 +634,8 @@ private void SetParameterEntryText(ScriptActionEntry scriptActionEntry, ScriptAc
634634 return ;
635635 }
636636
637+ lbActions . SelectedItem . Text = GetActionEntryText ( scriptActionEntry . Action , scriptActionEntry ) ;
638+
637639 if ( action . ParamType == TriggerParamType . BuildingWithProperty )
638640 {
639641 tbParameterValue . Text = GetBuildingWithPropertyText ( scriptActionEntry . Argument ) ;
@@ -860,11 +862,72 @@ private void EditScript(Script script)
860862
861863 private string GetActionEntryText ( int index , ScriptActionEntry entry )
862864 {
863- ScriptAction action = GetScriptAction ( entry . Action ) ;
865+ string actionEntryText ;
866+ string textDetails = null ;
867+
868+ ScriptAction action = GetScriptAction ( entry . Action ) ;
864869 if ( action == null )
865- return "#" + index + " - Unknown (" + entry . Argument . ToString ( CultureInfo . InvariantCulture ) + ")" ;
870+ {
871+ actionEntryText = $ "#{ index } - Unknown";
872+ textDetails = $ "({ entry . Argument . ToString ( CultureInfo . InvariantCulture ) } )";
873+ }
874+ else
875+ {
876+ actionEntryText = $ "#{ index } - { action . Name } ";
877+ int presetOptionIndex = action . PresetOptions . FindIndex ( presetOption => presetOption . Value == entry . Argument ) ;
878+ bool hasValidPresetOption = presetOptionIndex > - 1 ;
879+
880+ switch ( action . ParamType )
881+ {
882+ case TriggerParamType . BuildingWithProperty :
883+ var ( buildingTypeIndex , property ) = SplitBuildingWithProperty ( entry . Argument ) ;
884+ string propertyDescription = property . ToDescription ( ) ;
885+ BuildingType buildingType = map . Rules . BuildingTypes . GetElementIfInRange ( buildingTypeIndex ) ;
886+
887+ if ( buildingType != null )
888+ textDetails = $ "({ buildingType . GetEditorDisplayName ( ) } - { propertyDescription } )";
889+ break ;
890+
891+ case TriggerParamType . LocalVariable :
892+ var localVar = map . LocalVariables . GetElementIfInRange ( entry . Argument ) ;
893+ if ( localVar != null )
894+ textDetails = $ "({ localVar . Name } )";
895+ break ;
896+
897+ case TriggerParamType . HouseType :
898+ var houseType = map . Houses . GetElementIfInRange ( entry . Argument ) ;
899+ if ( houseType != null )
900+ textDetails = $ "({ houseType . ININame } )";
901+ break ;
902+
903+ case TriggerParamType . Animation :
904+ var animation = map . Rules . AnimTypes . GetElementIfInRange ( entry . Argument ) ;
905+ if ( animation != null )
906+ textDetails = $ "({ animation . ININame } )";
907+ break ;
908+
909+ case TriggerParamType . Unknown :
910+ // special handling: script actions that have no type but still have presets should be handled by showing the preset value
911+ // otherwise we'll show no text after the name of the action
912+ if ( hasValidPresetOption )
913+ goto default ;
914+
915+ textDetails = null ;
916+ break ;
917+
918+ default :
919+ if ( hasValidPresetOption )
920+ textDetails = $ "({ action . PresetOptions [ presetOptionIndex ] . Text } )";
921+ else
922+ textDetails = $ "({ entry . Argument . ToString ( CultureInfo . InvariantCulture ) } )";
923+ break ;
924+ }
925+ }
926+
927+ if ( string . IsNullOrEmpty ( textDetails ) )
928+ return actionEntryText ;
866929
867- return "#" + index + " - " + action . Name + " (" + entry . Argument . ToString ( CultureInfo . InvariantCulture ) + ") ";
930+ return $ " { actionEntryText } { textDetails } ";
868931 }
869932
870933 private string GetActionNameFromIndex ( int index )
0 commit comments