...
in$=INKEY$()
...
// - - - SAVE
IF mb1
IF BOXCOLL( mx, my, 0, 0, 1175, 716, 114, 25) // save gomb kattintás érzékelés
GRABSPRITE 100,4,39,668,707
SAVESPRITE txt$+".bmp",100
load = 1
ENDIF
ENDIF
//----------------------------------------------------------------------------
The save sprite command does not execute, there is no saved sprite file afterwards.
Does the box collision section get called ?
If so, is the filename correct ? Can you actually save to the path ? What platform is it for ?
Does the box collision section get called ?
If so, is the filename correct ? Can you actually save to the path ? What platform is it for ?
Everything is ok.
The platform is XP.
The "txt$" variable is empty.
it works with input command
Maybe the problem is caused by an added closing character at the end of the variable.
Did you get your 'INKEY' code from the help file?
Are you appending the 'in$' variable to the 'txt$' variable, such as:
in$ = INKEY$()
IF in$<>"" THEN txt$ = txt$ + in$
Or try hard coding the file name to make sure the save command is at least correct:
txt$ = "test"
SAVESPRITE txt$ + ".bmp",100
If you are trying to get the user to input the filename, you could try this command:
QuoteINPUT in$, x#, y#
Waits with a blinking carret for a user input at location x#, y#.
IF BOXCOLL( mx, my, 0, 0, 1175, 716, 114, 25)
should property been:
IF BOXCOLL( mx, my, 1, 1, 1175, 716, 114, 25)
you cannot give 0 px in width and height and hence its cannot check the collosiion.
Bixcoll is correctly work is "0,0"
here is code (simply version)
txt$=""
a = 0
WHILE TRUE
IF KEY(14)
clear$ = INKEY$() // buffer clear
IF a > 0
a = a - 1
txt$=MID$(txt$, 0, LEN(txt$)-1) // Backspace
ENDIF
ELSE
IF a<10
in$=INKEY$()
IF in$<>""
txt$=txt$+in$
a = a + 1
ENDIF
clear$ = INKEY$() // buffer clear
ENDIF
clear$ = INKEY$() // buffer clear
ENDIF
PRINT txt$, 50, 100
IF KEY(28)
GRABSPRITE 100,4,39,668,707
SAVESPRITE txt$+".bmp",100
PRINT "saved",10,10
SHOWSCREEN
KEYWAIT
ENDIF
SHOWSCREEN
WEND
END
I will not run :(
Edit: Inserted code blocks for easy reading /Moru
If the code is such:
...
SAVESPRITE "test.bmp",100
...
is work...hmmm
Try changing:
txt$=MID$(txt$, 0, LEN(txt$)-1) // Backspace
to:
txt$=MID$(txt$, 0, a) // Backspace
...since 'a' holds the size of 'txt$'.
or change to:
txt$=MID$(txt$, 0, LEN(txt$)-2) // Backspace
it may not be removing the last character.
Change to this:
PRINT ">" + txt$ + "<", 50, 100
to see range/size of string. It may have garbage in it.
NICE THANKS :nw:
is correctly code:
txt$=""
a = 0
WHILE TRUE
SLEEP 25
IF KEY(14)
clear$ = INKEY$() // buffer clear
IF a > 0
a = a - 1
txt$=MID$(txt$, 0, a) // Backspace
ENDIF
ELSE
IF a<10
in$=INKEY$()
IF in$<>""
txt$=txt$+in$
a = a + 1
ENDIF
clear$ = INKEY$() // buffer clear
ENDIF
clear$ = INKEY$() // buffer clear
ENDIF
PRINT txt$, 0, 100
IF KEY(28)
txt$=MID$(txt$, 0, a-1) // Backspace
GRABSPRITE 100,4,39,668,707
SAVESPRITE txt$+".bmp",100
PRINT "saved",10,10
SHOWSCREEN
KEYWAIT
ENDIF
SHOWSCREEN
WEND
END
[EDIT] Added CODE tags - makes reading code easier. Ian