SRL Archive - OSR Help

How do I detect human input when using SMART?


weequ

2011-01-04 19:34:26

Any other ways than using file reading functions?
I tested IsKeyDown and it don't work because I think it reads smart keypresses which is stupid…

i luffs yeww

2011-01-05 06:05:03

IsFKeyDown, then ReadLn?

weequ

2011-01-05 07:21:09

From: i luffs yeww
IsFKeyDown, then ReadLn?

I have tried IsFKeyDown and it didn't work.

Cazax

2011-01-05 15:33:58

Both IsFKeyDown and IsKeyDown works perfectly, you just have to use it in the correct way. Have it in a loop with a short time interval always work - but finding that place in the script is the hard part. The best you can do is to have a form with a TEdit and TButton - so when you click the button it will TypeSend() the text in the box. More complex idea would be an IRC bot where you can do .type TextHere and the bot would type the text, but that requires more work and is not needed at all.

weequ

2011-01-05 16:18:35

From: Cazax
Both IsFKeyDown and IsKeyDown works perfectly, you just have to use it in the correct way. Have it in a loop with a short time interval always work - but finding that place in the script is the hard part. The best you can do is to have a form with a TEdit and TButton - so when you click the button it will TypeSend() the text in the box. More complex idea would be an IRC bot where you can do .type TextHere and the bot would type the text, but that requires more work and is not needed at all.
Try it yourself to belive
program MYID;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}


begin
SmartSetupEx(134, False, True, False);
SetTargetArray(SmartImageArray, 765,503);
Wait(3000);
repeat
while ((not IsFKeyDown(7)) and (not IsKeyDown(GetKeyCode('a')))) do wait(10);
WriteLn('Worked!');
Wait(1000);
until(false);
end.

Troll

2011-01-05 17:20:00

^ Does not work for me aswell :( I works when not useing smart though, so would it be a bug in smart code not srl coding?

weequ

2011-01-05 17:38:16

From: Troll Man
^ Does not work for me aswell :( I works when not useing smart though, so would it be a bug in smart code not srl coding?
I think it reads smart inputs and it's quite useless…

Gu3st...

2011-01-05 17:47:27

From: antti mies
Try it yourself to belive
program MYID;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}


begin
SmartSetupEx(134, False, True, False);
SetTargetArray(SmartImageArray, 765,503);
Wait(3000);
repeat
while ((not IsFKeyDown(7)) and (not IsKeyDown(GetKeyCode('a')))) do wait(10);
WriteLn('Worked!');
Wait(1000);
until(false);
end.


From: Troll Man
^ Does not work for me aswell :( I works when not useing smart though, so would it be a bug in smart code not srl coding?
So in other words: It works perfectly if you're using it the correct way (which is what Cazax said in the first place) ;) It's not a bug. Check smart.scar in SRL/Core

Cazax

2011-01-05 18:55:51

Hmm, SMART replaces IsKeyDown to SmartisKeyDown so that's the problem I think. Try making a form, that should work.

MylesMadness

2011-01-05 18:59:42

Why does SRL need to know if Smart is holding down a key…

YoHoJo

2011-01-05 19:01:25

I don't know anything about anything and barely read the thread and I'm on the toilet on my phone but would adding SetupSRL help?

BenLand100

2011-01-05 19:07:35

From: MylesMadness
Why does SRL need to know if Smart is holding down a key…

Well, essentially it doesn't, I suppose. But way back in the day when I wrote the first Smart.scar I overrode all of the basic mouse/key events, and that was one of them. At that point in time, the only thing that was ever detected was whether the script had a key held (idk why, tbh) and no one ever wanted user input. It could be removed, or made optional with a define, but that is up to SRL, not me.