Page 1 of 1

whats wrong with this script?

Posted: 04.04.2020 19:14
by 01101011

Code: Select all

Program Test;
Var
fx, fy : integer;

const
x0 = 0;
x1 = 10;
y0 = 0;
y1 = 10;

procedure Find;
begin
    for fy := 0  to ((y1 - y0) / 5) do
    begin
        for fx := 0  to ((x1 - x0) / 5) do
        begin              
            addtosystemjournal(fx + ' - ' + fy);
        end; 
    end;
end;


Begin    
    Find;
End.
00:00:00:000 [name]: Compiler: [Error] (C:\Stealth\Scripts\test.sc at 13:37): Type mismatch
00:00:00:000 [name]: Compiling failed
ty for att =]]]]

Re: whats wrong with this script?

Posted: 04.04.2020 20:22
by Vizit0r
operand / returns number with floating point (single, extended, double)
operant div returns whole number (integer, word and other integral types)

float types cant be used in "for to do" cycles condition

Code: Select all

Program Test;
Var
fx, fy : integer;

const
x0 = 0;
x1 = 10;
y0 = 0;
y1 = 10;

procedure Find;
begin
    for fy := 0 to ((y1 - y0) div 5) do
    begin
        for fx := 0  to ((x1 - x0) div 5) do
        begin             
            addtosystemjournal(IntToStr(fx) + ' - ' + IntToStr(fy));
        end;
    end;
end;


Begin   
    Find;
End.

Re: whats wrong with this script?

Posted: 04.04.2020 20:38
by 01101011
ty bro =]