SRL Archive - Research & Development Lounge

Prayer Flicking Procedure


pija

2013-03-09 18:44:16

Here is a procedure I made, let me know what you think and if you detect any problem/bad practice.
procedure MeleeFlick(firstwait:integer);
var
desynch,des1,des2,waittime1,waittime2,randomwait1,randomwait2: integer;
begin
waittime2:= TICK
waittime1:= TICK*MSPEED;
randomwait1:= waittime1;
randomwait2:= waittime2;
des1:= 0;
desynch:=0;
writeln('Flicking');
//P07_TabInventoryTab(6)
//P07_MouseBox(669, 357, 690, 379, mouse_left);
wait(firstwait*TICK)
repeat
begin

//calculates the second waiting time
des2:= randomrange(-100,100)-desynch;
randomwait2:= waittime2+des2;

//calculates the first waiting time
des1:= random(200);
randomwait1:= waittime1-randomwait2+des1;


//actual clicking business


ClickMouse2(mouse_left);
{writeln(IntToStr(randomwait1));}
wait(randomwait2);
ClickMouse2(mouse_left);
{writeln(IntToStr(randomwait2));}
{writeln(IntToStr(randomwait1+randomwait2));}
desynch:= desynch-(2400-randomwait1-randomwait2);
{writeln(IntToStr(desynch));}
wait(randomwait1);
//randomwait is called last so there is no waiting the first time in the loop

end;
until (not InCombat)

I had a really tough time into structuring this procedure to add randomness without ever desynching the flicking, this is what I came up with.
I have commented the MouseBox and TabInventoryTab procedures because it is still up to the scripter's responsibility to set those up timely, they are better called outside the function in order not to mess up the timing.

Also, commented debug lines in brackets. TICK is a constant and has a value of 600, monster speed is a constant or variable that stores the attack speed of the monster, 4 for bloodvelds, 5 for mountain trolls. InCombat should be a function that returns true if the user is in combat.
This looks very bad, I would appreciate any better ideas.

Element17

2013-03-10 03:21:23

use tages.

procedure MeleeFlick(firstwait:integer);
var
desynch,des1,des2,waittime1,waittime2,randomwait1, randomwait2: integer;
begin
waittime2:= TICK
waittime1:= TICK*MSPEED;
randomwait1:= waittime1;
randomwait2:= waittime2;
des1:= 0;
desynch:=0;
writeln('Flicking');
//P07_TabInventoryTab(6)
//P07_MouseBox(669, 357, 690, 379, mouse_left);
wait(firstwait*TICK)
repeat
begin

//calculates the second waiting time
des2:= randomrange(-100,100)-desynch;
randomwait2:= waittime2+des2;

//calculates the first waiting time
des1:= random(200);
randomwait1:= waittime1-randomwait2+des1;


//actual clicking business


ClickMouse2(mouse_left);
{writeln(IntToStr(randomwait1));}
wait(randomwait2);
ClickMouse2(mouse_left);
{writeln(IntToStr(randomwait2));}
{writeln(IntToStr(randomwait1+randomwait2));}
desynch:= desynch-(2400-randomwait1-randomwait2);
{writeln(IntToStr(desynch));}
wait(randomwait1);
//randomwait is called last so there is no waiting the first time in the loop

end;
until (not InCombat)

pija

2013-03-10 08:58:53

Done

Sawyer

2013-03-10 19:38:22

How can this prayer flick without multi-threading? oh wait.. Only when in combat.. but then what if the hp gets too low? ect.. Can simba multi-thread?

pija

2013-03-10 22:21:36

From: Sawyer
How can this prayer flick without multi-threading? oh wait.. Only when in combat.. but then what if the hp gets too low? ect.. Can simba multi-thread?

Why would you get low hp if you are protecting? I have no clue about multithreading.

Element17

2013-03-11 09:32:51

No it cannot multi-thread.

pija

2013-03-11 13:48:48

I would appreciate a better solution.

Kasi

2013-03-11 14:11:19

Use Standards.

pija

2013-03-11 18:36:51

From: Kasi
Use Standards.


what do you mean?

rj

2013-03-11 19:08:10

From: pija
what do you mean?


Your script is hard to read. Enable parser in extensions menu. Go to Parser –> Format

Netzone

2013-03-12 08:56:59

Well, different mobs hit at different speed, right? I'm not sure if it's doable in pascal, but track all hits on your body, including misses, then average it out, and use that for determining the speed of the flicking.

pija

2013-03-12 15:55:06

From: Netzone
Well, different mobs hit at different speed, right? I'm not sure if it's doable in pascal, but track all hits on your body, including misses, then average it out, and use that for determining the speed of the flicking.


The monster speed is measured in GameTick intervals between each hit, it is defined by the constant or variable MSPEED, it should be a number between 3 and 10.
one GameTick is 600ms.