Skip to main content

Constantes

Constantes​

Constantes numéricas​

Las constantes numéricas son cifras, precedidas opcionalmente de un signo menos para indicar números negativos, y opcionalmente de un punto decimal seguido de más cifras para indicar valores de coma flotante. Hay dos tipos de números: 1) enteros y 2) números decimales.

Algunos ejemplos:

Números enteros
10
-2345
0

Los valores enteros positivos también pueden escribirse en binario (base 2), octal (base 8) y hexadecimal (base 16). Los valores binarios van precedidos de 0b (0b1110 = 14), los octales de 0o (0o177 = 127) y los hexadecimales de 0x (0xff = 255).

Números decimales
-234.567
56.87
0.0123
PI

Los números muy grandes y muy pequeños también pueden escribirse en notación científica E (añadida en la versión 0.9.9.46). https://es.wikipedia.org/wiki/Notación_científica

Notación científica E
Notación ENúmero decimal
2e02
3e2300
1.234e1012340000000
-5.3e4-53000
2e-10.2
5.12e-90.00000000512

Constantes de cadena​

Las constantes de cadena son cero o más caracteres encerrados entre comillas dobles (“) o comillas simples (’).

Ejemplos​

‘I said “Hello.”’
“Tuesday Rocks”
‘123’
“it is Smith’s”

Constantes booleanas​

Los valores booleanos representan los dos valores verdadero y falso. Existen las constantes predefinidas true y false, que representan los valores 1 y 0 respectivamente. En una comprobación, cualquier número distinto de cero es verdadero, y una cadena es verdadera salvo que esté vacía.

Ejemplos​

Valores verdaderosValores falsos
TRUEFALSE
10
-560.0
9.9“” (cadena vacía)
“something”

Constantes de color y valores RGB​

Estos valores los usa la instrucción Color, pueden crearse con RGB y los devuelven las funciones GetBrushColor, GetColor y pixel.

Constante de color (nombre)Valores ARGBEntero
BLACK255, 0, 0, 04278190080Black
WHITE255, 255, 255, 2554294967295White
RED255, 255, 0, 04294901760red
DARKRED255, 128, 0, 04286578688darkred
GREEN255, 0, 255, 04278255360green
DARKGREEN255, 0, 128, 04278222848darkgreen
BLUE255, 0, 0, 2554278190335blue
DARKBLUE255, 0, 0, 1284278190208darkblue
CYAN255, 0, 255, 2554278255615cyan
DARKCYAN255, 0, 128, 1284278222976darkcyan
PURPLE255, 255, 0, 2554294902015purple
DARKPURPLE255, 128, 0, 1284286578816darkpurple
YELLOW255, 255, 255, 04294967040yellow
DARKYELLOW255, 128, 128 ,04286611456darkyellow
ORANGE255, 255, 102, 04294927872orange
DARKORANGE255, 176, 61 ,04289740032darkorange
GREY / GRAY255, 164, 164 ,1644288980132grey
DARKGREY / DARKGRAY255, 128, 128 ,1284286611584darkgrey
CLEAR0, 0, 0, 00

Tipos de variables y expresiones​

Estas constantes representan los valores numéricos que devuelve la función TypeOf.

Valores devueltos
ConstanteValorTipo
TYPE_UNASSIGNED0Variable sin asignar
TYPE_INT1Entero
TYPE_FLOAT2Número decimal
TYPE_STRING3Cadena
TYPE_ARRAY4Variable array
TYPE_REF5Referencia a una variable
TYPE_MAP6Map

Códigos y constantes de error​

Esta es la lista de los números de error de ejecución que devuelve la función LastError y de los mensajes de error que devuelve la función LastErrorMessage. Los mensajes aparecen en inglés, tal como los muestra BASIC-256.

