@@ -2100,8 +2100,8 @@ on revTutorialDoLoad pLesson
21002100 revTutorialRunTutorial tTutorialInfo ["course" ], tTutorialInfo ["tutorial" ], pLesson , tTutorialInfo ["location" ]
21012101end revTutorialDoLoad
21022102
2103- on revTutorialSetText pStep
2104- revTutorialConfigureMessage sSteps [pStep ]
2103+ on revTutorialSetText pStep, pTopLeft
2104+ revTutorialConfigureMessage sSteps [pStep ], pTopLeft
21052105end revTutorialSetText
21062106
21072107on revTutorialConfigureMessage pData, pTopLeft
@@ -2454,6 +2454,7 @@ on revTutorialWaitUntilObjectIsScripted pTaggedObject
24542454 revTutorialSetSEPreference "explicitVariables" , false
24552455
24562456 revIDESubscribe "idePropertyChanged" , tObjID
2457+ revIDESubscribe "ideScriptEdited"
24572458end revTutorialWaitUntilObjectIsScripted
24582459
24592460on revTutorialWaitUntilObjectIsClicked
@@ -3029,6 +3030,52 @@ on idePropertyChanged pObject
30293030 end if
30303031end idePropertyChanged
30313032
3033+ local sScriptCheck
3034+ on revTutorialCheckScript pScript, pObject
3035+ if revTutorialObjectIsTaggedObject(pObject , sWait ["object" ]) then
3036+ if sWait ["wait condition" ] is "state" and \
3037+ sWait ["state" ] is "scripted" then
3038+ revTutorialCompareScript pScript , sWait ["script" ]
3039+ lock screen
3040+ if the result is empty and sWait ["correct script" ] is not true then
3041+ -- If the currently typed script is correct, then
3042+ -- remind about clicking Apply
3043+ -- Remember the chosen location
3044+ put revTutorialGetEffectiveTopLeft() into sScriptCheck ["topleft" ]
3045+ put true into sScriptCheck ["correct script" ]
3046+ put "Apply" into sHighlight ["object" ]
3047+ put "object" into sHighlight ["type" ]
3048+ local tData
3049+ put "Click 'Apply' to apply the script" into tData ["text" ]
3050+ revTutorialConfigureMessage tData
3051+ else if sScriptCheck ["correct script" ] is true then
3052+ -- Otherwise, the script has been changed from the correct one
3053+ put false into sScriptCheck ["correct script" ]
3054+ -- Reset the highlight
3055+ put "stack" into sHighlight ["type" ]
3056+ -- Reset the text
3057+ revTutorialSetText sStepName , sScriptCheck ["topleft" ]
3058+ end if
3059+ unlock screen
3060+ end if
3061+ end if
3062+ end revTutorialCheckScript
3063+
3064+ local sCheckScriptMsg
3065+ constant kCheckBufferMS = 800
3066+ on ideScriptEdited pScript, pObject
3067+ -- In order to mitigate against forgetting to press the
3068+ -- apply button, we subscribe to ideScriptEdited and check
3069+ -- to see if the script entered is correct. However, we
3070+ -- don't want to interrupt the flow of typing, so add a
3071+ -- buffer
3072+ if sCheckScriptMsg is not empty then
3073+ cancel sCheckScriptMsg
3074+ end if
3075+ send "revTutorialCheckScript pScript, pObject" to me in kCheckBufferMS millisecs
3076+ put the result into sCheckScriptMsg
3077+ end ideScriptEdited
3078+
30323079on ideStackMoved pStack
30333080 local tStack
30343081 put revIDEStackOfObject(pStack ) into tStack
0 commit comments