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

Commit 499a11a

Browse files
committed
[[ Tutorial ]] Fix Apply 'do it for me'
Previously the tutorial would close the script editor before running the apply step. This uses the script editor commands to set the script / apply if the script editor is open, or just sets the script property if it is not (which will be the case if this is one of a series of skipped steps)
1 parent 1cae112 commit 499a11a

2 files changed

Lines changed: 20 additions & 5 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: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,11 +3834,22 @@ on revTutorialRunAction pActionData
38343834
case "state"
38353835
switch tWaitData["state"]
38363836
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"]
3837+
# See if the object has a script editor open
3838+
local tPalette, tObject
3839+
put revTutorialResolveObjectToLongID(tWaitData["object"]) into tObject
3840+
put revScriptEditor(tObject) into tPalette
3841+
if tPalette is not empty then
3842+
# If so, check the script. If correct, apply the script
3843+
if sScriptCheck["correct script"] then
3844+
dispatch "revSEApply" to stack tPalette with true
3845+
else
3846+
# Otherwise set the script
3847+
dispatch "revSESetScript" to stack tPalette with tWaitData["script"]
3848+
end if
3849+
else
3850+
# If there is no SE, just set the script of the objects directly
3851+
revTutorialSetPropertyOfObjects tObject, "script", tWaitData["script"]
3852+
end if
38423853
break
38433854
case "selected"
38443855
put revTutorialResolveObjectToLongID(tWaitData["object"]) into sSelected

0 commit comments

Comments
 (0)