SRL Archive - OSR Help

MarkTime


schnubbel15

2012-11-30 19:28:53

Hey,
i got a problem with MarkTime and TimeFromMark…

What i want to do: if Button X is pressed the counter should start. Next time x needed to be pressed it should check if timer is running for more then 5 seconds (cooldown). and after that it should reset the timer to 0. heres what i got:

begin
MarkTimer(t);
If (TimeFromMark(t) > 5000) Then
begin
SendKeys('1', 100, 30);
t:= 0;
end else
Wait(50);
end;

Thanks :)

Laimonas171

2012-11-30 19:32:56

From: schnubbel15
Hey,
i got a problem with MarkTime and TimeFromMark…

What i want to do: if Button X is pressed the counter should start. Next time x needed to be pressed it should check if timer is running for more then 5 seconds (cooldown). and after that it should reset the timer to 0. heres what i got:

begin
MarkTimer(t);
If (TimeFromMark(t) > 5000) Then
begin
SendKeys('1', 100, 30);
t:= 0;
end else
Wait(50);
end;
Thanks :)

Use SIMBA TAGS! :X

EDIT: I guess that's what you wanted.
begin
MarkTimer(t);
Repeat
SendKeys('1', 100, 30);
Until(TimeFromMark(t) > 5000);
t:= 0;
end;

Rezozo

2012-11-30 19:32:57

I don't understand your concept…

schnubbel15

2012-11-30 19:36:08

its just the procedure which i cant get to work.. :o just want to know how exactly MarkFromTime and TimeMark works and how i can reset it :/

Laimonas171

2012-11-30 19:36:44

From: schnubbel15
its just the procedure which i cant get to work.. :o just want to know how exactly MarkFromTime and TimeMark works and how i can reset it :/


I edited, my first post check it out or that's what you wanted?

Rezozo

2012-11-30 19:43:34

I don't think so. Hey nubbel, use this:
Procedure Checker;
Var
t:integer;
Begin
if (isKeyDown(88)) then
MarkTime(t); //lol
repeat
Until (isKeyDown(88));
If (TimeFromMark(t) > 5000) Then
begin
SendKeys('1', 100, 30);
t:= 0;
end
else
Wait(50);
End;

I think that should do it, try it just in case.

schnubbel15

2012-11-30 19:44:34

not exactly, i want it the other way, it should start WHEN the timer is over 5 seconds :/ and 1 more question is a timer always a global timer? will it continue to count the time when i am in another procedure? (sorry for my bad english :P)

Ian

2012-11-30 19:46:08

Isn't it "MarkTime(t)"?

Rezozo

2012-11-30 19:46:58

Check out mine, or wait, are you referring to mine?
Technically, yes, timer is a global timer, and can be used in other procedures, while still counting the seconds, and give the correct output. But remember, if you use MarkTime(t); The t must be a global variable, or it wont work outside the procedure.
~Rez

Edit: Ooh, didn't notice that BMWXi, nice catch.

Le Jingle

2012-11-30 19:48:39


var
t: integer; // declared "globally," meaning the entirety of the file has access to integer, t.

procedure something;
var
tt: integer; // declared "locally," meaning integer tt can only be used within this procedure
begin
marktime(tt); // only marks integer tt to 0 milliseconds
repeat
wait(1000+random(100));
until(TimeFromMark(tt) > 5000);
// above loop will wait until the marked time, tt, is greater than 5000 ms.
end;

begin
something;
end.

^ to provide an example

schnubbel15

2012-11-30 19:50:25

mhm, i dont really get your code :o

this is what i think it should look like…(doesnt work)


begin
MarkTime(t);
Repeat
SendKeys('1', 100, 30);
Until(TimeFromMark(t) < 2000);
t:= 0;
end;

Laimonas171

2012-11-30 19:53:45

From: Rezozo
I don't think so. Hey nubbel, use this:
Procedure Checker;
Var
t:integer;
Begin
if (isKeyDown(88)) then
MarkTime(t); //lol
repeat
Until (isKeyDown(88));
If (TimeFromMark(t) > 5000) Then
begin
SendKeys('1', 100, 30);
t:= 0;
end
else
Wait(50);
End;

I think that should do it, try it just in case.

I did copy paste from his code :D my bad.

Ian

2012-11-30 19:54:53

@schnubbel
You need t to be declared as an integer:
 Var 
t:Integer;

schnubbel15

2012-11-30 19:57:27

yea i know, i have it its just a cut out, but when i run it it only spams the "1" key :/ cant find my mistake

Ian

2012-11-30 20:05:10

From: schnubbel15
yea i know, i have it its just a cut out, but when i run it it only spams the "1" key :/ cant find my mistake


Change "<" to " >"

schnubbel15

2012-11-30 20:07:18

already did, like i said it will spam the 1 key :(

Ian

2012-11-30 20:11:48

Could you post what you have?

schnubbel15

2012-11-30 20:14:42

(its just a script to test the Timer thing…:P)


var
t: Integer;

procedure test;
var
x, y: Integer;
Skill: Integer;
begin
MarkTime(11t);
Repeat
SendKeys('1', 100, 30);
Until(TimeFromMark(t) < 5000);
t:= 0;
end;



begin
SetupSRL;
Wait(5000);
repeat
test;
wait(10000);
until false;
end.

P1ng

2012-11-30 20:16:08

procedure Timer;
var
T: Integer;
begin
MarkTime(T); //Makes T = 0 ms
repeat //Tells the script to repeat between here and until
if (TimeFromMark(t) > 5000) then //if Time >5sec then press button and reset timer
begin
SendKeys('1', 100, 30);
T := 0;
end else
Wait(50); //otherwise just wait another 50 ms
until(False); //Tells the script to repeat forever
end;

Le Jingle

2012-11-30 20:18:02

if you are simply trying to press 1 for the action bar, not more times than needed;

if WaitFunc(@PlayerChatActive, 100, 5000) then
TypeByte(VK_1);

schnubbel15

2012-11-30 20:27:37

mhh could u explain it a bit? (sorry that im such noobish)

schnubbel15

2012-12-01 03:16:34

so… i figured out that my only problem atm is that i cant set the marktime back to 0:/

Ashaman88

2012-12-01 08:55:23

From: schnubbel15
so… i figured out that my only problem atm is that i cant set the marktime back to 0:/


Why not just marktime again?