SRL Archive - OSR Help

Continuous Loop?


Brid Mayhem

2013-03-09 04:35:47

Is there to make a procedure run on the side of things constantly?

Sjoe

2013-03-09 05:33:27

Read Coh3n's beginner tutorial guide: check the loop section.

Brid Mayhem

2013-03-09 05:38:41

From: Sjoekeloe
Read Coh3n's beginner tutorial guide: check the loop section.

I've read it, but the thing i'm asking isn't on there.


Is it possible to have something looping continuously while the main loop is going?

IE. Have 2 loops going at once.

Sjoe

2013-03-09 05:42:11


while IsChopping; do
Antiban;

Something like this?

EDIT: if u explain what it needs to do, I'm sure someone here on this forum knows the answer.

Brid Mayhem

2013-03-09 05:45:51

Well I mean something like this:

program Example;


procedure update;
begin;
writeln('See what I'm doing here?');
end;
procedure otherThing;
begin
//do stuff
end;

procedure otherThing2;
begin
//do stuff
end;


begin
do
update;
while
doThings;
doThings2;
end.



If you understand that.

Like have the Update method constantly running, while the other things can loop through like normal.

Sjoe

2013-03-09 05:51:49

From: Brid Mayhem
Well I mean something like this:

program Example;


procedure update;
begin;
writeln('See what I'm doing here?');
end;
procedure otherThing;
begin
//do stuff
end;

procedure otherThing2;
begin
//do stuff
end;


begin
do
update;
while
doThings;
doThings2;
end.



If you understand that.

Like have the Update method constantly running, while the other things can loop through like normal.


Don't know if this will work since I don't use while..do loops often.

There's probably a better way, but what about making doThings; and doThings2; in one function
(example: DoThingsAll; ) and use:


While (DoThingsAll = True) do
Update;

Should work I guess :)

Brid Mayhem

2013-03-09 05:55:13

From: Sjoekeloe
Don't know if this will work since I don't use while..do loops often.

There's probably a better way, but what about making doThings; and doThings2; in one function
(example: DoThingsAll;) and use:


While (DoThingsAll = True) do
Update;

Should work I guess :)


I think that's just a selective loop though, like how you can set DoAllThings to check if the inventory is true, so the 'update;' would only happen when the inventory is full and not constantly :(

Well, thanks for helping anyways :)

riwu

2013-03-09 06:37:47

Search for multithreading on the forums, there are quite a few topics on this.
http://villavu.com/forum/showthread.php?t=66682&highlight=thread

In most cases it is not required to deploy multithreading for RS scripts since you can just check several conditions linearly (procedural).

rj

2013-03-09 08:41:23

i dont know if this will help but in my fletcher i have aloop that constantly checks for level up and if the bot is in the area it is done like this
  

repeat
wait(100)
checkuplevel;
if containslevel then
begin
mainloop;
exit;
end;

litoris

2013-03-09 08:54:08

From: Brid Mayhem
Well I mean something like this:

program Example;


procedure update;
begin;
writeln('See what I'm doing here?');
end;
procedure otherThing;
begin
//do stuff
end;

procedure otherThing2;
begin
//do stuff
end;


begin
do
update;
while
doThings;
doThings2;
end.



If you understand that.

Like have the Update method constantly running, while the other things can loop through like normal.


No, there is no multithreading in Simba. But as others have said, you can do things procedurally for a similar effect.