SRL Archive - SRL Archives

SendArrow...


Dark_Sniper

2007-03-05 23:05:57

SendArrowSilent would not always let me rotate the map compass right after i logged in….

so i made the keys end not silent :p


(this one sends the arrow key just like sendarrowsilent without the silent)
Procedure SendArrow( key : Integer );  //0 = up, 1 = right, 2 = down, 3 = left.
begin
If key = 0 then begin
KeyDown(38)
KeyUp(38)
end;
If key = 1 then begin
KeyDown(39)
KeyUp(39)
end;
If key = 2 then begin
KeyDown(40)
KeyUp(40)
end;
If key = 3 then begin
KeyDown(37)
KeyUp(37)
end;
end;



(this one sends the arrow key just like sendarrowsilentwait without the silent)

Procedure SendArrowWait( key, WaitTime : Integer ); //0 = up, 1 = right, 2 = down, 3 = left.
begin
If key = 0 then begin
KeyDown(38)
wait(WaitTime)
KeyUp(38)
end;
If key = 1 then begin
KeyDown(39)
wait(WaitTime)
KeyUp(39)
end;
If key = 2 then begin
KeyDown(40)
wait(WaitTime)
KeyUp(40)
end;
If key = 3 then begin
KeyDown(37)
wait(WaitTime)
KeyUp(37)
end;
end;


I have tested these and they do allow me to rotate the compass right after i login.

if this was already made i didnt notice :p

but there you go :p

JuKKa

2007-03-12 17:42:58

u should add a random wait time also.. like: waitrandom or someting u know..

Procedure SendArrowWait( key, WaitTime, WaitRand: Integer );
wait(WaitTime+Random(WaitRand))

like that :)

Ron

2007-03-12 19:08:45

Cool script. Although am I the only person who ever notices missing else ifs :p

lol you can either put in else ifs or you could use a case statement to make the function run faster.

Like so:

procedure SendArrow(Key : Integer); //0 = up, 1 = right, 2 = down, 3 = left.
var
Press : integer;
begin
case Key of
0 : Press := 38;
1 : Press := 39;
2 : Press := 40;
3 : Press := 41;
else
begin
WriteLn('Only Keys 0 to 3 are permitted in the SendArrow procedure!');
Exit;
end;
end;
KeyDown(Press);
KeyUp(Press);
end;

procedure SendArrowWait(Key, WaitTime : Integer); //0 = up, 1 = right, 2 = down, 3 = left.
var
Press : integer;
begin
case Key of
0 : Press := 38;
1 : Press := 39;
2 : Press := 40;
3 : Press := 41;
else
begin
WriteLn('Only Keys 0 to 3 are permitted in the SendArrowWait procedure!');
Exit;
end;
end;
KeyDown(Press);
Wait(WaitTime);
KeyUp(Press);
end;

~Ron :)

Dark_Sniper

2007-03-12 20:31:00

ya i know i could of done it that way.. i consider it easier to read with if and then statements.

Ron

2007-03-12 20:56:40

The fastest and best code to do the job you want should always be your goal. :)

Dark_Sniper

2007-03-12 23:15:43

yet its not i really prefer to write out the code to make it as long as possible :p

so when the script messes up i know exactly were to go and how to correct.

SonOfSheep

2007-03-15 17:44:02

From: Dark_Sniper
yet its not i really prefer to write out the code to make it as long as possible :p

so when the script messes up i know exactly were to go and how to correct.


Sort of like what i do. Except i just do whatever is easier at the time of writing. Like using as few of variables as possible. And leaving extra variables in for no reason.

Dark_Sniper

2007-03-16 17:02:11

ya thats what i do cause i never script to the best of my abilities :p.

the only reason i do not is cause there is no limit to what you really can do.

once im in tune i can work on the big scripts again.. like PV.