Files

FILES ["FileType:"]
FILES "[FileType:] ProjectName"

Display a List of Files on the Console

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success and 0 for failure.

Arguments

FileType

Specify when you want to display a specific file type.

・If not specified, all files will be displayed.

ProjectName

The name of the project for which you want to get a list

・If not specified, a list of files in the current project will be displayed.

Example

FILES
FILES "TXT:PROJECT" 

FILES "//"

Display a List of Projects on the Console

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success and 0 for failure.

Argument

"//"

If "//" is specified, the project list is displayed.

Example

FILES "//" 

FILES(["FileType:"])
FILES("[FileType:] ProjectName")

Create an Array Containing a List of Files and Projects

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success and 0 for failure.

Arguments

FileType

Specify when you want to get a specific file type

・If not specified, all files are acquired.

ProjectName

The name of the project for which you want to get a list

・If not specified, get a list of files in the current project.

Return Value

A string array containing a list of files

Example

NAMETBL$ = FILES()
FOR I=0 TO LAST(NAMETBL$)
 ?NAMETBL$[I]
NEXT

FILES("//")

Create an Array Containing a List of Projects

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success and 0 for failure.

Argument

"//"

If "//" is specified, the project list is acquired.

Return Value

A string array containing a list of projects

Example

NAMETBL$ = FILES("//")
FOR I=0 TO LAST(NAMETBL$)
 ?NAMETBL$[I]
NEXT

FILES ["FileType:",]StringArray
FILES "[FileType:]ProjectName,StringArray

Get a List of Files in Array

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success and 0 for failure.

Arguments

FileType

Specify when you want to get a specific file type

ProjectName

The name of the project for which you want to get a list.

・If not specified, get a list of files in the current project.

StringArray

・A string array that stores the file names in the file list.
・In the case of a one-dimensional array, it is automatically expanded according to the number of acquired files.

Example

DIM NAMETBL$[]
FILES NAMETBL$
FOR I=0 TO LAST(NAMETBL$)
 ?NAMETBL$[I]
NEXT

FILES "//",StringArray

Get a List of Projects in Array

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success and 0 for failure.

Arguments

"//"

If "//" is specified, the project list is acquired.

StringArray

・A string array that stores the project names in the project list.
・In the case of a one-dimensional array, it is automatically expanded according to the number of acquired files.

Example

DIM NAMETBL$[]
FILES "//", NAMETBL$
FOR I=0 TO LAST(NAMETBL$)
 ?NAMETBL$[I]
NEXT

LOAD "[FileType:]FileName"[,Slot]

Load the Program

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

Only TXT can be specified as the file type

・If not specified, TXT is specified.

FileNameString

File name to read

Slot

Slot to read program: 0-3

・0, if not specified.

Example

LOAD "PROGNAME" 
LOAD "SUBPROG",1

LOADG "[FileType:]FileName",GraphicPage[,OX,OY]
LOADG "[FileType:]FileName",GraphicPage[,OX,OY] OUT Width,Height

Load Image Files

・When the offset is specified, the protruding part is ignored.
・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

GRP, JPG or DAT can be specified

・If not specified, GRP is specified.
・If DAT is specified, files other than 2D Int arrays will result in an error.

FileNameString

File name to read

GraphicPages

Graphic pages for storing read image data: 0 to 5

OX,OY

Destination coordinates for an image

・If not specified, 0,0 is specified.

Return Value

Width,Height

The width and height of the loaded image data

Example

LOADG "GRPDATA",1
LOADG "DAT:DATA",2,0,64
LOADG "GRPDATA",2 OUT W,H

LOADV("FileType:FileName")

Read File Contents and Return as String or Array

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

DAT, TXT, GRP can be specified

・Cannot be omitted.

FileName

File name to read

Return Value

Contents of the read file

・If DAT and GRP are specified, it returns an array containing the data in the DAT and GRP files.
・If reading DAT and GRP files fails, it returns a 1D Int solution with 0 number of elements.
・When TXT is specified, it returns the string of the TXT file contents.
・If reading the TXT file fails, it returns an empty string.

Example

TX$=LOADV("TXT:MEMOFILE")
DT=LOADV("DAT:DATAFILE")

LOADV "FileType:FileName",Array

Read the Contents of a File into an Array

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

DAT, GRP can be specified

・Cannot be omitted.

FileName

File name to read

Array

Array variable that stores the read data

・The dimension of the array data stored in the file to be read must match the dimension of the target array.
・When specifying a string array, the data in the file must also be saved from the string array.
・The number of array elements is automatically expanded according to the information in the file.

Example

DIM MARRAY[]
LOADV "DAT:MDATA",MARRAY

SAVE "[FileType:]FileName"[,Slot]

Save the Program

・When overwriting, the file before overwriting is saved as @BACKUP.PRG.
・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

Only TXT can be specified

・If not specified, TXT is specified.

FileName

File name to give to the program to save

Slot

Slot number for programs to save: 0-3

・0, if not specified.

Example

SAVE "TEST" 
SAVE "TEST2",2

SAVEG "[FileType:]FileName",GraphicPage[,StartPointX,StartPointY,Width,Height]

Save Graphic Page Contents to File

・When overwriting, the file before overwriting is saved as @BACKUP.GRP.
・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

