Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Input.KeyDown Not Working
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BrindaV




PostPosted: Wed Jun 15, 2011 4:45 pm   Post subject: Input.KeyDown Not Working

Well, my program was working fine with Input.KeyDown, until I added another KeyDown. The last KeyDown doesn't seem to work, it doesn't get input. Here's the code:

/*

Declarations for screen info are being made.

*/

View.Set ("NoCursor")
View.Set ("NoEcho")
View.Set ("Graphics: 900; Max, NoButtonBar")

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/*

Variable Delclarations

*/

var Background : int
var Talking := Font.New ("Bauhaus 93:30:Bold")
var IP : array char of boolean
var Box : int
var Character : int
var Name : string
var IP2 : array char of boolean

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Music.PlayFileLoop ("MainTheme.mp3")

Background := Pic.FileNew ("Shonen_Jump_Wallpaper.jpg")
Pic.DrawSpecial (Background, 0, 0, picCopy, picFadeIn, 1650)
delay (500)
Font.Draw ("Press Enter To Continue", 170, 150, Talking, white)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/*

These sequences involving loops for input are highlighted. They get and handle
keyboard input.

*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop

Input.KeyDown (IP)

if IP (KEY_ESC) then

% Escape Exit Option is Given. Loop is not exited unless Enter Key is pressed however.

Music.PlayFileStop

cls

put "Thank You for Using."

delay (2000)
cls

end if

% Only exits if Input is the Enter Key.

exit when IP (KEY_ENTER)

end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Music.PlayFileStop

Pic.Free (Background)

Music.PlayFileLoop ("MeetingNaruto.mp3")

Background := Pic.FileNew ("Cut1.jpg")

Box := Pic.FileNew ("TextBox.jpg")

Character := Pic.FileNew ("IchigoHead.jpg")

Talking := Font.New ("Arial:14")

Pic.DrawSpecial (Background, 0, 0, picCopy, picFadeIn, 1000)
Pic.DrawSpecial (Box, 25, 25, picMerge, picFadeIn, 1000)
Pic.DrawSpecial (Character, 0, 0, picMerge, picFadeIn, 1000)

Font.Draw ("Hey you! D'you know where here is?", 185, 137, Talking, white)
delay (2000)
Font.Draw ("Well? Do you?", 185, 110, Talking, white)
delay (2000)
Font.Draw ("Ahhh, whatever!", 185, 83, Talking, white)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop

Input.KeyDown (IP)

if IP (KEY_ESC) then

Music.PlayFileStop

cls

put "Thank You for Using."

delay (2000)
cls

end if

exit when IP (KEY_ENTER)

end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

cls

Pic.DrawSpecial (Background, 0, 0, picCopy, picFadeIn, 1)
Pic.DrawSpecial (Box, 25, 25, picMerge, picFadeIn, 1)
Pic.DrawSpecial (Character, 0, 0, picMerge, picFadeIn, 1)

delay (2000)

Font.Draw ("Let's just look around. You go that way and I'll go this way.", 185, 137, Talking, white)

delay (1000)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

loop

Input.KeyDown (IP)

if IP (KEY_ESC) then

Music.PlayFileStop

cls

put "Thank You for Using."

delay (2000)
cls

end if

exit when IP (KEY_ENTER)

end loop

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

cls

Music.PlayFileStop

Pic.Free (Background)

Music.PlayFileLoop ("MenuMusic.mp3")

Background := Pic.FileNew ("RPG MAP.jpg")
Pic.DrawSpecial (Background, 0, 0, picCopy, picFadeIn, 1000)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/*

Program is functioning well until this point. - 4:55

*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Talking := Font.New ("Bauhaus 93:24")

Font.Draw ("Enter Your Name To Continue", 185, 500, Talking, white)

Draw.FillBox (200, 300, 700, 400, black)
Draw.FillBox (225, 325, 675, 375, white)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

/*

Working until here as well. Going to add the Get Name function now. - 5:13

*/

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

locate (17, 25)

get Name : *

cls

Pic.Draw (Background, 0, 0, picCopy)

Draw.FillBox (200, 300, 700, 400, black)
Draw.FillBox (225, 325, 675, 375, white)

Font.Draw (Name, 230, 330, Talking, black)

Font.Draw ("If This Is Okay, Press Enter, Otherwise, Too Bad", 30, 500, Talking, white)

delay (2000)

loop

Input.KeyDown (IP2)

if IP2 (KEY_ESC)then

return

end if

exit when IP2 (KEY_ENTER)

end loop
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jun 15, 2011 5:27 pm   Post subject: RE:Input.KeyDown Not Working

Too much code (cut it down to just an example that demonstrates the problem). Use [ code ] tags. Answer the template questions.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: