SRL Archive - Help and Support

how do u use GOTO, (i know its outdated!)


lardmaster

2006-10-20 23:28:02

look, everywhere i go and everyone i ask tells me that it is outdated, but i think in this case it is necesary to make the script simple


begin
for p:=1 to length(s) do begin
Temp2 := Copy ( s, p, 8 );
if Temp2 = 'artist: ' then begin
Temp2:='';
j:=p+8;
for j:=p+8 to p+26 do begin
Result := Result + s[j];
if (GetKeyCode(s[j+1]) = 186)then GOTO finish;
end;
end
end;

finish:

end;

the goto necesary line is imbedded inside two if statements and two for statements, unless there is some double break command, i need to know how to make a goto statement. help appreciated.

Flyboy

2006-10-21 00:32:10

if( GetKeyCode( s[j+1] ) = 186 )then 
break;
this will break you out of the loop. You could do a repeat / until or while() / do

lardmaster

2006-10-21 12:39:25

no, i ran it through that before step by step, and it only breaks out of one while/for loop :(

Yakman

2006-10-21 12:43:44

i think the procedure "exit;" gets out of the procedure, but i dont use it so much

iv seen a lot of "if(not loggedin)then exit;" in SRL, so i can only assume it does that

if that fails make a boolean variable called doublebreak then do


if( GetKeyCode( s[j+1] ) = 186 )then
doublebreak:=true
then in the two for loops for

if(doublebreak)then break

lardmaster

2006-10-21 12:52:12

ok, i had something like that before in my script, and i was hoping to simplify it, i guess i will have to re-implement it.