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

Username:   Password: 
 RegisterRegister   
 Input + when statement?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xevious




PostPosted: Sun Nov 13, 2005 11:30 am   Post subject: Input + when statement?

First off, I can't get keydown to work at all.
I took this straight from the examples, and it won't work
code:

var chars : array char of boolean
Input.KeyDown (chars)
if chars ('t') then
    put "The T key is pressed"
end if

Is there something wrong with that?

I was also wondering if it is possible to combine some form of input with a when statement.

something like
if chars ('t') when x=300 then *do something*



[/code]
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Sun Nov 13, 2005 11:37 am   Post subject: (No subject)

you need it in a loop
xevious




PostPosted: Sun Nov 13, 2005 11:46 am   Post subject: (No subject)

MysticVegeta wrote:
you need it in a loop


ok thanks, I have that working now

but is there any way to put a when statement in that loop so it only does something when you press the button at a specific time?
Cervantes




PostPosted: Sun Nov 13, 2005 12:19 pm   Post subject: (No subject)

code:
if chars ('t') and x = 300 then

Or perhaps,
code:
if chars ('t') and x >= 300 then
MysticVegeta




PostPosted: Sun Nov 13, 2005 12:49 pm   Post subject: (No subject)

xevious wrote:
at a specific time?


you mean at a specific location right?
Tony




PostPosted: Sun Nov 13, 2005 1:33 pm   Post subject: (No subject)

xevious wrote:
but is there any way to put a when statement in that loop

when statement doesn't actually have anything to do with time. It's a condition much like if, just different syntax.

Turing:

function() when condition = true

is equavalent and will behave identical to
Turing:

if condition = true then
    function()
end if
xevious




PostPosted: Sun Nov 13, 2005 2:38 pm   Post subject: (No subject)

MysticVegeta wrote:
you mean at a specific location right?


yeah, that's what I meant, and I'll mess around with

code:
if chars ('t') and x >= 300 then


I think I can get it to work...
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  [ 7 Posts ]
Jump to:   


Style:  
Search: