SRL Archive - Research & Development Lounge

Hidefor


Dumpin

2008-02-21 04:05:24

Function Hidefor(Timesec: integer): integer;
begin
Timesec := Timesec * 1000;
getself.Hide;
Wait(Timesec);
getself.Show;
Result := Timesec;
end;

SIMPLE to use and simple to make function to hide scar for the time you want.

HideFor(2); will hide scar for 2 seconds :) simple

mixster

2008-02-21 06:15:18

Why would you want to hide it for 2 seconds or even 30 seconds if all it does then is nothing? It would make more sense to make 2 procedures/functions - 1 that hides it and another that checks if it is time to show it yet (using timefrommark or system time) - or you could combine them into 1.
I can think of 1 use though - if you want launch scar then get it to run after your familiy goes out to work or whatever so they don't interrupt it (because they have to do something on the pc etc).

n3ss3s

2008-02-21 06:53:34

It wasn't this procedure, but last time I used hiding was today, I had to go to the shop and hide scar and make it movemouse(0, 0) so my grandma wont steal comp and play sudoku :p

Why would you want to hide it for 2 seconds or even 30 seconds if all it does then is nothing? It would make more sense to make 2 procedures/functions - 1 that hides it and another that checks if it is time to show it yet (using timefrommark or system time) - or you could combine them into 1.


eh - if you know the amount of time you want to wait and you don't do anything else except would check if it's time to break, you can just use wait -.-

Wizzup?

2008-02-21 09:05:33

From: Dumpin
Function Hidefor(Timesec: integer): integer;
begin
Timesec := Timesec * 1000;
getself.Hide;
Wait(Timesec);
getself.Show;
Result := Timesec;
end;

SIMPLE to use and simple to make function to hide scar for the time you want.

HideFor(2); will hide scar for 2 seconds :) simple

Why don't you just let it use milliseconds, would be alot better IMO. :)

Dumpin

2008-02-21 09:50:22

thanks for commends. :)

now with F key Function :)


Function Hideuntilkey(Key: byte): byte;
var Q : byte;
begin
Q := Key;
repeat
getself.Hide;
until(IsFkeyDown(Q));
getself.Show;
Result := key;
end;

use as
 Hideuntilkey(12); // 12 is the number of the Fkey

exppo

2008-02-21 09:51:59

Why would you want to hide it..

Dumpin

2008-02-21 09:55:29

well… read n3ss3s post… And maybe you want to make a scar keylogger?

mixster

2008-02-21 19:40:27

The 2nd one is wrong - you just have it keep hiding itself when it should hide itself first then have a wait in the repeat loop. Also, why did you have to make Q a byte, when you could of just used key?

Dumpin

2008-02-22 08:22:39

i dunno, first tried without Q didn't work, so i tried with an var between it.

also, it works fine for me. and this was the easyest way i guess.

mixster

2008-02-22 12:10:59

I meant, wouldn't you have it as:

getself.Hide;
repeat
Wait(100);
until(IsFkeyDown(Q));
getself.Show;
To have it continuing to hide itself without being shown could cause errors (I think). Also, wouldn't it be more useful to return the time it ran until it was stopped?

Edit: Played with it and got this (changed it to what I said):

function HideUntilKey(Key: byte): Integer;
var
sTime: Integer;
begin
sTime:= GetSystemTime;
getself.Hide;
repeat
Wait(100);
until(IsFkeyDown(Key));
getself.Show;
Result := GetSystemTime-sTime;
end;
It works fine for me (using key without setting up a variable to store it) and it outputs the time it hid for.

Dumpin

2008-02-22 15:05:54

aah, is nice to :) im thinking of a new function at the moment… or maybe a new script.

EDIT:

Procedure LockPc(Key: byte);
begin
getself.Hide;
repeat
movemouse(0,0);
until(IsFkeyDown(Key));
getself.Show;
end;

Locks your mouse in the top corner. nobody will be able to use the computer in any way without pressing the choosen FKey

mixster

2008-02-22 16:52:04

Check the 'other scripts' section - I'm sure someone added a very advanced pc locker that involved key combinations (like ctr+u to unlock) and also added clicking support in case the person knew about scar, so opened up the task manager then ended it from there.

Da 0wner

2008-02-22 18:36:43

Ok people…If you use this function it can't do other parts of scripts because it waits. You should just have it Repeat Hide until key is down and not wait. Don't use waits or else it won't do other part. So it would be like this. Hold on…


Program New;
{.Include SRL/SRL.scar}

Procedure HideSCAR;
Begin
GetSelf.Hide;
Writeln('SCAR has been hidden.');
End;

Procedure UnhideSCAR;
Begin
GetSelf.Show;
GetSelf.WindowState := wsMaximized;
Writeln('SCAR has been unhidden.');
End;

Begin
HideSCAR;
Wait(500);
ShowMessage('Script is working.');
UnhideSCAR;
End.

So, I tried using the key function but it didn't work so I just did 2 seperate ones. It still didnt work so why don't we use the while do command…Thanks (Again),

~Kyle~

mixster

2008-02-22 20:46:09

That was my earlier suggestion (check 2nd post), but that's a rubbish method of doing it ;) MarkTime's are so much cooler.


var
sTime: Integer;

function HideFor(ms: Integer; fKey: byte; useWait: Boolean): Integer;
begin
if(sTime = 0) then
begin
sTime:= GetSystemTime;
GetSelf.Hide;
Result:= ms-(GetSystemTime-sTime);
Exit;
end
else if(useWait) then
begin
if((sTime+ms)<=GetSystemTime) then
begin
Result:= 0;
GetSelf.Show;
Exit;
end
else
begin
Result:= ms-(GetSystemTime-sTime);
end;
end
else
begin
if(IsFKeyDown(fKey)) then
begin
GetSelf.Show;
end;
end;
end;

Just set sTime as a var (is at top of script) and you can then choose whether or not to wait for a certain time or until a key is pressed (using the 'useWait' boolean with True meaning it waits for 'ms' milliseconds or False to wait until the 'fkey' fkey is down). It also outputs the time left for hiding (only used if you're using the waiting method) though you can change it to a boolean if you want it to output true when it shows itself.