The top code sets the variable "h" to equal the SCREEN() function. It is used so the screen position is read only once. The variable then checks two places in the code where this info is polled. Now the bottom code does exactly the same thing, but it calls the SCREEN() function THREE times. You'd probably think that's the slower way to do things, but it's actually about 5 times faster!
Pete
- Looking forward to an afterlife based on attendance.
Code: (Select All)
ii = 0
FOR i = 0 TO LEN(a.ship) - 1
h = SCREEN(j, k + i)
IF h = ASC(g.flagship) OR h = g.m_asc THEN
IF h = ASC(g.flagship) THEN
ii = 1
EXIT FOR
ELSE
ii = 2
EXIT FOR
END IF
END IF
NEXT
Code: (Select All)
FOR i = 0 TO LEN(a.ship) - 1
IF SCREEN(j, k + i) = ASC(g.flagship) OR SCREEN(j, k + i) = g.m_asc THEN
IF SCREEN(j, k + i) = ASC(g.flagship) THEN
ii = 1
EXIT FOR
ELSE
ii = 2
EXIT FOR
END IF
END IF
NEXT
Pete
- Looking forward to an afterlife based on attendance.