Wu-Tang Clan
2014-01-21 17:42:51
I'm working on a cavefighter bot and I need to set up timers for the abilities. Is there a function to set up a timer and have multiple timers run at the same time? Thanks.
2014-01-21 17:42:51
2014-01-21 17:46:52
2014-01-21 17:51:24
From: hoodz
cant you just use marktime? ps: i dont know srl-6
2014-01-21 17:56:39
MarkTime(t);
MarkTime(s);
ect...
2014-01-21 17:58:58
From: Wu-Tang Clan
I need 6 timers working differently, can marktime do that?
procedure MarkTime(var time: integer);//this is what the actual marktime does
begin
time:= GetSystemTime();
end;
var
time1, time2, time3, time4: integer;
begin
MarkTime(time1);
//other code
MarkTime(time2);
//Now both time1 and time2 are representative of their current times as of the mark.
//Use TimeFromMark(integer); to determine how long has passed since the mark.
end;
2014-01-21 18:12:56
From: Kevin
Sure, just have 6 different ints for the separate timers to go through marktime.procedure MarkTime(var time: integer);//this is what the actual marktime does
begin
time:= GetSystemTime();
end;
var
time1, time2, time3, time4: integer;
begin
MarkTime(time1);
//other code
MarkTime(time2);
//Now both time1 and time2 are representative of their current times as of the mark.
//Use TimeFromMark(integer); to determine how long has passed since the mark.
end;
procedure UseAbility;
var
time1, time2, time3, time4, time5, time6: integer;
begin
MarkTime(time1);
MarkTime(time2);
MarkTime(time3);
MarkTime(time4);
MarkTime(time5);
MarkTime(time6);
if TimeFromMark(3000) then
begin
mouseBox(actionBar.getSlotBox(1),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(2),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(3),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(4),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(5),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(6),MOUSE_RIGHT,MOUSE_HUMAN);
end;
end;
2014-01-21 18:16:21
From: Wu-Tang Clan
I utterly butchered this because I did it fast, but is this in the ballpark of what it should look like?
How do I get them all to work at once so that if 15 seconds passed for the other one before 10 passed for the other it will use the 15 second one?
procedure UseAbility;
var
time1, time2, time3, time4, time5, time6: integer;
begin
MarkTime(time1);
MarkTime(time2);
MarkTime(time3);
MarkTime(time4);
MarkTime(time5);
MarkTime(time6);
if TimeFromMark(3000) then
begin
mouseBox(actionBar.getSlotBox(1),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(2),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(3),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(4),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(5),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(6),MOUSE_RIGHT,MOUSE_HUMAN);
end;
end;
2014-01-21 18:17:31
From: Wu-Tang Clan
I utterly butchered this because I did it fast, but is this in the ballpark of what it should look like?
How do I get them all to work at once so that if 15 seconds passed for the other one before 10 passed for the other it will use the 15 second one?
procedure UseAbility;
var
time1, time2, time3, time4, time5, time6: integer;
begin
MarkTime(time1);
MarkTime(time2);
MarkTime(time3);
MarkTime(time4);
MarkTime(time5);
MarkTime(time6);
if TimeFromMark(3000) then
begin
mouseBox(actionBar.getSlotBox(1),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(2),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(3),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(4),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(5),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(6),MOUSE_RIGHT,MOUSE_HUMAN);
end;
end;
procedure UseAbility;
var
time1, time2, time3, time4, time5, time6: integer;
begin
MarkTime(time1);
MarkTime(time2);
MarkTime(time3);
MarkTime(time4);
MarkTime(time5);
MarkTime(time6);
if (TimeFromMark(time1) >= 3000) then // Do them like this. You call the timer you set.
begin
mouseBox(actionBar.getSlotBox(1),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(2),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(3),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(4),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(10000) then
begin
mouseBox(actionBar.getSlotBox(5),MOUSE_RIGHT,MOUSE_HUMAN);
end;
if TimeFromMark(15000) then
begin
mouseBox(actionBar.getSlotBox(6),MOUSE_RIGHT,MOUSE_HUMAN);
end;
end;
2014-01-21 18:23:07
procedure useAbility;
var
Timers, cooldowns:TIntegerarray;
i:integer;
begin
cooldowns := [3000, 15000, 10000, 15000, 10000, 15000];
setLength(timers, 6);
for i := 0 to high(timers) do
marktime(timers[i]);
for i := 0 to high(timers) do
if (timeFromMark(timers[i]) > cooldowns[i]) then
mouseBox(actionBar.getSlotBox(1 + (1 * i)),MOUSE_RIGHT,MOUSE_HUMAN);
end;2014-01-21 18:29:51
2014-01-21 18:31:35
2014-01-21 18:41:31
From: The Mayor
There is no markTime in SRL6 (afaik)
2014-01-21 18:51:31
2014-01-21 19:25:11
2014-01-22 04:36:08
From: Ashaman88
Look at bonsai's fighter. You should be able to use the include to get the ability cooldown and know when to use the ability from that instead of this way…If I'm understanding it correctly
procedure Tnpc._doAbilities();
var
i, pct: integer;
keyStr: string;
begin
for i := (ACTION_BAR_SLOT_HIGH - 2) downto 1 do
begin
pct := actionBar.getAbilityCooldown(i);
{$IFDEF DEBUG_ON}
writeln('***** Tnpc._doAbilities: ability[', i, '] returned cooldown ', pct);
{$ENDIF}
if ((pct = 1) or (pct = 100)) then
begin
case i of
0..9: keyStr := intToStr(i);
10: keyStr := '0';
11: keyStr := '-';
12: keyStr := '=';
end;
SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));
{$IFDEF DEBUG_ON}
writeln('***** Tnpc._doAbilities: activated ability[', i, ']');
{$ENDIF}
exit; // only do one ability
end;
end;
end;
2014-01-23 21:59:46
From: Ashaman88
T: TTimeMarker;
T.Start;
T.GetTime;
procedure useAbility;
var
A: TTimeMarker;
B: TTimeMarker;
C: TTimeMarker;
D: TTimeMarker;
E: TTimeMarker;
F: TTimeMarker;
begin
A.Start;
B.Start;
C.Start;
D.Start;
E.Start;
F.Start;
A.GetTime;
if (A.GetTime < 5000) then
begin
Writeln('A: ' +IntToStr (A.GetTime));
end;
end;
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
A: 0
2014-01-23 22:05:54
2014-01-24 02:44:16
program new;
{$i srl-6/srl.simba}
var
A: TTimeMarker;
B: TTimeMarker;
C: TTimeMarker;
D: TTimeMarker;
E: TTimeMarker;
F: TTimeMarker;
procedure useAbility();
begin
Writeln('A: ' +IntToStr (A.GetTime()));
end;
begin
A.Start();
B.Start();
C.Start();
D.Start();
E.Start();
F.Start();
while (true) do
begin
useAbility();
end;
end.
2014-01-24 03:27:29
2014-01-24 09:49:34
From: Spartan 117
http://villavu.com/forum/showthread.php?t=107690
I'm sure you saw Mayor posted this already, but I just wanted to comment on it to see if it may be right for you. It finds the best ability (basic being worst, ultimate begin best) that is ready to use. I have watched in action for probably around 6-10 hours now. I have found that it is actually pretty fast for not using timers or being ready for the ability to be ready (if that makes any sense). There is close to no delay between when the ability is ready and when it is clicked. I never use any ammo unless I'm eating. It may or may not be right for your situation, but I think it could help simplify things.
2014-01-24 11:06:21
2014-01-25 10:18:31
From: Spartan 117
You could use a switch of like case(random(5)) of 0..1 click and 2..4 send key for the ability. That would be a pretty good addition.
EDIT: @Wu-Tang Clan I have edited the snippet I posted that I linked earlier. I included randomly sending the key or clicking on the slot. I tested it and still works fast and great with the new addition! when the wait times are removed it's hella fast. I put those in there for some added human-likeness.
2014-01-25 15:09:06