File tree Expand file tree Collapse file tree 6 files changed +33
-724
lines changed Expand file tree Collapse file tree 6 files changed +33
-724
lines changed Original file line number Diff line number Diff line change @@ -543,16 +543,21 @@ const IWSY = (container, text) => {
543
543
}
544
544
} ;
545
545
546
- // Scan the script
547
- const scan = ( ) => {
548
- script . speed = `scan` ;
546
+ // Remove all the blocks from the player
547
+ const removeBlocks = ( ) => {
549
548
for ( const name in script . blocks ) {
550
549
const block = script . blocks [ name ] ;
551
550
if ( block . element ) {
552
551
container . removeChild ( block . element ) ;
553
552
block . element = null ;
554
553
}
555
554
}
555
+ } ;
556
+
557
+ // Scan the script
558
+ const scan = ( ) => {
559
+ script . speed = `scan` ;
560
+ removeBlocks ( ) ;
556
561
doStep ( script . steps [ 0 ] ) ;
557
562
} ;
558
563
@@ -629,6 +634,7 @@ const IWSY = (container, text) => {
629
634
630
635
// Replace the script
631
636
const setScript = newScript => {
637
+ removeBlocks ( ) ;
632
638
script = newScript ;
633
639
initScript ( ) ;
634
640
initBlocks ( ) ;
Original file line number Diff line number Diff line change 27
27
variable Properties
28
28
variable SelectedBlock
29
29
variable Action
30
+ variable Message
30
31
variable N
31
32
variable B
32
33
@@ -205,4 +206,10 @@ SaveSelectedBlock:
205
206
set property BlockName of Blocks to Block
206
207
end
207
208
set property `blocks` of Presentation to Blocks
209
+
210
+ ! Tell the parent to refresh the script
211
+ set Message to object
212
+ set property `action` of Message to `refresh`
213
+ set property `source` of Message to `blocks`
214
+ send Message to parent
208
215
return
Original file line number Diff line number Diff line change 24
24
variable ItemName
25
25
variable SelectedItem
26
26
variable Action
27
+ variable Message
27
28
variable N
28
29
variable B
29
30
@@ -173,4 +174,10 @@ SaveSelectedItem:
173
174
set property ItemName of Items to Item
174
175
end
175
176
set property `content` of Presentation to Items
177
+
178
+ ! Tell the parent to refresh the script
179
+ set Message to object
180
+ set property `action` of Message to `refresh`
181
+ set property `source` of Message to `content`
182
+ send Message to parent
176
183
return
Original file line number Diff line number Diff line change 47
47
variable Item
48
48
variable CurrentScriptName
49
49
variable Action
50
+ variable Source
50
51
variable N
51
52
52
53
! The browser
318
319
put the message into Message
319
320
put property `action` of Message into Action
320
321
if Action is `goto` iwsy goto property `index` of Message
321
- else if Action is `script` iwsy script property `script` of Message
322
+ else if Action is `refresh`
323
+ begin
324
+ iwsy script Presentation
325
+ gosub to UpdateCurrentSection
326
+ end
322
327
end
323
328
stop
324
329
Original file line number Diff line number Diff line change @@ -934,8 +934,10 @@ SaveCurrentStep:
934
934
end
935
935
set element SelectedStep of Steps to CurrentStep
936
936
set property `steps` of Presentation to Steps
937
+
938
+ ! Tell the parent to refresh the script
937
939
set Message to object
938
- set property `action` of Message to `script `
939
- set property `script ` of Message to Presentation
940
+ set property `action` of Message to `refresh `
941
+ set property `source ` of Message to `steps`
940
942
send Message to parent
941
943
return
You can’t perform that action at this time.
0 commit comments