TokenHerbz @ Fri Dec 08, 2006 3:20 am wrote:
Eww, Str.Upper!
code: |
var secretText : string %%This will be your word.
var uncoverText : flexible array 1 .. 0 of string %%This will be your progres
var input : string (1) %%gets input
var blockOut : string := "*" %%can change this ex: "_"
get secretText : * %%Gets your text.
for i : 1 .. length (secretText) %%sets progress
new uncoverText, upper (uncoverText) + 1
if ord (secretText (i)) <= 90 and ord (secretText (i)) >= 65 or
ord (secretText (i)) <= 122 and ord (secretText (i)) >= 97 then
uncoverText (i) := blockOut
else
uncoverText (i) := secretText (i) %%shows non letter chars
end if
end for
%%main loop
loop
cls
for i : 1 .. upper (uncoverText) %%display current progress
put uncoverText (i) ..
end for
put ""
put "Enter a letter: " ..
getch (input)
%%this will search for the letter, and if its there show it
for i : 1 .. length (secretText)
if ord (secretText (i)) = ord (input) then
uncoverText (i) := input %%yay shows you it!
end if
end for
end loop
%%TO DO LIST
%%have it so you lose after 5 failed attempts
%%have it draw a hang man!
%%make my crappy codeing better
|
Woot woot! 7 mins to make
ok so you are only using keyboard for this program, but what if you want to use the mouse? all i know is that you have to upload a picture/draw buttons then use buttonwait or mousewhere. But how do you make the program let you click the letters instead of typing in? 