Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 594d33a

Browse files
Merge pull request #1680 from livecode/bugfix-tutorial_issues
[[ Tutorial ]] Fix some issues with scripting steps
2 parents 5bd6668 + 833538a commit 594d33a

2 files changed

Lines changed: 30 additions & 6 deletions

File tree

Toolset/palettes/script editor/behaviors/revsestackbehavior.livecodescript

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,6 +2951,10 @@ on revSEIndentScript
29512951
dispatch "scriptFormat" to field "Script" of me with "script"
29522952
end revSEIndentScript
29532953

2954+
on revSEApply pIgnoreErrors
2955+
actionCompile pIgnoreErrors
2956+
end revSEApply
2957+
29542958
private command appendToList @xList, pValue
29552959
if xList is not empty then
29562960
put return & pValue after xList

Toolset/palettes/tutorial/revtutorial.livecodescript

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)