Only GRP can be specified

・If not specified, GRP is specified.

FileName

Name to give the save file

GraphicPages

Graphic pages to save: 0-5

StartPointX,StartPointY

Specify the upper left coordinate of the area you want to save (0 and 2047 for both X and Y)

・If not specified, 0,0 is specified.

Width,Height

Specify the size of the area you want to save (both width and height are 1 to 2048)

・An error occurs if the result of adding the start point X and width or the start point Y and height exceeds 2048.
・If not specified, 2048,2048 is specified.

Example

SAVEG "GRP:GAZOU",0
SAVEG "GAZOU_ICHIBU",3,100,100,300,300

SAVEG "JPG:FileName",GraphicPage[,StartPointX,StartPointY,Width,Height] [,CompressionAmount]

Save the Contents of a Graphic Page to a File in High Compression Format

・The high compression format can be saved in a smaller file than the normal compression format, but the image quality decreases each time when it is saved (lossy compression).
・When overwriting, the file before overwriting is saved as @BACKUP.JPG.
・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

Only JPG can be specified

FileName

Name to give the save file

GraphicPages

Graphic pages to save: 0-5

StartPointX,StartPointY

Specify the upper left coordinate of the area you want to save (0 and 2047 for both X and Y)

・If not specified, 0,0 is specified.

Width,Height

Specify the size of the area you want to save (both width and height are 1 to 2048)

・An error occurs if the result of adding the start point X and width or the start point Y and height exceeds 2048.
・If not specified, 2048,2048 is specified.

CompressionAmount

Specify a value that represents the compression amount and image quality (1 to 100)

・The smaller the number, the higher the compression ratio, but the image quality decreases.
・The default is 60.

Example

SAVEG "JPG:GAZOU",0,80
SAVEG "JPG:GAZOU_ICHIBU",3,100,100,300,300

SAVEV "FileType:FileName",Variable

Save Variable Contents to File

・When overwriting, the file before overwriting is saved as @BACKUP.TXT or @BACKUP.DAT.
・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

TXT, DAT, GRP can be specified

・Cannot be omitted.

FileName

Name to give to saved file

Variable

Variables that stores the data you want to save

・For TXT, specify a string variable.
・For DAT, specify an array. There are no restrictions on the type or dimension of the array.
・For GRP, specify a 2D Int array.

Example

SAVEV "TXT:MEMO",TX$
DIM MAP[10,10]
SAVEV "DAT:MAP",MAP
DIM IMG%[32,32]
SAVEV "GRP:IMG",IMG%

PROJECT()

Get the Current Project

Return Value

The name of the current project

EXEC "[FileType:]FileNameString"[,Slot]

Loading and Executing Programs

・Cannot be executed in DIRECT mode.
・The variables of the specified slot, SPFUNC, TFUNC setting contents will be cleared.
・If the currently executing slot is specified, the currently executing program will be replaced by the specified program, and execution will end at END of the specified program.
・If a slot other than the currently executing slot is specified, the program in the specified slot is executed, and when the END command is executed, it returns to the next command of EXEC.
・When specifying a slot, only the slot that is currently executing and the slot where there is no code that may be executed can be specified.

Arguments

FileType

Only TXT can be specified

・If not specified, TXT is specified.

FileName

File name of program to be read

Slot

Slot to read program

・If not specified, the currently executing slot is specified.

Example

EXEC "SAMPLE" 
EXEC "SBGED",1

EXEC Slot

Run the Program in the Specified Slot

・Cannot be executed in DIRECT mode.
・The variables of the specified slot, SPFUNC, TFUNC setting contents will be cleared.
・If the currently executing slot is specified, the currently executing program is executed again from the beginning.
・If a slot other than the currently executing slot is specified, the program in the specified slot is executed, and when the END command is executed, it returns to the next command of EXEC.
・When specifying a slot, only the slot that is currently executing and the slot where there is no code that may be executed can be specified.

Argument

Slot

Slot number of program to execute: 0-3

・The currently executing slot cannot be specified.

Example

EXEC 2

CHKFILE("[FileType:]FileNameString")

Check if the specified file exists

Arguments

FileType

File type to check

・If not specified, TXT is specified.

FileName

File name to check

Return Value

Returns 1 if it exists, 0 if it does not exist

Example

A=CHKFILE("SBATTACK")
B=CHKFILE("GRP:SBATTACK")

DELETE "[FileType:]FileName"

Deleting Files

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType

The type of files you want to delete

・If not specified, TXT is specified.

FileName

File name to be deleted

Example

DELETE "TEST" 
DELETE "GRP:PICTURE" 

RENAME "[FileType1:]FileName1","[FileType2:]FileName2"

Rename the File

・The execution result can be obtained with the RESULT function.
・The value of RESULT is 1 for success, 0 for failure, and -1 for cancellation.

Arguments

FileType1

The type of file you want to rename

・If not specified, TXT is specified.

FileName1

The name of the file you want to rename

FileType2

File type of the destination file

・An error ocurrs if the file type is different from FileType1.
・If not specified, it'll be the same as FileType1.

FileName2

Destination file name

Example

RENAME "TEST1","TEST2" 
RENAME "GRP:PICTURE1","PICTURE2"