opposite of IsKeyDown and self.key_pressed

Topics regarding Scripting with Reality Factory
Post Reply
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

opposite of IsKeyDown and self.key_pressed

Post by Danimita92 »

Hi everybody. I opened this topic because in my scripted player, various times I have found the need to ask the script when a certain key isn't pressed.

For example I use:

if(IsKeyDown(46))

or

if(self.key_pressed = 46)

to detect if SPACE is being pressed. But how do i detect if space isn't being pressed?
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: opposite of IsKeyDown and self.key_pressed

Post by Juutis »

if(IsKeyDown(46) = false)

Or

if(!IsKeyDown(46))
(Not sure about this, I've never really used the '!')
Pain is only psychological.
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: opposite of IsKeyDown and self.key_pressed

Post by Danimita92 »

Thanks for such a quick reply Juutis :D
User avatar
Graywolf
Posts: 75
Joined: Mon Apr 14, 2008 8:36 pm
Location: Anchorage, Alaska
Contact:

Re: opposite of IsKeyDown and self.key_pressed

Post by Graywolf »

Simkin uses an actual "not"...

if(not IsKeyDown(key))
{
;
}
"So, what's the life of a programmer like?" "...Huh? What life?!"

RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: opposite of IsKeyDown and self.key_pressed

Post by Juutis »

Oh, never knew that. Thanks for the info.
Pain is only psychological.
Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: opposite of IsKeyDown and self.key_pressed

Post by Danimita92 »

Wow thanks to you to, graywolf
User avatar
Graywolf
Posts: 75
Joined: Mon Apr 14, 2008 8:36 pm
Location: Anchorage, Alaska
Contact:

Re: opposite of IsKeyDown and self.key_pressed

Post by Graywolf »

You're welcome. If you have any more, questions, throw'em at me. I'll help if I can.
"So, what's the life of a programmer like?" "...Huh? What life?!"

RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
Post Reply