Talk:Petit Tutorials - GOTO and IF/@comment-71.29.180.22-20140219223454

how about something like this:

INPUT "SAY hi";VAR$

WAIT 60

INPUT "SAY goodbye";VAR2$

IF VAR$=="hi" AND VAR2$=="goodbye" THEN GOTO @funny ELSE @bad

@funny

PRINT "You unlocked the secret item!!!"

END

@bad

PRINT "You missed your chance..."

END

does the AND statement work this way in SMILEBASIC? I know it has something to do with the Mathematics, since the command is listed in that section of the pdf manual, but will it work like this? I know one really long, overcomplicated way to get around this, but I would rather not do that. is there an easy way? (I will show you my complicated way with a different example)

@START

ACLS

PRINT "Welcome to Petit program selector!"

WAIT 60

SPSET 0,57,0,0,0,16,16

CURSORVARX==27

CURSORVARY==27

@LOOP

IF BUTTON==1 THEN GOSUB @UP

IF BUTTON==2 THEN GOSUB @DOWN

IF BUTTON==4 THEN GOSUB @LEFT

IF BUTTON==8 THEN GOSUB @RIGHT

SPOFS 0,CURSORVARX,CURSORVARY,0

IF CURSORVARX>15 THEN GOSUB @ICNLFTBRDR

WAIT 1

GOTO @ LOOP

@UP

CURSORVARY==CURSORVARY-10

RETURN

@DOWN

CURSORVARY==CURSORVARY+10

RETURN

@LEFT

CURSORVARX==CURSORVARX-10

RETURN

@RIGHT

CURSORVARX==CURSORVARX+10

RETURN

@ICNLFTBRDR

IF BUTTON==1 THEN GOSUB @UP

IF BUTTON==2 THEN GOSUB @DOWN

IF BUTTON==4 THEN GOSUB @LEFT

IF BUTTON==8 THEN GOSUB @RIGHT

SPOFS 0,CURSORVARX,CURSORVARY,0

IF CURSORVARX<7 THEN GOTO @ICNUPBRDR ELSE GOTO @RETURN

@RETURN

RETURN

@ICNUPBRDR

IF BUTTON==1 THEN GOSUB @UP

IF BUTTON==2 THEN GOSUB @DOWN

IF BUTTON==4 THEN GOSUB @LEFT

IF BUTTON==8 THEN GOSUB @RIGHT

SPOFS 0,CURSORVARX,CURSORVARY,0

IF CURSORVARY<10 THEN GOTO @ICNBTTMBRDR ELSE GOTO @RETURN

@ICNBTTMBRDR

IF BUTTON==1 THEN GOSUB @UP

IF BUTTON==2 THEN GOSUB @DOWN

IF BUTTON==4 THEN GOSUB @LEFT

IF BUTTON==8 THEN GOSUB @RIGHT

SPOFS 0,CURSORVARX,CURSORVARY,0

IF CURSORVARY>20 THEN GOTO @STRTYN ELSE GOTO @RETURN

@STRTYN

IF BUTTON==1 THEN GOSUB @UP

IF BUTTON==2 THEN GOSUB @DOWN

IF BUTTON==4 THEN GOSUB @LEFT

IF BUTTON==8 THEN GOSUB @RIGHT

SPOFS 0,CURSORVARX,CURSORVARY,0

IF BTRIG==16 THEN GOTO @EXECCALC ELSE GOTO @RETURN

@EXECCALC

WAIT 15

EXEC "PRG:CALC"

yeah. if I don't figure out how use an "AND" statement or shorten this code, I am fucked when it comes to coding a cursor for the upper screen.

ALSO ONE QUESTION: how do i draw pictures on the bottom screen? I need to know how!