Errores que no se pueden capturar​
Error #Descripción del error
-1ERROR_NOSUCHLABELNo such label %VARNAME%
-2ERROR_NEXTNOFORNext without FOR
-3ERROR_NOTARRAYVariable %VARNAME% is not an array
-5ERROR_ARGUMENTCOUNTNumber of arguments passed does not match FUNCTION/SUBROUTINE definition
-6ERROR_MAXRECURSEMaximum levels of recursion exceeded
-7ERROR_STACKUNDERFLOWStack Underflow Error
-8ERROR_BADCALLFUNCTIONFunction was not called correctly
-9ERROR_BADCALLSUBROUTINESubroutine was not called correctly
Errores que se pueden capturar​
Error #Descripción del error
5ERROR_FILENUMBERInvalid File Number
6ERROR_FILEOPENUnable to open file
7ERROR_FILENOTOPENFile not open
8ERROR_FILEWRITEUnable to write to file
9ERROR_FILERESETUnable to reset file
10ERROR_ARRAYSIZELARGEArray %VARNAME% dimension too large
11ERROR_ARRAYSIZESMALLArray %VARNAME% dimension too small
13ERROR_VARNOTASSIGNEDVariable %VARNAME% has not been assigned a value
14ERROR_ARRAYNITEMSArray %VARNAME% rows must have the same number of items
15ERROR_ARRAYINDEXArray %VARNAME% index out of bounds
17ERROR_STRSTARTStarting position less than zero
20ERROR_RGBRGB Color values must be in the range of 0 to 255
21ERROR_PUTBITFORMATString input to putbit incorrect
23ERROR_POLYPOINTSNot enough points in array for poly()/stamp()
24ERROR_IMAGEFILEUnable to load image file
25ERROR_SPRITENUMBERSprite number out of range
26ERROR_SPRITENASprite has not been assigned
27ERROR_SPRITESLICEUnable to slice image
28ERROR_FOLDERInvalid directory name
29ERROR_INFINITYOperation returned infinity
30ERROR_DBOPENUnable to open SQLITE database
31ERROR_DBQUERYDatabase query error (message follows)
32ERROR_DBNOTOPENDatabase must be opened first
33ERROR_DBCOLNOColumn number out of range or column name not in data set
34ERROR_DBNOTSETRecord set must be opened first
35ERROR_TYPECONVUnable to convert string to number
36ERROR_NETSOCKError opening network socket
37ERROR_NETHOSTError finding network host
38ERROR_NETCONNUnable to connect to network host
39ERROR_NETREADUnable to read from network connection
40ERROR_NETNONENetwork connection has not been opened
41ERROR_NETWRITEUnable to write to network connection
42ERROR_NETSOCKOPTUnable to set network socket options
43ERROR_NETBINDUnable to bind network socket
44ERROR_NETACCEPTUnable to accept network connection
45ERROR_NETSOCKNUMBERInvalid Socket Number
46ERROR_PERMISSIONYou do not have permission to use this statement/function
47ERROR_IMAGESAVETYPEInvalid image save type
50ERROR_DIVZERODivision by zero
51ERROR_BYREFFunction/Subroutine expecting variable reference in call
53ERROR_FREEFILEThere are no free file numbers to allocate
54ERROR_FREENETThere are no free network connections to allocate
55ERROR_FREEDBThere are no free database connections to allocate
56ERROR_DBCONNNUMBERInvalid Database Connection Number
57ERROR_FREEDBSETThere are no free data sets to allocate for that database connection
58ERROR_DBSETNUMBERInvalid data set number
59ERROR_DBNOTSETROWYou must advance the data set using DBROW before you can read data from it
60ERROR_PENWIDTHDrawing pen width must be a non-negative number
62ERROR_ARRAYINDEXMISSINGArray variable %VARNAME% has no value without an index
63ERROR_IMAGESCALEImage scale must be greater than or equal to zero
64ERROR_FONTSIZEFont size, in points, must be greater than or equal to zero
65ERROR_FONTWEIGHTFont weight must be greater than or equal to zero
66ERROR_RADIXSTRINGUnable to convert radix string back to a decimal number
67ERROR_RADIXRadix conversion base muse be between 2 and 36
68ERROR_LOGRANGEUnable to calculate the logarithm or root of a negative number
69ERROR_STRINGMAXLENString exceeds maximum length of 16,777,216 characters
71ERROR_PRINTERNOTONPrinter is not on
72ERROR_PRINTERNOTOFFPrinting is already on
73ERROR_PRINTEROPENUnable to open printer
74ERROR_WAVFILEFORMATMedia file does not exist or in an unsupported format
75ERROR_WAVNOTOPENMedia file not open
76ERROR_WAVNOTSEEKABLE
77ERROR_WAVNODURATION
78ERROR_FILEOPERATIONCan not perform that operation on a Serial Port
79ERROR_SERIALPARAMETERInvalid serial port parameter
80ERROR_LONGRANGENumber exceeds long integer range ()
81ERROR_INTEGERRANGENumber exceeds integer range ()
65535ERROR_NOTIMPLEMENTED“Feature not implemented in this environment.”
Avisos​
Error #Descripción del error
65536+ERROR_TYPECONVWARNING_TYPECONVUnable to convert string to number, zero used
65536+ERROR_WAVNOTSEEKABLEWARNING_WAVNOTSEEKABLEMedia file is not seekable
65536+ERROR_WAVNODURATIONWARNING_WAVNODURATIONDuration is not available for media file
65536+ERROR_VARNOTASSIGNEDWARNING_VARNOTASSIGNEDVariable %VARNAME% has not been assigned a value
65536+ERROR_LONGRANGEWARNING_LONGRANGENumber exceeds long integer range ()
65536+ERROR_INTEGERRANGEWARNING_INTEGERRANGENumber exceeds integer range ()

Constantes de los botones del ratón​

Estas constantes representan los valores numéricos que devuelven las funciones Clickb y Mouseb. Si el usuario ha pulsado más de un botón, los valores se suman.

Valores devueltos
ConstanteValor
MOUSEBUTTON_NONE0
MOUSEBUTTON_LEFT1
MOUSEBUTTON_RIGHT2
MOUSEBUTTON_CENTER4
MOUSEBUTTON_DOUBLECLICK32

Constantes de tipo de imagen​

Estas constantes sirven para indicar a la instrucción ImgSave en qué formato debe guardar la ventana de gráficos.

Valores devueltos
ConstanteValor
IMAGETYPE_BMP“BMP”
IMAGETYPE_JPG“JPG”
IMAGETYPE_PNG“PNG”

Constantes de tipo de sistema operativo​

Estas constantes representan los valores numéricos que devuelve la función OsType.

Valores devueltos
ConstanteValor
OSTYPE_WINDOWS0
OSTYPE_LINUX1
OSTYPE_MACINTOSH2
OSTYPE_ANDROID3

Constantes de GetSlice​

Estas constantes sirven para indicar qué hace la instrucción GetSlice.

Valores de las capas gráficas
ConstanteValor
SLICE_ALL0
SLICE_PAINT1
SLICE_SPRITE2

Enlaces a las páginas separadas​