// Logic 2 from King's Quest 1 // Note: Some variable names have been changed to make the script // more self-explanatory #include "defines.txt" #define croc1 o11 #define croc2 o12 #define doors o2 #define flags o1 #define death_timer v31 if (isset(new_room)) { load.pic(room_no); draw.pic(room_no); discard.pic(room_no); load.logics(101); set.horizon(50); load.sound(15); if (isset(f75)) { load.logics(103); load.view(9); add.to.pic(9,0,0,105,120,0,0); } if (v65 == room_no) { add.to.pic(62,0,0,36,86,0,0); } if (!isset(f75)) { load.view(9); animate.obj(doors); set.view(doors,9); position(doors,105,120); if (prev_room_no == 55) { set.cel(doors,2); } else { set.cel(doors,0); } draw(doors); stop.update(doors); } load.view(107); load.view(97); animate.obj(croc1); animate.obj(croc2); animate.obj(flags); set.view(croc1,107); set.view(croc2,107); set.view(flags,97); position(croc1,121,161); position(croc2,73,166); ignore.horizon(flags); position(flags,115,17); set.priority(flags,15); set(f68); object.on.water(croc1); object.on.water(croc2); ignore.blocks(ego); draw(croc1); draw(croc2); draw(flags); if (prev_room_no == 55) { position(ego,110,122); set(f26); } if (prev_room_no == 3) { get.posn(ego,v60,v61); if (v61 > 150) { position(ego,2,150); } } draw(ego); call(101); wander(croc1); wander(croc2); show.pic(); } if (said("look","room")) { print("You are standing outside a castle surrounded by an alligator filled " "moat."); } if (isset(f26)) { reset(f26); start.update(doors); reverse.loop(doors,f25); } if (isset(f25) && !isset(f27)) { stop.update(doors); } if (said("pet","alligator")) { print("What! Are you crazy?"); } if (said("look","bridge")) { print("It is a rather small, wooden bridge."); } if (said("look","flags")) { print("High above the castle, the flags are waving in the wind."); } if (said("look","castle")) { print("King Edward the Benevolent, the mighty ruler of Daventry, lives in " "this castle."); } if (said("look","moat")) { print("You never know what might be in there!"); } if (said("look","water")) { print("It's your typical moat water: murky and smelly."); } if (said("look","flowers")) { print("They are absolutely gorgeous!"); } if ((said("get","flowers") || said("steal","flowers"))) { print("King Edward does not allow anyone to take his flowers."); } if (said("look","alligator")) { print("These alligators have protected the castle from many a trespasser."); } if (said("enter","castle")) { if (isset(f25)) { print("You must enter the castle through the door, and the door is closed."); } } if (said("close","door")) { print("The door is already closed."); } if (said("look","door")) { if (posn(ego,0,120,159,167)) { print("These doors are strongly built to keep out unwanted visitors."); } else { print("You can't see them from here."); } } if (said("anyword","lion")) { if (posn(ego,0,128,159,167)) { print("They pose as immovable guards for King Edward's castle, and have " "frightened off numerous intruders."); } else { print("You can't see them from here."); } } if (isset(f75)) { if (said("open","door")) { if (posn(ego,105,120,121,128)) { print("Since the goat is with you, permission to enter the castle is " "denied."); } else { print("You cannot reach the door from here."); } goto(Label1); } } if (isset(f125)) { if (said("open","door")) { if (posn(ego,105,120,121,128)) { if (v74 == 3) { print("You have been to the castle once since your quest and are not " "allowed to return again."); } else { print("You have been to the castle once and you may not return until " "your quest is complete."); } } else { print("You cannot reach the door from here."); } goto(Label1); } } if (said("knock","door")) { if (posn(ego,105,120,121,128)) { print("Your knock echos within the castle. Unfortunately, no one answers."); } else { print("You cannot reach the door from here."); } } if (!isset(f75) && !isset(f125)) { if (said("open","door")) { if (posn(ego,105,120,121,128)) { set(f27); start.update(doors); sound(15,f28); end.of.loop(doors,f24); stop.motion(ego); set.priority(ego,15); print("The huge doors swing open slowly."); if (!isset(f193)) { set(f193); score += 1; goto(Label1); } if (!isset(f206)) { set(f206); score += 1; } } else { print("You cannot reach the door from here."); } } } if (isset(f24) && isset(f28)) { new.room(55); } if (said("drink","water") && !isset(f88) && !isset(f116)) { if ((posn(ego,0,143,159,167) || posn(ego,40,108,74,142))) { print("As you kneel by the edge of the moat and see just how filthy the " "water is, your thirst strangely leaves you."); } else { print("You are not close enough to any water."); } } if (isset(f81) && !isset(f88)) { if (said("get","water")) { if ((posn(ego,0,143,159,167) || posn(ego,40,108,74,142))) { reset(f116); print("Although you notice the water is unclean, you fill the bucket."); get("water"); set(f88); if (!isset(f91)) { set(f91); score += 2; } } else { print("You are not close enough to any water."); } } } if (isset(ego_touching_signal_line)) { set(ego_on_water); } if (v94 <= 0 && isset(ego_on_water)) { v76 = 255; ignore.objs(ego); if (posn(ego,9,145,44,167)) { v76 = 27; v77 = 166; } if (posn(ego,45,159,69,167)) { v76 = 50; v77 = 166; } if (posn(ego,70,159,94,167)) { v76 = 75; v77 = 166; } if (posn(ego,95,159,122,167)) { v76 = 103; v77 = 166; } if (posn(ego,123,159,159,167)) { v76 = 133; v77 = 166; } if (posn(ego,50,110,70,144)) { set.priority(ego,5); v76 = 56; v77 = 130; } if (v76 == 255) { v76 = 0; } else { get.posn(ego,v60,v61); v76 -= v60; v77 -= v61; set(f134); } } if (isset(ego_on_water)) { if ((said("get out","moat") || said("exit","moat"))) { print("The moats slippery sides prevent you from getting out."); } } if (isset(ego_on_water) && !isset(f23)) { program.control(); stop.motion(ego); follow.ego(croc1,18,f20); follow.ego(croc2,18,f21); set(f23); } if (posn(ego,61,135,63,137) && !isset(f22)) { print("Misfortune strikes and you have fallen into the moat. Your struggles " "and cries have attracted hungry alligators. They do not want to let " "you go."); set(f22); death_timer = 45; } if (isset(f20) && !isset(f22)) { print("Misfortune strikes and you have fallen into the moat. Your struggles " "and cries have attracted hungry alligators. They do not want to let " "you go."); set(f22); death_timer = 45; } if (isset(f21) && !isset(f22)) { print("Misfortune strikes and you have fallen into the moat. Your struggles " "and cries have attracted hungry alligators. They do not want to let " "you go."); set(f22); death_timer = 45; } if (isset(f22) && death_timer < 1) { erase(ego); if (isset(f20)) { erase(croc1); } if (isset(f21)) { erase(croc2); } set(f63); } death_timer--; Label1: if (ego_edge_code != no_edge) { reset(f68); } if (ego_edge_code == horizon_edge) { new.room(15); } if (ego_edge_code == right_edge) { new.room(1); } if (ego_edge_code == left_edge) { new.room(3); } if (isset(f75)) { call(103); } call(101); return();