Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *title Choicescript Hangman Coding Challenge
- *temp l1 "a"
- *temp l2 "b"
- *temp l3 "c"
- *temp l4 "d"
- *temp l5 "e"
- *temp l6 "f"
- *temp l7 "g"
- *temp l8 "h"
- *temp l9 "i"
- *temp l10 "j"
- *temp l11 "k"
- *temp l12 "l"
- *temp l13 "m"
- *temp l14 "n"
- *temp l15 "o"
- *temp l16 "p"
- *temp l17 "q"
- *temp l18 "r"
- *temp l19 "s"
- *temp l20 "t"
- *temp l21 "u"
- *temp l22 "v"
- *temp l23 "w"
- *temp l24 "x"
- *temp l25 "y"
- *temp l26 "z"
- *label hm_reset
- *temp hm_lives 10
- *temp n
- *temp hmvictory false
- *rand n 1 10
- *gotoref "hmword_"&n
- *label hmword_1
- *temp hmword "dog"
- *temp hmletter_count 3
- *temp hmletter_1 "d"
- *temp hmletter_1_found false
- *temp hmletter_2 "o"
- *temp hmletter_2_found false
- *temp hmletter_3 "g"
- *temp hmletter_3_found false
- *goto hang_man_top
- *label hmword_2
- *temp hmword "cat"
- *temp hmletter_count 3
- *temp hmletter_1 "c"
- *temp hmletter_1_found false
- *temp hmletter_2 "a"
- *temp hmletter_2_found false
- *temp hmletter_3 "t"
- *temp hmletter_3_found false
- *goto hang_man_top
- *label hmword_3
- *temp hmword "fish"
- *temp hmletter_count 4
- *temp hmletter_1 "f"
- *temp hmletter_1_found false
- *temp hmletter_2 "i"
- *temp hmletter_2_found false
- *temp hmletter_3 "s"
- *temp hmletter_3_found false
- *temp hmletter_4 "h"
- *temp hmletter_4_found false
- *goto hang_man_top
- *label hmword_4
- *temp hmword "shark"
- *temp hmletter_count 5
- *temp hmletter_1 "s"
- *temp hmletter_1_found false
- *temp hmletter_2 "h"
- *temp hmletter_2_found false
- *temp hmletter_3 "a"
- *temp hmletter_3_found false
- *temp hmletter_4 "r"
- *temp hmletter_4_found false
- *temp hmletter_5 "k"
- *temp hmletter_5_found false
- *goto hang_man_top
- *label hmword_5
- *temp hmword "horse"
- *temp hmletter_count 5
- *temp hmletter_1 "h"
- *temp hmletter_1_found false
- *temp hmletter_2 "o"
- *temp hmletter_2_found false
- *temp hmletter_3 "r"
- *temp hmletter_3_found false
- *temp hmletter_4 "s"
- *temp hmletter_4_found false
- *temp hmletter_5 "e"
- *temp hmletter_5_found false
- *goto hang_man_top
- *label hmword_6
- *temp hmword "rabbit"
- *temp hmletter_count 6
- *temp hmletter_1 "r"
- *temp hmletter_1_found false
- *temp hmletter_2 "a"
- *temp hmletter_2_found false
- *temp hmletter_3 "b"
- *temp hmletter_3_found false
- *temp hmletter_4 "b"
- *temp hmletter_4_found false
- *temp hmletter_5 "i"
- *temp hmletter_5_found false
- *temp hmletter_6 "t"
- *temp hmletter_6_found false
- *goto hang_man_top
- *label hmword_7
- *temp hmword "mouse"
- *temp hmletter_count 5
- *temp hmletter_1 "m"
- *temp hmletter_1_found false
- *temp hmletter_2 "o"
- *temp hmletter_2_found false
- *temp hmletter_3 "u"
- *temp hmletter_3_found false
- *temp hmletter_4 "s"
- *temp hmletter_4_found false
- *temp hmletter_5 "e"
- *temp hmletter_5_found false
- *goto hang_man_top
- *label hmword_8
- *temp hmword "badger"
- *temp hmletter_count 6
- *temp hmletter_1 "b"
- *temp hmletter_1_found false
- *temp hmletter_2 "a"
- *temp hmletter_2_found false
- *temp hmletter_3 "d"
- *temp hmletter_3_found false
- *temp hmletter_4 "g"
- *temp hmletter_4_found false
- *temp hmletter_5 "e"
- *temp hmletter_5_found false
- *temp hmletter_6 "r"
- *temp hmletter_6_found false
- *goto hang_man_top
- *label hmword_9
- *temp hmword "elephant"
- *temp hmletter_count 8
- *temp hmletter_1 "e"
- *temp hmletter_1_found false
- *temp hmletter_2 "l"
- *temp hmletter_2_found false
- *temp hmletter_3 "e"
- *temp hmletter_3_found false
- *temp hmletter_4 "p"
- *temp hmletter_4_found false
- *temp hmletter_5 "h"
- *temp hmletter_5_found false
- *temp hmletter_6 "a"
- *temp hmletter_6_found false
- *temp hmletter_7 "n"
- *temp hmletter_7_found false
- *temp hmletter_8 "t"
- *temp hmletter_8_found false
- *goto hang_man_top
- *label hmword_10
- *temp hmword "meerkat"
- *temp hmletter_count 7
- *temp hmletter_1 "m"
- *temp hmletter_1_found false
- *temp hmletter_2 "e"
- *temp hmletter_2_found false
- *temp hmletter_3 "e"
- *temp hmletter_3_found false
- *temp hmletter_4 "r"
- *temp hmletter_4_found false
- *temp hmletter_5 "k"
- *temp hmletter_5_found false
- *temp hmletter_6 "a"
- *temp hmletter_6_found false
- *temp hmletter_7 "t"
- *temp hmletter_7_found false
- *goto hang_man_top
- *label hang_man_top
- *gosub hangman_parse
- *choice
- *if (hmvictory) #YOU WIN!!
- *goto hang_man_top
- *if (hm_lives = 0) #YOU LOSE!!
- *goto hang_man_top
- *if ((hm_lives != 0) and (hmvictory != true)) #Guess a Letter
- *label guess_letter
- *gosub hangman_parse
- What letter?
- *temp str
- *input_text str
- *comment convert input to lowercase:
- *script temps.str = temps.str.toLowerCase();
- *temp n 1
- *temp count 0
- *temp this_letter
- *label check_letter_loop
- *set this_letter ({"l"&n})
- *if (this_letter != str)
- *if (n < 26)
- *set n + 1
- *goto check_letter_loop
- *line_break
- Error: '${str}' is not a letter.
- *line_break
- *goto guess_letter
- *comment reset n
- *set n 1
- *label guess_letter_loop
- *set this_letter {("hmletter_"&n)}
- *if (this_letter = str)
- *setref (("hmletter_"&n)&"_found") true
- *set count + 1
- *if (n < hmletter_count)
- *set n + 1
- *goto guess_letter_loop
- ${count} letters matched.
- *if (count = 0)
- *line_break
- Life lost.
- *line_break
- *set hm_lives - 1
- *line_break
- *goto hang_man_top
- *if ((hm_lives != 0) and (hmvictory != true)) #Guess the Word
- *gosub hangman_parse
- What do you think the word is?
- *temp str
- *input_text str
- *comment convert input to lowercase:
- *script temps.str = temps.str.toLowerCase();
- *if (str = hmword)
- *set hmvictory true
- *comment show all letters
- *temp n 1
- *label guessed_word_loop
- *setref (("hmletter_"&n)&"_found") true
- *if (n != hmletter_count)
- *set n + 1
- *goto guessed_word_loop
- *goto hang_man_top
- *else
- *set hm_lives 0
- *goto hang_man_top
- #Start Over
- *goto hm_reset
- #QUIT
- *goto_scene act0
- *set hm_lives - 1
- *goto hang_man_top
- *label hangman_parse
- The Word:
- *temp n 1
- *temp count 0
- *label hmword_print_loop
- *temp this_letter {(("hmletter_"&n)&"_found")}
- *if (this_letter != true)
- _
- *if (this_letter)
- *set this_letter {("hmletter_"&n)}
- *set count + 1
- ${this_letter}
- *if (n < hmletter_count)
- *set n + 1
- *goto hmword_print_loop
- *if (count = hmletter_count)
- *set hmvictory true
- *line_break
- *line_break
- *if (hm_lives < 5)
- _____
- *line_break
- *if (hm_lives < 6)
- |/
- *if (hm_lives < 4)
- |
- *line_break
- *if (hm_lives < 7)
- |
- *if (hm_lives < 3)
- (x)
- *line_break
- *if (hm_lives < 8)
- |
- *if (hm_lives < 2)
- /|\
- *line_break
- *if (hm_lives < 9)
- |
- *if (hm_lives < 1)
- / \
- *line_break
- *if (hm_lives < 10)
- |\_
- *line_break
- *line_break
- Lives: ${hm_lives}
- *line_break
- *line_break
- *return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement