From 15def09485e654233faf22d0a255605ba27d3f50 Mon Sep 17 00:00:00 2001 From: Guillaume Huysmans Date: Mon, 19 Jul 2021 18:02:31 +0200 Subject: [PATCH] forgot to port two examples --- demos/zork_mini.html | 14 +++++++------- hello_world.html | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/demos/zork_mini.html b/demos/zork_mini.html index 7cc5bd4..607d8c2 100644 --- a/demos/zork_mini.html +++ b/demos/zork_mini.html @@ -18,18 +18,18 @@

Mini Zork

var io2=new IOKranf('container2'); var status="naked"; -function *pageCourt() +async function pageCourt() { io.printhr(); new Audio("media/tetrisk_move.mp3").play(); io.printImage("media/zork_castle_court.jpg","300px"); io.println("\nYou are standing in the interior court of the castle."); - var x=yield io.click("Go to the Castle Gate","Enter the armory"); - if (x=="Enter the armory") co(pageArmory()); + var x=await io.click("Go to the Castle Gate","Enter the armory"); + if (x=="Enter the armory") await pageArmory(); else if (x=="Go to the Castle Gate") pageGate(); } -function *pageArmory() +async function pageArmory() { new Audio("media/tetrisk_move.mp3").play(); io.printhr(); @@ -37,7 +37,7 @@

Mini Zork

io.println("\nYou are in the armory.There are plenty of weapons and a bottle."); for(;;) { - var x=yield io.click("Take a weapon","Drink the bottle","Go back in the court"); + var x=await io.click("Take a weapon","Drink the bottle","Go back in the court"); if (x=="Take a weapon") { if (status=="naked") @@ -70,7 +70,7 @@

Mini Zork

} else if (x=="Go back in the court") break; } - co(pageCourt()); + await pageCourt(); } function pageGate() @@ -96,7 +96,7 @@

Mini Zork

io.autoScroll(true); io.println("OBJECTIVE: You need to escape from the castle.\n"); io2.printImage("media/zork_inventory1.png","120px"); - co(pageCourt()); + pageCourt(); } diff --git a/hello_world.html b/hello_world.html index 213f495..a8c3f32 100644 --- a/hello_world.html +++ b/hello_world.html @@ -11,11 +11,11 @@

Learn Javascript

+})();