SRL Archive - Help

"TimeRunning" help please.


Irae

2012-09-04 20:02:02

Hi everyone i'm currently stuck trying to work a timerunning into one of my scripts and this is the procedure…

procedure teleaftertime;
begin
if TimeRunning (300000) = True;
then
typesend('::shops')
end;

I know I probably have it wrong but if someone can point me into the right direction that would be great… If you can't tell what i'm trying to do its that after 300 seconds (5 minutes) to teleport out using '::shops' but i want the script to keep checking to see if its time ti teleport out even in combat. If someone has the skill to help me out that would be greatly appreciated :D

YoHoJo

2012-09-04 20:09:09

If TimeRunning=300000 Then
Assuming you have a function called TimeRunning set/started.

Runaway

2012-09-04 20:11:44

Hey Irae,

The function TimeRunning results a string with hours, minutes, and seconds. What you want to use is MarkTime and TimeFromMark:


var
t: Integer;
// ^ declared globally

MarkTime(t);
// ^ call MarkTime before your main loop
repeat
if (TimeFromMark(t) > (5 * 60 * 1000)) then
TypeSend('::shops');
// FightSomething;
// EatWhatever;
until(False);

Hopefully no further explanation is needed :)

Irae

2012-09-04 20:18:22

From: Runaway
Hey Irae,

The function TimeRunning results a string with hours, minutes, and seconds. What you want to use is MarkTime and TimeFromMark:


var
t: Integer;
// ^ declared globally

MarkTime(t);
// ^ call MarkTime before your main loop
repeat
if (TimeFromMark(t) > (5 * 60 * 1000)) then
TypeSend('::shops');
// FightSomething;
// EatWhatever;
until(False);

Hopefully no further explanation is needed :)


Ok im still new but let me see if I get this… I need to add the "t: Integer;" to my variables and place the "marktime(t);" as a new procedure and place it at the beginning of my loop?

riwu

2012-09-04 21:22:15

You can place everything under a single procedure. And if you want to repeat it, you will need 2 loops, 1 given by Runaway, and another to repeat the MarkTime(t) and the initial repeat loop.