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

Commit 1c40043

Browse files
committed
[[ Bug 20041 ]] Update tags & wait array when a stack name changes
1 parent 5680dc9 commit 1c40043

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

Toolset/palettes/tutorial/revtutorial.livecodescript

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,9 +1720,19 @@ on revInitialiseTutorial
17201720
revIDESetPreference "cToolbarIcons", true
17211721
revIDESetPreference "idePropertyInspector_labels", false
17221722

1723+
-- Ensure we know when stack names change
1724+
revIDESubscribe "ideNameChanged"
1725+
17231726
unlock screen
17241727
end revInitialiseTutorial
17251728

1729+
on ideNameChanged pOldName, pNewName, pTarget
1730+
if word 1 of pTarget is "stack" then
1731+
-- Update all our long IDs if we're tracking this stack
1732+
revTutorialStackNameChanged pOldName, pNewName
1733+
end if
1734+
end ideNameChanged
1735+
17261736
on revTutorialInitialiseStep
17271737
put false into sWaiting
17281738
put false into sIsInterlude
@@ -3401,6 +3411,24 @@ function revTutorialReparentChild pObject
34013411
return the long id of pObject
34023412
end revTutorialReparentChild
34033413

3414+
command revTutorialStackNameChanged pOldName, pNewName
3415+
-- Update the tagged objects
3416+
repeat for each key tType in sTaggedObjects
3417+
repeat for each key tTag in sTaggedObjects[tType]
3418+
replace "stack" && quote & pOldName & quote \
3419+
with "stack" && quote & pNewName & quote \
3420+
in sTaggedObjects[tType][tTag]
3421+
end repeat
3422+
end repeat
3423+
3424+
-- Update any wait state if we are waiting. Now that the tagged objects
3425+
-- are updated just call DoWait again with the current wait state.The
3426+
-- type/tag in the sWait array will resolve to the updated long ID
3427+
if sWait is not empty then
3428+
revTutorialDoWait sWait
3429+
end if
3430+
end revTutorialStackNameChanged
3431+
34043432
# Take a tutorial tagged object (an array with 'type' and 'tag' keys)
34053433
# and return the corresponding long ID (or list of long IDs for 'set' types)
34063434
function revTutorialResolveObjectToLongID pTaggedObject, pUpdate

notes/bugfix-20041.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Prevent tutorials breaking when stack name is changed

0 commit comments

Comments
 (0)