Index / Orange System / last update: May 2002

Orange System | Starbase Hangman


Starbase Hangman (dbref #10447)

@dig Starbase Hangman
@set #10447 = jumpok
@set #10447 = linkok
@field #10447 = exit_0 : 10450
@field #10447 = nexits : 1
@field #10447 = varobj : 10451
@zone #10447 = #10719
@desc #10447 = @execute(@getfield("10451","description"))

northwest (dbref #10450)

@open northwest;nw;out;exit = #10325
@field #10450 = exitto : to Grand Gaming Central
@odrop #10450 = enters from the southeast.
@osucc #10450 = goes northwest.
@succe #10450 = You walk northwest...
@desc #10450 =

puzzle (dbref #10451)

@zone #10451 = #10719
@desc #10451 = @print("The category is '",
 @g(@print("cn_",@g(@print("pc_",@g("thepuznum"))))), "':%c");
 @strloop(@g(@print("pp_",@g("thepuznum"))),"x", @switch("%x",
 {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
 "P","Q","R","S","T","U","V","W","X","Y","Z"}, @g("val_%x"), "%x"));
 @print("%cLetters guessed:");
 @fieldloop("10451","val_", @switch("%v", "~", "", " %v"));
 @switch(@g("numwrong"), "0", "", @print("; #Wrong: ", @g("numwrong")));
 @print(".");
@field #10451 = cn_0 : Proverb
@field #10451 = cn_1 : It Came From the Recipe Box
@field #10451 = cn_2 : Book Title
@field #10451 = cn_3 : Stageplay
@field #10451 = cn_4 : Television Program
@field #10451 = cn_5 : Movie Title
@fail #10451 = No. The game stays here.
@field #10451 = gamestatus : won
@lock #10451 = #8796
@field #10451 = ncats : 6
@field #10451 = numwrong : 0
@field #10451 = npuzzles : 734
@field #10451 = noccur : 0
@field #10451 = nmissed : 0
// 734 puzzle-category fields (so far)
@field #10451 = pc_0 : 0
@field #10451 = pc_1 : 0
 ...etc...
// 734 puzzle-phrase fields (so far)
@field #10451 = pp_0 : A GOOD MAN IS HARD TO FIND
@field #10451 = pp_1 : WASTE NOT, WANT NOT
 ...etc...
@field #10451 = progcat : 5
@field #10451 = ptot_0 : 109
@field #10451 = ptot_1 : 47
@field #10451 = ptot_2 : 65
@field #10451 = ptot_3 : 38
@field #10451 = ptot_4 : 202
@field #10451 = ptot_5 : 273
@field #10451 = thenumpuz : 0
@field #10451 = thepuznum : 90
@field #10451 = val_a : ~
@field #10451 = val_b : ~
@field #10451 = val_c : ~
@field #10451 = val_d : ~
@field #10451 = val_e : ~
@field #10451 = val_f : ~
@field #10451 = val_g : ~
@field #10451 = val_h : ~
@field #10451 = val_i : ~
@field #10451 = val_j : ~
@field #10451 = val_k : ~
@field #10451 = val_l : ~
@field #10451 = val_m : ~
@field #10451 = val_n : ~
@field #10451 = val_o : ~
@field #10451 = val_p : ~
@field #10451 = val_q : ~
@field #10451 = val_r : ~
@field #10451 = val_s : ~
@field #10451 = val_t : ~
@field #10451 = val_u : ~
@field #10451 = val_v : ~
@field #10451 = val_w : ~
@field #10451 = val_x : ~
@field #10451 = val_y : ~
@field #10451 = val_z : ~

new game (dbref #10455)

@action new game;new;restart;restart game = puzzle : nowhere
@field #10455 = varobj : 10451
@succe #10455 = @s("numwrong","0"); @s("gamestatus","alive");
 @fieldloop("10451","val_",@s("%f","~"));
 @s("thepuznum",@rand(@g("npuzzles"))); @print("New game!%c");
 @execute(@g("description"));
@desc #10455 = Starts a new game with a new phrase.

guess * (dbref #10456)

@action guess *;try * = puzzle : nowhere
@set #10456 = puzzle
@field #10456 = varobj : 10451
@succe #10456 = @s("noccur","0");
 @strloop(@g(@print("pp_",@g("thepuznum"))),"x",
  @switch(@eq("%x",@uc("%0")), "1", @s("noccur",@add(@g("noccur"),"1")), ""));
 @switch( @eq(@g("val_%0"),@uc("%0")), "1", @s("noccur","-1"), "");
 @switch(@g("gamestatus"),
  "dead", "Sorry, this game is over. You were hanged. Start a new game.",
  "won", "The game is already over. You won. Start a new game.",
  "revealed", "Sorry, this game is over. Start a new game.",
  "alive", @switch("%0",{"a","b","c","d","e","f","g","h","i","j","k","l",
   "m","n","o","p","q","r","s","t","u","v","w","x","y","z"},
   @switch(@g("noccur"), "-1", @print("You've already guessed ",
    @uc("%0"), ". Guess another letter."),
   "0", @print( @s("val_%0",@uc("%0")),
    @s("numwrong",@add(@g("numwrong"),"1")),
    "No, sorry. There are no ", @uc("%0"), "s.%c",
    @execute(@g("description")) ),
   "1", @print( @s("val_%0",@uc("%0")),
    "Yes. There is one ", @uc("%0"), ".%c",
    @execute(@g("description")) ),
   @print( @s("val_%0",@uc("%0")),
   "Yes. There are ", @g("noccur"), " ", @uc("%0"), "s.%c",
   @execute(@g("description")) )),
 "Please guess a letter from A to Z.") );
 @s("nmissed","0");
 @strloop(@g(@print("pp_",@g("thepuznum"))),"x",
 @s("nmissed",@add(@g("nmissed"),@eq(@g("val_%x"),"~"))));
 @switch(@and(@eq(@g("gamestatus"),"alive"),@eq(@g("nmissed"),"0")),
 "1", @print(@s("gamestatus","won"),
 " Hey! That's it!%c   *** You have won ***"), "");
 @switch(@and(@eq(@g("gamestatus"),"alive"),@gt(@g("numwrong"),"5")),"1",
 @print(@s("gamestatus","dead"),
 " Oops. You've hung yourself.%c   *** You have died ***%cThe answer was: ",
 @g(@print("pp_",@g("thepuznum")))),"");
@desc #10456 = Guess a letter that you think is in the phrase,
 eg: "guess e".

end game (dbref #10457)

@action end game;reveal answer;reveal;give up;show answer;reveal phrase;
 show phrase = puzzle : nowhere
@field #10457 = varobj : 10451
@succe #10457 = @strloop("ABCDEFGHIJKLMNOPQRSTUVWXYZ","x",
 @s("val_%x","%x")); @print("Giving up? Oh, okay. **GAME OVER**
 %cThe answer is:%c", @g(@print("pp_",@g("thepuznum"))));
 @s("gamestatus","revealed");
@desc #10457 = Reveals the phrase and ends the current game.

categories (dbref #10460)

@action categories;listcat;lc;lstcat = puzzle : nowhere
@field #10460 = varobj : 10451
@succe #10460 = @print("Categories:");
 @fieldloop("10451","cn_",@let("z"=>@substr("%f",3),@print(
  "%c%z: %v (", @g("ptot_%z"),
  " puzzles)"
 )));

@desc #10460 = List the puzzle categories.

addcat * (dbref #10458)

@action addcat * = puzzle : nowhere
@set #10458 = puzzle
@set #10458 = dark
@field #10458 = varobj : 10451
@succe #10458 = @s(@print("cn_",@g("ncats")),"%4");
 @s(@print("ptot_",@g("ncats")),0);
 @print("'%4' is now category #", @g("ncats"));
 @s("progcat", @g("ncats")); @s("ncats", @add(@g("ncats"),"1"));
@desc #10458 = Add a puzzle category by name, eg: "addcat Proverb".

setcat * (dbref #10459)

@action setcat * = puzzle : nowhere
@set #10459 = puzzle
@set #10459 = dark
@field #10459 = varobj : 10451
@succe #10459 = @s("progcat", "%0"); @print("The program category is now
 #%0: ", @g("cn_%0"), ".");
@desc #10459 = Set the puzzle category number, eg: "setcat 3". Do this
 before addpuz actions.

addpuz * (dbref #10461)

@action addpuz * = puzzle : nowhere
@set #10461 = puzzle
@set #10461 = dark
@field #10461 = varobj : 10451
@succe #10461 = @s(@print("pp_",@g("npuzzles")),"%4");
 @s(@print("pc_",@g("npuzzles")),@g("progcat"));
 @print("'%4' is now puzzle #", @g("npuzzles"));
 @s("npuzzles", @add(@g("npuzzles"),"1"));
 @s(@print("ptot_",@g("progcat")), @add(@g(@print("ptot_",@g("progcat"))),1));
@desc #10461 = Add a new puzzle phrase in the current program category.

instructions (dbref #10454)

@create instructions;sign;rules
@lock #10454 = #-1
@zone #10454 = #10719
@fail #10454 = @tell("%#","The instructions stay here, please and
 thank you."); @call(10633,"each_turn");
@desc #10454 = @tell("%#","This is the classic game of Hangman. Guess
 the hidden phrase, letter by letter. If you make six wrong guesses,
 you lose the game.
 %cType \"new\" to start a new game.
 %cType \"guess *\" to guess a letter, eg: \"guess e\".
 %cType \"reveal\" to reveal the solution and end the current game.
 %cType \"categories\" to list all the puzzle categories.");
 @call(10633,"each_turn");