SRL Archive - OSR Help

[Script writing question]


hakishakataki

2014-07-28 14:12:42

Is it possible that I can write in a game timer in the script and have procedures act according to that game timer?

Example: I want to write a Nightmare Zone script.

The first layer to that script would be a procedure that that flicks the prayer on/off ever minute.
the next layer would be a procedure that redoses on overloads every 'x' amount of time
and the final layer would be one that redoses on absorbtions.

all of these procedures would be running off of a 'world clock', where when the script starts, the world clock starts and after every certain amount of time that passes on the world clock, these procedures do their thing.

If my logic in this script idea is bunk, please dont be afraid to correct/tell me so.

cosmasjdz

2014-07-28 15:28:24

From: hakishakataki
Is it possible that I can write in a game timer in the script and have procedures act according to that game timer?

Example: I want to write a Nightmare Zone script.

The first layer to that script would be a procedure that that flicks the prayer on/off ever minute.
the next layer would be a procedure that redoses on overloads every 'x' amount of time
and the final layer would be one that redoses on absorbtions.

all of these procedures would be running off of a 'world clock', where when the script starts, the world clock starts and after every certain amount of time that passes on the world clock, these procedures do their thing.

If my logic in this script idea is bunk, please dont be afraid to correct/tell me so.


procedure repeatshit();
var
t: ttimemarker;
p: boolean;
begin
t.start();
p:= false;
repeat
repeat
wait(250); //for example
until t.gettime()>60000; //one minute
Mousebox(prayerbutton.x,prayerbutton.y, mouse_left);
if p=false then P:=true else p:=false;
writeln(tostring(p));
t.reset();
until false; //if you wana forever or other condition
end;

and so on….. atleast i do some kind of this stuff like this

The Mayor

2014-07-28 16:32:04

On phone so can't give you example code.

You could have 3 global integer variables which hold the time for your three 'stopwatches'. You would have one procedure called checkTimers, and call that everywhere you want to check the timers. The checkTimer procedure would check all of your timers, such as:

If timeFromMark(prayerTimer) > 60000 then togglePrayer

So if it's been more than 60s since you last started the timer it will run the togglePrayer procedure. At the end of the toggle prayer procedure you would markTime(prayerTimer) to reset the timer.

hakishakataki

2014-07-28 19:11:29

hmm, thanks guys! this helps a bunch!

Hoodz

2014-07-28 19:23:02

From: hakishakataki
Is it possible that I can write in a game timer in the script and have procedures act according to that game timer?

Everything is possible my brother ;)

hakishakataki

2014-07-29 14:48:14

From: hoodz
Everything is possible my brother ;)


all you have to do is believe :spongebob: