Skip to content

Commit 688af67

Browse files
authored
Merge pull request #85 from easycoder/dev
Development
2 parents 15c4302 + 0046af5 commit 688af67

File tree

6 files changed

+33
-724
lines changed

6 files changed

+33
-724
lines changed

iwsy/iwsy.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,16 +543,21 @@ const IWSY = (container, text) => {
543543
}
544544
};
545545

546-
// Scan the script
547-
const scan = () => {
548-
script.speed = `scan`;
546+
// Remove all the blocks from the player
547+
const removeBlocks = () => {
549548
for (const name in script.blocks) {
550549
const block = script.blocks[name];
551550
if (block.element) {
552551
container.removeChild(block.element);
553552
block.element = null;
554553
}
555554
}
555+
};
556+
557+
// Scan the script
558+
const scan = () => {
559+
script.speed = `scan`;
560+
removeBlocks();
556561
doStep(script.steps[0]);
557562
};
558563

@@ -629,6 +634,7 @@ const IWSY = (container, text) => {
629634

630635
// Replace the script
631636
const setScript = newScript => {
637+
removeBlocks();
632638
script = newScript;
633639
initScript();
634640
initBlocks();

iwsy/resources/ecs/blocks.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
variable Properties
2828
variable SelectedBlock
2929
variable Action
30+
variable Message
3031
variable N
3132
variable B
3233

@@ -205,4 +206,10 @@ SaveSelectedBlock:
205206
set property BlockName of Blocks to Block
206207
end
207208
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
208215
return

iwsy/resources/ecs/content.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
variable ItemName
2525
variable SelectedItem
2626
variable Action
27+
variable Message
2728
variable N
2829
variable B
2930

@@ -173,4 +174,10 @@ SaveSelectedItem:
173174
set property ItemName of Items to Item
174175
end
175176
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
176183
return

iwsy/resources/ecs/iwsy.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
variable Item
4848
variable CurrentScriptName
4949
variable Action
50+
variable Source
5051
variable N
5152

5253
! The browser
@@ -318,7 +319,11 @@ L2:
318319
put the message into Message
319320
put property `action` of Message into Action
320321
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
322327
end
323328
stop
324329

iwsy/resources/ecs/steps.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,10 @@ SaveCurrentStep:
934934
end
935935
set element SelectedStep of Steps to CurrentStep
936936
set property `steps` of Presentation to Steps
937+
938+
! Tell the parent to refresh the script
937939
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`
940942
send Message to parent
941943
return

0 commit comments

Comments
 (0)