Get Key Pressed

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Get Key Pressed

Post by Nightmare » May 23rd, 2008, 11:22 pm

Is there a function of some sort which can read in what button a player has pressed?
Mainly looking just for W,A,S,D . I know use and melee is possible, but those are functions for themselves.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

Dizzy
CJ Fan
CJ Fan
Posts: 143
Joined: May 8th, 2008, 11:45 pm
Location: Colorado, US
Contact:

Re: Get Key Pressed

Post by Dizzy » May 24th, 2008, 8:17 pm

Wow now is my chance to help NM


Here you go...

Here is levs code:

Code: Select all

_UseKey()
{
	self endon("end_saveposition_threads");

	for(;;)
	{
		if(self useButtonPressed())
		{
			catch_next = false;

			for(i=0; i<=0.30; i+=0.01)
			{
				if(catch_next && self useButtonPressed())
				{
					self thread checksave();
					wait 1;
					break;
				}
				else if(!(self useButtonPressed()))
					catch_next = true;

				wait 0.01;
			}
		}

		wait 0.05;
	}
}
Obviously UserButtonPressed(); is a function, so there is probably one for +forward because the cod makers use that function for the killcam you know when you push F to skip killcam...


There is probably one for walk and such or you can probably make your own using

+forward
+backwards
+moveleft
+moveright

Those are what your WASD keys are bound to...
Image
"I am also know as lethal323" - Myself
Xfire = Dizzymagoo

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Re: Get Key Pressed

Post by Nightmare » May 24th, 2008, 8:49 pm

Well Dizzy, that doesn't really help at all since I said I already knew about the use and melee.
I'll try the function KS gave in a bit.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Re: Get Key Pressed

Post by Nightmare » May 25th, 2008, 6:28 am

Ok KS, that didn't work, says it was an unknown function, so I am guessing that is only going to work in CoD4.
Anyone have any other ideas?
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Get Key Pressed

Post by Drofder2004 » May 25th, 2008, 3:21 pm

No, you cannot detect key press other than Use, Melee and Attack.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Get Key Pressed

Post by Drofder2004 » May 25th, 2008, 3:30 pm

KillerSam wrote:It would seem an obvious thing to add - /moans
Detect Keypress has obvious flaws and would allow the creation of a pointless keylogger, most things can be detected in other ways.

Scripts have been made to detect leaning, you can detect mantle and climbing now, you can detect whena grenade is thrown, stance, aim-down-sight...
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Re: Get Key Pressed

Post by Nightmare » May 25th, 2008, 6:34 pm

PM coming your way drof.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

Post Reply

Who is online

Users browsing this forum: No registered users and 34 guests