@@ -2247,6 +2247,9 @@ on revTutorialEnsureState pStep
22472247 case "palette for object"
22482248 revTutorialEnsurePaletteForObject tHighlightDataA ["palette" ], tHighlightDataA ["object" ]
22492249 break
2250+ case "script line"
2251+ revTutorialEnsurePaletteForObject "script editor" , tHighlightDataA ["object" ]
2252+ break
22502253 case "item of palette"
22512254 case "palette"
22522255 revTutorialEnsurePalette tHighlightDataA ["palette" ]
@@ -2447,11 +2450,17 @@ function revTutorialCheckWaitCondition pActionData, pBeforeDisplay
24472450 end if
24482451 break
24492452 case "scripted"
2453+ # Don't try and shortcut this step
2454+ if pBeforeDisplay then
2455+ break
2456+ end if
2457+
24502458 # This code path is triggered by any propertyChanged message,
24512459 # so if the script hasn't changed then don't do anything.
24522460 local tScript
24532461 put the script of tObject into tScript
2454- if tScript is sWait ["current script" ] then
2462+ revTutorialCompareScript tScript , sWait ["current script" ]
2463+ if the result is empty then
24552464 break
24562465 end if
24572466 local tMistake
@@ -3834,11 +3843,22 @@ on revTutorialRunAction pActionData
38343843 case "state"
38353844 switch tWaitData ["state" ]
38363845 case "scripted"
3837- # Everything becomes extremely sad if we already have a tab open for this script
3838- # and try to run a scripting step. So close the palette first.
3839- revTutorialClearPalette "script editor"
3840- # Set the script of the objects
3841- revTutorialSetPropertyOfObjects revTutorialResolveObjectToLongID(tWaitData ["object" ]), "script" , tWaitData ["script" ]
3846+ # See if the object has a script editor open
3847+ local tPalette , tObject
3848+ put revTutorialResolveObjectToLongID(tWaitData ["object" ]) into tObject
3849+ put revScriptEditor(tObject ) into tPalette
3850+ if tPalette is not empty then
3851+ # If so, check the script. If correct, apply the script
3852+ if sScriptCheck ["correct script" ] then
3853+ dispatch "revSEApply" to stack tPalette with true
3854+ else
3855+ # Otherwise set the script
3856+ dispatch "revSESetScript" to stack tPalette with tWaitData ["script" ]
3857+ end if
3858+ else
3859+ # If there is no SE, just set the script of the objects directly
3860+ revTutorialSetPropertyOfObjects tObject , "script" , tWaitData ["script" ]
3861+ end if
38423862 break
38433863 case "selected"
38443864 put revTutorialResolveObjectToLongID(tWaitData ["object" ]) into sSelected
0 commit comments