Posted: Sun Oct 16, 2011 5:21 pm Post subject: RE:Clickable buttons
oh im sorry! i didnt even know i could do that!!!!!
Sponsor Sponsor
sammi
Posted: Sun Oct 16, 2011 7:38 pm Post subject: RE:Clickable buttons
me and my dad have tried everything and we still cant get the darn buttons to go away after i click 'no'. we think it has something to do with putting cls in somewhere but thats not working and we couldn't anything in the walkthrough can someone please help.
procedure ExitButton
cls() put"Aww you can't tell me your done already....." delay(2000) put"ok fine......bye bye" end ExitButton
%% DECLARING MY VARIABLES %% var Question :string%the typing cursor var Answer :int% part of the array var valid :boolean%number check var words :array1.. 11ofstring%the answers %var Mouse.Where(350, 50, YesButton)
%% PARTS OF THE ARRAY %%
words (1):="Yes"
words (2):="No"
words (3):="Maybe"
words (4):="Thats for me to know and you to find out :)"
words (5):="Of course"
words (6):="I doubt it"
words (7):="In your dreams"
words (8):="Keep dreaming"
words (9):="How the heck am I suppossed to know?"
words (10):="Obviously"
words (11):="Absolutely"
%%% MAGIC BALL PROGRAM %%% procedure MagicBall
cls()%refresh screen loop
valid :=true% sets questions to valid until it hits check
% Asking the question locatexy(200, 390) put"Ask the Magic 8-Ball a question"
% Getting a response locatexy(250, 250) get Question :*
% Make sure the question contains no numbers for i :1.. length(Question)% Represents the Character of the string for b :1.. 9% checks to see if the character, i, has a number. if Question (i)=intstr(b)then% If it does, it sets valid to false.
valid :=false% if it finds a number then it recognizes an improper question cls() exit endif endfor endfor
locatexy(200, 100)% position of answer and "invalid" comment
if valid then
Answer := Rand.Int (1, 11)% pick any one of my answers put words (Answer) delay(2000)% lets person read answer cls()%gets rid of the answer locatexy(200, 100) put"Would you like to ask another question?"
else locatexy(200, 220) put"Thats not a question silly!!!" delay(1500) cls() endif
endloop end MagicBall
MagicBall
Aange10
Posted: Sun Oct 16, 2011 7:51 pm Post subject: Re: RE:Clickable buttons
sammi @ 16/10/2011, 6:38 pm wrote:
me and my dad have tried everything and we still cant get the darn buttons to go away after i click 'no'. we think it has something to do with putting cls in somewhere but thats not working and we couldn't anything in the walkthrough can someone please help.
Try this
Turing:
%Declare this variable at the top var exit_counter :int:=0 procedure ExitButton
loop cls() put"Aww you can't tell me your done already....." if exit_counter =0then delay(2000) endif put"ok fine......bye bye" delay(1000)% Prevents flickering
exit_counter :=1 endloop end ExitButton
That should fix your problem. It indefinitely loops the drawling, so that it doesn't continue on to redrawing the buttons. It only delays the first time it execute, aswell. (That away you can't tell it's looping)
also the quit command will stop the program, if you want to use that.
... Also, your global variables need to be defined BEFORE your procedures. (So move the extibutton procedure down, right above your magiball procedure)