LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

New programming adventure :D

Root / Programming Questions / [.]

PixelPaintbrushCreated:
So I have a limited amount of experience, but I can understand things quite well..I've made a little title thing, and continuing into a test box for testing out thingies that I code (thanks to the wonderful people in chat for helping clean that code up!) I was always soooo close when putting things together, just never on point BUT the code is nice
ACLS
Color 8
Locate 12,10 : ?"Press to start"

REPEAT
B=button()
UNTIL B>0
CLS
@TitleInit
SPSET 0,192,480,97,18
SPOFS 0,150,50
SPSCALE 0,1,2
WAIT 5
@TitleWait
REPEAT
B=button()
UNTIL B>0
SPCLR
'---------------------
VAR run% = TRUE

WHILE run%
'TEST BOX ENV
@TESTBOX

GPRIO -20

COLOR 8

C1 = RGB (256,0,0)

GBOX 10,10,390,230, C1
WEND
fortunately now I can get some stuff done maybe...I want to add a think that will print what Button is being pressed up in the right corner and such...eventually I'm goint to remake one of my favorite games, ATARI ENDURO! love that old racer. here goes a new adventure I hope.

So I have a limited amount of experience, but I can understand things quite well..I've made a little title thing, and continuing into a test box for testing out thingies that I code (thanks to the wonderful people in chat for helping clean that code up!) I was always soooo close when putting things together, just never on point BUT the code is nice
ACLS
Color 8
Locate 12,10 : ?"Press to start"

REPEAT
B=button()
UNTIL B>0
CLS
@TitleInit
SPSET 0,192,480,97,18
SPOFS 0,150,50
SPSCALE 0,1,2
WAIT 5
@TitleWait
REPEAT
B=button()
UNTIL B>0
SPCLR
'---------------------
VAR run% = TRUE

WHILE run%
'TEST BOX ENV
@TESTBOX

GPRIO -20

COLOR 8

C1 = RGB (256,0,0)

GBOX 10,10,390,230, C1
WEND
fortunately now I can get some stuff done maybe...I want to add a think that will print what Button is being pressed up in the right corner and such...eventually I'm goint to remake one of my favorite games, ATARI ENDURO! love that old racer. here goes a new adventure I hope.
Why do you need to PRINT the button being used if you can use: IF BUTTON()==#A (OR #B,X,Y,R,L,UP,DOWN,LEFT OR RIGHT) THEN ... If you want to make something that'll do that, copy this
@L
IF BUTTON()== (# button you want) then print "(the button you set like I.e. print " A")"

So I have a limited amount of experience, but I can understand things quite well..I've made a little title thing, and continuing into a test box for testing out thingies that I code (thanks to the wonderful people in chat for helping clean that code up!) I was always soooo close when putting things together, just never on point BUT the code is nice
ACLS
Color 8
Locate 12,10 : ?"Press to start"

REPEAT
B=button()
UNTIL B>0
CLS
@TitleInit
SPSET 0,192,480,97,18
SPOFS 0,150,50
SPSCALE 0,1,2
WAIT 5
@TitleWait
REPEAT
B=button()
UNTIL B>0
SPCLR
'---------------------
VAR run% = TRUE

WHILE run%
'TEST BOX ENV
@TESTBOX

GPRIO -20

COLOR 8

C1 = RGB (256,0,0)

GBOX 10,10,390,230, C1
WEND
fortunately now I can get some stuff done maybe...I want to add a think that will print what Button is being pressed up in the right corner and such...eventually I'm goint to remake one of my favorite games, ATARI ENDURO! love that old racer. here goes a new adventure I hope.
Why do you need to PRINT the button being used if you can use: IF BUTTON()==#A (OR #B,X,Y,R,L,UP,DOWN,LEFT OR RIGHT) THEN ... If you want to make something that'll do that, copy this
@L
IF BUTTON()== (# button you want) then print "(the button you set like I.e. print " A")"
erm....what?

You said you wanted to print the button you of click
that will print what Button is being pressed up in the right corner and such...
So I.e. (print A, button went pressed)
@L
IF BUTTON()==#A THEN PRINT "YOU PRESSED 'A' "
WAIT 1:GOTO @L
But you need to use LOCATE print on the time right

You said you wanted to print the button you of click
that will print what Button is being pressed up in the right corner and such...
So I.e. (print A, button went pressed)
@L
IF BUTTON()==#A THEN PRINT "YOU PRESSED 'A' "
WAIT 1:GOTO @L
But you need to use LOCATE print on the time right
Right so here's what I got
ACLS

PRINT "BUTTON DETECTION"
REPEAT
B=BUTTON()
UNTIL B>0
CLS

GBOX 250,10,360,50

@BUTTON
REPEAT
B=BUTTON()

LOCATE 32,2
PRINT B
UNTIL B>0
GOTO @BUTTON


I just can't get it to erase the number it displays after I quit pressing x.x

You said you wanted to print the button you of click
that will print what Button is being pressed up in the right corner and such...
So I.e. (print A, button went pressed)
@L
IF BUTTON()==#A THEN PRINT "YOU PRESSED 'A' "
WAIT 1:GOTO @L
But you need to use LOCATE print on the time right
Right so here's what I got
ACLS

PRINT "BUTTON DETECTION"
REPEAT
B=BUTTON()
UNTIL B>0
CLS

GBOX 250,10,360,50

@BUTTON
REPEAT
B=BUTTON()

LOCATE 32,2
PRINT B
UNTIL B>0
GOTO @BUTTON


I just can't get it to erase the number it displays after I quit pressing x.x
Oh...

yeah...any ideas on how to get it to..well behave?

yeah...any ideas on how to get it to..well behave?
Maybe IF BUTTON()==0 THEN CLS

I just can't get it to erase the number it displays after I quit pressing x.x
I can't really tell but is your problem, then, the extra digits not being written over? the easy way to fix that would be
@BUTTON
 REPEAT
  B=BUTTON()

  LOCATE 32,2
  REM print blanks over the unused spaces
  PRINT B + (4 - LEN(STR$(B))) * " "
 UNTIL B>0
GOTO @BUTTON
If that's not it, your loop logic might be wrong. You uh could just have a fencepost print after the UNTIL? I guess I'm not really sure what's going on here.