Your Digital Media Has Never Looked So Good

 
EnTerr
** Valued Community Member **
Topic Author
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: "IF" after statement = Syntax Error?

Fri Oct 17, 2014 6:00 pm

Roku engineers -
is there a chance you can fix this issue with the block-IF statement?
(the one where block-IF being non-first on the line causes compile error)

I'll "make you a deal" :) - if this gets fixed, i'll release a profiling script for BRS.
That is, a script that instruments channel's source code so that after a run, number of executions and times can be tallied per line.

I know it's not a tit-for-tat game but let me throw that offer as a bonus. An icing on the cake, if you will. Or opportunity to tell me to "put up or shut up". Because one, fixing that edge case is the right thing to do and shouldn't be hard. And two, it will make it easier to profile code, which comes handy in time-critical (like games) or data-processing-intensive (which most things appear to be on fw3) apps. Seems a win-win to me.
 
User avatar
Komag
Posts: 808
Joined: Fri Aug 22, 2014 3:42 am

Re: "IF" after statement = Syntax Error?

Sat Nov 22, 2014 5:38 am

Here's an example:

FOR a=0 TO (Sq[0].Count()-1)
   IF Sq[0][a].spriteDraw <> invalid THEN Sq[0][a].spriteDraw.Remove()
END FOR
FOR b=0 TO (Sq[1].Count()-1)
   IF Sq[1][b].spriteDraw <> invalid THEN Sq[1][b].spriteDraw.Remove()
END FOR

That works just fine. But this:

FOR a=0 TO (Sq[0].Count()-1): IF Sq[0][a].spriteDraw <> invalid THEN Sq[0][a].spriteDraw.Remove(): END FOR
FOR b=0 TO (Sq[1].Count()-1): IF Sq[1][b].spriteDraw <> invalid THEN Sq[1][b].spriteDraw.Remove(): END FOR

That won't compile, throws off multiple syntax errors.

This also doesn't work:
FOR a=0 TO (Sq[0].Count()-1): IF Sq[0][a].spriteDraw <> invalid: Sq[0][a].spriteDraw.Remove(): END IF: END FOR
FOR b=0 TO (Sq[1].Count()-1): IF Sq[1][b].spriteDraw <> invalid: Sq[1][b].spriteDraw.Remove(): END IF: END FOR

Gives same syntax errors

Apparently, both single-line and block IF THEN don't like being stuck into fake new lines :
 
User avatar
Komag
Posts: 808
Joined: Fri Aug 22, 2014 3:42 am

Re: "IF" after statement = Syntax Error?

Wed Jun 17, 2015 3:44 am

Maybe something has changed, or maybe this is not exactly the same situation, but I just noticed that this code of mine works fine:
   IF     dir = 1: act = TRUE ' Right ' Will act similar to Select, to expand menu to submenu for any main item
   ELSEIF dir = 3: back = TRUE ' Left ' Will act similar to Menu, to close a menu level or exit menus altogether
   ELSEIF dir = 0: sel = sel -1:   IF sel < 0 THEN sel = menuMax ' Up
   ELSEIF dir = 2: sel = sel +1:   IF sel > menuMax THEN sel = 0 ' Down
   ELSEIF dir = 4: act = TRUE ' Select/OK
   END IF

I suspect it's a different situation

Who is online

Users browsing this forum: No registered users and 1 guest