Skip to content

Commit 8512965

Browse files
authored
forgot print and show (#3115)
1 parent 8489d13 commit 8512965

File tree

1 file changed

+39
-48
lines changed

1 file changed

+39
-48
lines changed

js/logo.js

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,10 @@ class Logo {
13691369
}
13701370
if (
13711371
logo.activity.turtles.ithTurtle(turtle).singer.inNoteBlock.length > 0 &&
1372+
logo.blockList[blk].connections[i] !== undefined &&
1373+
logo.blockList[
1374+
logo.blockList[blk].connections[i]
1375+
] !== undefined &&
13721376
logo.blockList[
13731377
logo.blockList[blk].connections[i]
13741378
].name === "currentpitch"
@@ -2055,31 +2059,48 @@ class Logo {
20552059
}
20562060
};
20572061

2058-
const __show = (turtle, arg1, arg2, timeout) => {
2062+
const __show = (turtle, b, timeout) => {
20592063
if (suppressOutput) return;
2060-
2064+
const arg1 = this.parseArg(
2065+
this,
2066+
turtle,
2067+
this.blockList[b].connections[1],
2068+
b,
2069+
this.receivedArg
2070+
);
2071+
const arg2 = this.parseArg(
2072+
this,
2073+
turtle,
2074+
this.blockList[b].connections[2],
2075+
b,
2076+
this.receivedArg
2077+
);
20612078
setTimeout(() => this.processShow(turtle, null, arg1, arg2), timeout);
20622079
};
20632080

2064-
const __speak = (turtle, arg, timeout) => {
2081+
const __speak = (turtle, b, timeout) => {
20652082
if (suppressOutput) return;
2066-
2083+
const arg = this.parseArg(
2084+
this,
2085+
turtle,
2086+
this.blockList[b].connections[1],
2087+
b,
2088+
this.receivedArg
2089+
);
20672090
setTimeout(() => this.processSpeak(arg), timeout);
20682091
};
20692092

2070-
const __print = (arg, b, timeout) => {
2093+
const __print = (turtle, b, timeout) => {
20712094
if (suppressOutput) return;
2095+
const arg = this.parseArg(
2096+
this,
2097+
turtle,
2098+
this.blockList[b].connections[1],
2099+
b,
2100+
this.receivedArg
2101+
);
20722102
if (arg === undefined) return;
2073-
setTimeout(() => {
2074-
const arg_ = this.parseArg(
2075-
this,
2076-
turtle,
2077-
this.blockList[b].connections[1],
2078-
b,
2079-
this.receivedArg
2080-
);
2081-
this.activity.textMsg(arg_.toString());
2082-
}, timeout);
2103+
setTimeout(() => this.activity.textMsg(arg.toString()), timeout);
20832104
};
20842105

20852106
const __arc = (turtle, b, waitTime, stepTime) => {
@@ -2330,8 +2351,6 @@ class Logo {
23302351
const b = tur.singer.embeddedGraphics[blk][i];
23312352
const name = this.blockList[b].name;
23322353

2333-
let arg, arg1, arg2;
2334-
23352354
switch (name) {
23362355
case "setcolor":
23372356
case "sethue":
@@ -2410,43 +2429,15 @@ class Logo {
24102429
break;
24112430

24122431
case "show":
2413-
arg1 = this.parseArg(
2414-
this,
2415-
turtle,
2416-
this.blockList[b].connections[1],
2417-
b,
2418-
this.receivedArg
2419-
);
2420-
arg2 = this.parseArg(
2421-
this,
2422-
turtle,
2423-
this.blockList[b].connections[2],
2424-
b,
2425-
this.receivedArg
2426-
);
2427-
__show(turtle, arg1, arg2, waitTime);
2432+
__show(turtle, b, waitTime);
24282433
break;
24292434

24302435
case "speak":
2431-
arg = this.parseArg(
2432-
this,
2433-
turtle,
2434-
this.blockList[b].connections[1],
2435-
b,
2436-
this.receivedArg
2437-
);
2438-
__speak(turtle, arg, waitTime);
2436+
__speak(turtle, b, waitTime);
24392437
break;
24402438

24412439
case "print":
2442-
arg = this.parseArg(
2443-
this,
2444-
turtle,
2445-
this.blockList[b].connections[1],
2446-
b,
2447-
this.receivedArg
2448-
);
2449-
__print(arg, b, waitTime);
2440+
__print(turtle, b, waitTime);
24502441
break;
24512442

24522443
case "arc":

0 commit comments

Comments
 (0)