PDA

View Full Version : a few simple questions



weaselforce
04-03-2006, 12:58 AM
is there a command to just stop whatever the script it doing. lets say for instance i set it to do something for 10 seconds, but if it spots this color it stops what it was doing and goes to the next command.

also just to clarify, if a command returns a result, you can use result = *** to assign it to a variable?

Pwnd
04-03-2006, 01:07 AM
If it is in a loop.. you can use Exit;

Jagex_Fagex
04-03-2006, 03:43 AM
i think you need result:= *** i can't think properly at the moment...

phantombmx
04-03-2006, 04:47 AM
use 'result:=blah' in a function like below

function BlahFound:Boolean;
begin
if(blahblah=blah)then
begin
result:=true
else
result:=false
end;
this would return true if it blahblah=blah.. so for instance if it finds a color then it will return true, otherwise false..
it can also be used with integers and other variables like so

function BlahNumber:Integer;
begin
if(blahblah=blah)then
begin
result:=13
else
result:=0
end;

this is very useful as it kind of eliminates lots of coding.. one example is the LoggedIn function..

hope that helps

weaselforce
04-03-2006, 05:36 AM
thank you :) helped alot

XxKanexX
04-03-2006, 05:52 AM
Just some other useful commands.

Break: if in a loop then it exits it, Example:


var i: integer;
begin
repeat
wait(200);
i:= i + 1;
if (i = 5) then
break;
writeln(inttostr(i));
until(false);
writeln('i is now 5.');
end.


Exit: Exits a procedure or function and continues on the main loop:


procedure Hi;
var i: Integer;
begin
repeat
wait(20);
i:= i + 1;
if (i = 20) then
exit;
writeln(inttostr(i));
until(false);
Writeln('The script never reaches here due to the exit.');
end;

begin
Hi;
Writeln('Continueing..');
end.


Terminatescript: Immediatly stops the script wherever:


begin
Terminatescript;
Writeln('...');
end.

or:


procedure Wee;
begin
Terminatescript;
end;

begin
Wee;
Writeln('..');
end.


:) <3