SRL Archive - Help

Terminating and restarting a script.


zluo

2012-07-14 19:56:04

Is it possible to terminate a simba script, then immediately run it again? I simply want my script to start over from the top of a repeat loop in the mainloop.
This procedure is not in the mainloop and is only called as a backup in other procedures. After I peform this backup procedure, is it possible to do something like restartrepeatloop; or something :S

YoHoJo

2012-07-14 19:57:56

http://villavu.com/forum/showthread.php?t=76404&highlight=smart+manager

Enter

2012-07-14 20:23:58

From: YoHoJo
http://villavu.com/forum/showthread.php?t=76404&highlight=smart+manager


I use the Smart Manager, but sometimes when it restarts simba and opens the client after 6 hours. I wake up to find the script not running? I thought Smart Manager restarted everything and restarted the script too. I tried failsafe, restart compile and force restart and none of them fix the problem. Also I heard there was a problem with smart recently because of Slayer update, is it fixed?

Runaway

2012-07-14 20:31:21

From: zluo
Is it possible to terminate a simba script, then immediately run it again? I simply want my script to start over from the top of a repeat loop in the mainloop.
This procedure is not in the mainloop and is only called as a backup in other procedures. After I peform this backup procedure, is it possible to do something like restartrepeatloop; or something :S


Jah. Just put it inside a repeat loop!


repeat
repeat
MainLoop;
if Failsafe then
Break;
until(Whatever);
FailsafeLoop;
until(Whatever);

Something kinda like that.

P1ng

2012-07-14 20:36:55

I use the Smart Manager, but sometimes when it restarts simba and opens the client after 6 hours. I wake up to find the script not running? I thought Smart Manager restarted everything and restarted the script too. I tried failsafe, restart compile and force restart and none of them fix the problem. Also I heard there was a problem with smart recently because of Slayer update, is it fixed?


The update still has smart broken
Also, sometimes I have this issue because of the FPS error that was occuring in smart where it would take a long time to load the game and the script would time out after waiting for up to 3mins for it to load

putonajonny

2012-07-14 20:45:40

Using Continue makes it start from the begining of the loop:
Repeat
//Do some stuff
if(SomethingIsTrue)then //If that something is true it goes back to before "Do some stuff"
Continue;
//Do other stuff
Until(false);

Enter

2012-07-15 01:49:33

I had the problem BEFORE the slayer update though, maybe the script didn't have the repeat until part? Anyway, can you just load up rs from the site and make the script rn on that? The only bad thing would be it doesn't restart after 24/hrs, but that's better than nothing right?

zluo

2012-07-15 01:56:31

From: putonajonny
Using Continue makes it start from the begining of the loop:
Repeat
//Do some stuff
if(SomethingIsTrue)then //If that something is true it goes back to before "Do some stuff"
Continue;
//Do other stuff
Until(false);



so like if it was this,

Repeat
stuff;
stuffff;
stiffffffff;
stufffffffffffffff;
morestuff;
mheapsmorestuff;
if(SomethingIsTrue)then //If that something is true it goes back to before "Do some stuff"
Continue;
//Do other stuff
Until(false);


and there was a lot of procedures sandwiched in between, would it detect "somethingistrue" anywhere and everywhere no matter where it is in the repeat loop right?
if not is there a way to?

riwu

2012-07-15 03:02:53

It will check for the boolean (SomethingIsTrue) at the place that u call it.
Eg.
Action1;
if SomethingIstrue then
Continue;
Action2;

Its going to perform Action1, then checks for SomethingIsTrue, then if thats false it will continue to Action2. If u want it to check at several places then u have to call it in between every procedure.

putonajonny

2012-07-15 05:22:34

From: zluo
so like if it was this,

Repeat
stuff;
stuffff;
stiffffffff;
stufffffffffffffff;
morestuff;
mheapsmorestuff;
if(SomethingIsTrue)then //If that something is true it goes back to before "Do some stuff"
Continue;
//Do other stuff
Until(false);

and there was a lot of procedures sandwiched in between, would it detect "somethingistrue" anywhere and everywhere no matter where it is in the repeat loop right?
if not is there a way to?


Yes that's fine, it wouldn't matter how many functions / procedures it has to "jump past" it will always go to the beginning of the Repeat loop

It also works with while and for loops:
for i := 1 to 5 do
begin
if(i = 3)then
Continue;
WriteLn(i);
end;
Would output:
1
2
4
5
This is because when i = 3 it jumps to the next iteration of the loop