SRL Archive - Help and Support

Key press help


almost

2011-07-15 19:00:47

I need to know how to figure out when a key is pressed and what key it was.
for i:= 0 to 300 do
if (IsKeyDown(Chr(i))) then
WriteLn(IntToStr(i));

This checks all the main keys very quickly but I end up with an integer.
For example, pressing "a" returns 97 and pressing "b" returns 98.
I need it to return a string.
If I'm not mistaken there is a function for turning a key code into a string?
I need for it to return the string "a" when the a key is pressed.
I want to avoid doing something like this though
  case i of
97: Result:= 'a';
98: Result:= 'b';
I would have to write a result for every key possible and it's not very efficient.

What I need is
for i:= 0 to 300 do
if (IsKeyDown(Chr(i))) then
begin
Result:= ChrToString(i);
Exit;
end;

Gu3st...

2011-07-15 19:03:40

E: Wait. Is this for Simba or SCAR?

Simba:
  for i:= 0 to 300 do
begin
IsKeyDown(I); // Free the buffer.
if (IsKeyDown(i)) then
s := s + chr(i);
end;

almost

2011-07-15 19:19:50

Ok that was incredibly simple.
One of those times I just had a brain fart, haha but thanks.

Gu3st...

2011-07-15 19:22:27

From: almost
Ok that was incredibly simple.
One of those times I just had a brain fart, haha but thanks.
Haha, no worries ^^, <3

What are you working on? You're always working on interesting projects

almost

2011-07-15 19:32:58

This is my side project but I'm making a script that sends key presses to a php file that saves them to an html file.
Pretty much a keylogger.

My main project is turning the 3d fractal landscape into a planet.
I created a fractal sphere made out of an infinite number of flat surfaces and each one of those surfaces will be passed through the same algorithm that generates the landscape.

Gu3st...

2011-07-15 19:47:06

From: almost
This is my side project but I'm making a script that sends key presses to a php file that saves them to an html file.
Pretty much a keylogger.

My main project is turning the 3d fractal landscape into a planet.
I created a fractal sphere made out of an infinite number of flat surfaces and each one of those surfaces will be passed through the same algorithm that generates the landscape.
Oh my god.. Add my msn: axel_sa [at] hotmail.com

almost

2011-07-15 19:51:22

Ok I'll have to make an msn first though

TomTuff

2011-07-15 20:09:41

Why aren't you ever on RS anymore? :(

almost

2011-07-15 20:32:17

I had a glitch happen and lost 1.3 bil and my cls…
Gave the rest of my money to close friends and quit.

TomTuff

2011-07-15 21:02:42

From: almost
I had a glitch happen and lost 1.3 bil and my cls…
Gave the rest of my money to close friends and quit.


Wow, can you describe what happened?

almost

2011-07-15 21:14:20

I was pking in full torva unskulled only risking a couple mil at most.
Someone jumps my fight with a claw spec and I die and don't even keep one item even though I also had protect item on.

Smarter Child

2011-07-15 22:08:17

From: almost
Ok I'll have to make an msn first though


Couldn't help but LOL :redface: