# BASIC 256 - Language Documentation

fr:singlepage

### BASIC-256 Syntax Reference

#### Syntaxe du programme

Les programmes sous BASIC-256 sont formés d'une série d'instructions séparées par un retour à la ligne et qui sont exécutées dans l'ordre.

#### Constantes numériques

Les constantes numériques peuvent être n'importe quel(s) caractère(s) numérique(s), précédé ou non d'un signe moins (pour les nombres négatifs) et une éventuelle décimale (pour les nombres à virgule flottante).
Les nombres positifs entiers peuvent aussi être exprimées en binaire (base 2), octal (base 8) et hexadécimal (base 16). Faites précéder les entrées binaires de 0b (0b1110 = 14), octales de 0o (0o177 = 127) et hexadécimales de 0x (0xff = 255).

#### Constantes chaînes de caractères

Les (constantes) chaînes de caractères sont composées de zéro ou plus de caractères entourés de guillemets (”).

#### Variables

Le nom des variables contenant des valeurs numériques doit commencer par une lettre et peut comporter n'importe quel nombre de caractères alpha-numériques. Il est sensible à la casse (on différencie majuscule et minuscule). Il peut être utilisé en alternance de constantes numériques (i.e. on peut passer de l'un à l'autre, les deux se valent).
Le nom des variables contenant des chaînes de caractères suit les mêmes règles que celui des variables numériques, mais doit finir par un symbole dollar ($). Il peut, lui aussi, être utilisé en alternance de constantes.

#### Tableaux

Les tableaux sot affectés à l'aide de la commande DIM ou redimensionnés avec Redim. Ils peuvent contenir des données numériques ou des chaînes de caractères. Pour accéder à un élément donné d'un tableau on utilise les crochets ”[ et ]” autour du rang de l'élément voulu (la numérotation partant de zéro). Les tableaux peuvent aussi dimensionnés et interrogés sur 2 dimensions.
Le taille d'un tableau peut être retournée par une des commandes suivantes : [?] [?,] ou [,?] à la fin du nom du tableau.

##### Exemple

    print myarray[4]

affichera à l'écran le 5eme élément du tableau 'myarray'

#### Tableaux "anonymes"

Un tableau anonyme est une série de valeurs numériques ou de chaînes de caractères, séparées par des virgules, et encadrées par des accolades {}. Un tableau anonyme peut ête utilisé à la place d'une variable d'un tableau ou pour assigner une variable d'un tableau.

##### Exemple

    dim myarray(4)
    myarray = {1, 2, 3, 4}

PS : je ne suis pas sûr de la traduction de cette page. C'est ainsi que je l'ai compris, mais sans certitude.

#### Opérateurs

Les opérateurs +, -, *, /, ^, %, et sont utilisés pour réaliser respectivement une addition, une soustraction, une multiplication, une division, une puissance, un modulo et une division arrondie à l'entier des opérandes. Les opérandes valides sont des constantes numériques et/ou des varaibles numériques.
L'opérateur = est utilisé à la fois pour assigner une valeur à une varaiable et pour tester l'égalité. L'opérateur + peut être utilisé pour réaliser la concaténation (= mise bout à bout) de n'importe quelle combinaison de chaînes de constantes et de variables.string variables. L'opératuer : peut servir à séparer plusieurs instructions sur une même ligne. L'opérateur ; supprime le retour à la ligne qu'introduirait une commande PRINT. L'opérateur # est un raccourci de la commande Rem et interchangeable avec celle-ci.

Ordre des opérations
Niveau | Opérateur | Catégorie/Description
--- | --- | ---
1 | ( ) | Groupement
2 | ^ | Exposant
3 | - | Moins
4 | * / \ | Multiplication et Division
5 | % | Reste entier (Mod)
6 | + - | Addition, Concaténation et Soustraction
7 | < ⇐ > >= = <> | Comparaison (Numérique et Chaîne)
8 | NOT | “Non” logique
9 | AND | “Et” logique
10 | OR | “Ou” logique
11 | XOR | “Ou exclusif” logique

### Statements and Functions - Alphabetic

#### Abs

##### Format

abs ( expression )

##### Description

Retourne la valeur absolue d'une expression numérique.

##### Exemple

    print abs(-45)
    print abs(6.45)

permet d'afficher

    45
    6.45

#### Acos

##### Format

acos ( expression )

##### Description

Calcule l'arc-cosinus d'expression. Les angles sont exprimés en radians (0 à 2 pi).

##### Voir Aussi

Asin, Atan, Cos, Degrees, Radians, Sin, Tan

#### Asc

##### Format

asc ( expression )

##### Description

Convertit le premier caractère d'une chaîne en sa valeur ASCII (= un nombre entier).

Asc | Chr | Asc | Chr | Asc | Chr | Asc | Chr | Asc | Chr | Asc | Chr
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
32 | SPACE | 48 | 0 | 64 | @ | 80 | P | 96 | ` | 112 | p
33 | ! | 49 | 1 | 65 | A | 81 | Q | 97 | a | 113 | q
34 | “ | 50 | 2 | 66 | B | 82 | R | 98 | b | 114 | r
35 | # | 51 | 3 | 67 | C | 83 | S | 99 | c | 115 | s
36 | $ | 52 | 4 | 68 | D | 84 | T | 100 | d | 116 | t
37 | % | 53 | 5 | 69 | E | 85 | U | 101 | e | 117 | u
38 | & | 54 | 6 | 70 | F | 86 | V | 102 | f | 118 | v
39 | ' | 55 | 7 | 71 | G | 87 | W | 103 | g | 119 | w
40 | ( | 56 | 8 | 72 | H | 88 | X | 104 | h | 120 | x
41 | ) | 57 | 9 | 73 | I | 89 | Y | 105 | i | 121 | y
42 | * | 58 | : | 74 | J | 90 | Z | 106 | j | 122 | z
43 | + | 59 | ; | 75 | K | 91 | [ | 107 | k | 123 | {
44 | , | 60 | < | 76 | L | 92 | \ | 108 | l | 124 | |
45 | - | 61 | = | 77 | M | 93 | ] | 109 | m | 125 | }
46 | . | 62 | > | 78 | N | 94 | ^ | 110 | n | 126 | ~
47 | / | 63 | ? | 79 | O | 95 | _ | 111 | o | 127

##### Voir Aaussi

Chr

##### Exemple

    print asc("A")
    print asc("bleu")

permet d'afficher

    65
    98

##### Fonction disponible de la version

0.9.4

#### Asin

##### Format

asin ( expression )

##### Description

Calcule l'arc-sinus d'une expression. Les angles sont exprimés en (0 à 2pi).

##### Voir aussi

Acos, Atan, Cos, Degrees, Radians, Sin, Tan

#### Atan

##### Format

atan ( expression )

##### Description

Calcule l'arc-tangente d'une expression. Les angles sont exprimés en radians (0 à 2pi).

##### Voir aussi

Acos, Asin, Cos, Degrees, Radians, Sin, Tan

#### Ceil

##### Format

ceil ( expression )

##### Description

REtourne l'entier immédiatement inférieur ou égal à une expression.

##### Voir aussi

Floor

##### Exemple

    print ceil(9.1)
    print ceil(-5.4)

fera afficher

    10
    -5

#### Changedir

##### Format

changedir expression
changedir ( expression )

##### Description

Change de répertoire de travail pour le chemin spécifié par l'expression. Pour toutes le OS (y compris Windows) un anti-slash (/) est utilisé pour séparer les répertoire au sein d'un chemin complet.

##### Voir aussi

Close, Currentdir, Eof, Open, Read, Readline, Reset, Write, Writeline, Exists, Seek, Size

##### Disponible à partir de la version

0.9.6r

#### Chr

##### Format

chr ( expression )

##### Description

Converti l'entier expression en le caractère correspondant en code ASCII. Voir la page consacrée à asc pour un tableau de converson des caractères ASCII.

##### Voir aussi

Asc

##### Exemple

    print chr(66)+chr(111)+chr(111)+chr(33)

affichera

    Boo!

##### Disponible à partir de la version

0.9.4

#### Circle

##### Format

circle x,y,r

##### Description

Trace un cercle dont les coordonnées du centre sont x,y et le rayon r. Le cercle étant de la couleur active.

##### Exemple

    color blue
    rect 0,0,300,300
    color red
    circle 100,100,50

dessine

#### Clickb

##### Format

clickb
clickb ( )

##### Description

Retourne quel(s) bouton(s) de la souris l'utilisateur a pressé (quand il est sur la partie graphic output). Retourne 0 si aucun clic n'a été détecté. Si plusieurs boutons ont été pressés la valeur est la somme des valeurs des boutons pressés.

Valeurs retournées
Valeur | Bouton pressé
--- | ---
0 | aucun
1 | gauche
2 | droit
4 | du centre

##### Voir aussi

Clickclear, Clickx, Clicky, Mouseb, Mousex, Mousey

##### Exemple

    # réinitialise le compte des clics
    clickclear
    # attend que l'utilisateur clique
    print "cliquez avec la souris sur la surface graphics output"
    while clickb = 0
      pause .01
    endwhile
    # Montre où l'utilisatur a cliqué
    print "L'utilisateur a cliqué le point de coordonnées (" + clickx + "," + clicky + ")"

##### Disponible à partir de la version

0.9.4d

#### Clickclear

##### Format

clickclear
clickclear ( )

##### Description

Remet ClickB, Clickx et Clicky à zéro afin de pouvoir détecter facilement un clic de la souris.

##### Voir aussi

Clickb, Clickx, Clicky, Mouseb, Mousex, Mousey

##### Exemple

Voir le programme de la page de Clickb.

##### Disponible à partir de la version

0.9.4d

#### Clickx

##### Format

clickx
clickx ( )

##### Description

Retourne l'abscisse x du pointeur de la souris sur la surface graphic output au dernier clic.

##### Voir aussi

Clickclear, Clickb, Clicky, Mouseb, Mousex, Mousey

##### Exemple

Voir le programme de la page de Clickb.

##### Disponible à partir de la version

0.9.4d

#### Clicky

##### Format

clicky
clicky ( )

##### Description

Retourne l'ordonnée y du pointeur de la souris sur la surface graphic output au dernier clic.

##### Voir aussi

Clickclear, Clickb, Clickx, Mouseb, Mousex, Mousey

##### Exemple

Voir le programme sur la page de Clickb.

##### Disponible à partir de la version

0.9.4d

#### Clg

##### Format

clg

##### Description

Clears the graphics output window.

#### Close

##### Format

close
close ( )
close filenumber
close ( filenumber )

##### Description

Ferme un fichier ouvert. Di aucun fichier n'est ouvert à ce numéro, la commande n'a aucun effet. Si aucun numéro de fichier n'est spécifié, le numéro de fichier utilisé sera le zéro.

##### Voir aussi

Eof, Open, Read, Readline, Reset, Write, Writeline

#### Cls

##### Format

cls

##### Description

Nettoie la fenêtre text output.

#### Color

##### Format

color colorname
color ( colorname )
color red, blue, green
color ( red, blue, green )
color rgb_value
color ( rgb_value )

##### Description

Règle la couleur active comme étant la couleur appelée colorname; de composantes rouge, bleue et verte red, blue, green ; ou de valeur RGB rgb_value.

Il y a une couleur spéciale appelée CLEAR, de valeur -1. Si la couleur courante est réglée sur cette valeur, les pixels ou formes dessinés effaceront les pixels sur lesquels ils passeront et les rendront transparents. C'est particulièrement utile pour créer des sprites avec la commande Spriteslice.

Noms des couleurs et leur valeur RGB
Nom de la couleur | Valeur RGB |
black | 0, 0, 0 |  |
white | 255, 255, 255 |  |
red | 255, 0, 0 |  |
darkred | 128, 0, 0 |  |
green | 0, 255, 0 |  |
darkgreen | 0, 128, 0 |  |
blue | 0, 0, 255 |  |
darkblue | 0, 0, 128 |  |
cyan | 0, 255, 255 |  |
darkcyan | 0, 128, 128 |  |
purple | 255, 0, 255 |  |
darkpurple | 128, 0, 128 |  |
yellow | 255, 255, 0 |  |
darkyellow | 128, 128 ,0 |  |
orange | 255, 102, 0 |  |
darkorange | 176, 61 ,0 |  |
grey | 164, 164 ,164 |  |
darkgrey | 128, 128 ,128 |  |
clear | -1 |  |

##### Voir aussi

Rgb, GetColor

##### Exemple

    clg
    color rgb(128,128,128)
    rect 0,0,graphwidth, graphheight
    color red
    circle 100,100,50
    color 255,160,160
    circle 100,100,25

Dessinera un rectangle gris avec dedans un cercle rouge et un centre rose.

##### Disponible à partir de la version

0.9.5m

#### Cos

##### Format

cos ( expression )

##### Description

Calcule le cosinus de l'expression. L'expression doit être exprimé en radians.

##### Note

La fonction cos ne retourne pas un résultat exact (mais une valur approchée).

##### Voir aussi

Acos, Asin, Atan, Degrees, Radians, Sin, Tan

##### Exemple

    clg
    color black
    # Trace une ligne à travers la fenêtre graphic output
    line 0,150,300,150
    # point de départ
    lastx = 0
    lasty = cos(0) * 50 + 150
    # puis pas après pas trace la courbe du cosinus
    for x = 0 to 300 step 5
       angle = x / 300 * 2 * pi
       y = cos(angle) * 50 + 150
       line lastx, lasty, x, y
       lastx = x
       lasty = y
    next x

dessine

#### Currentdir

##### Format

currentdir
currentdir ( )

##### Description

Retourne le chemin complet du répertoire courant. Pour toutes les OS (y compris Windows) un anti-slash (/) sépare les répertoires du chemin.

##### SeVoir aussi

Changedir, Close, Eof, Open, Read, Readline, Reset, Write, Writeline, Exists, Seek, Size

##### Disponible à partir de la version

0.9.6r

#### Day

##### Format

day
day ( )

##### Description

Retourne le jour du mois actuel (1-31) d'après l'horloge système.

##### Voir aussi

Hour, Minute, Month, Second, Year

##### Exemple

    print "Aujourd'hui nous sommes le ";
    print day + "/" + (month + 1) + "/" + year

affichera|

    Aujourd'hui nous sommes le 12/09/2010

##### Disponible à partir de la version

0.9.4

#### DBClose

##### Format

dbclose
dbclose ( )

##### Description

Ferme le fichier de données SQLite actuellement ouvert.

##### Exemple

Voir l'exemple de la page de DBOpen.

##### Voir aussi

DBCloseSet, DBExecute, DBFloat, DBInt, DBOpen, DBOpenSet, DBRow, DBString

##### Liens externes

De plus amples informations (en anglais) sur les bases de données en général et SQLite en particulier sont disponibles aux adresses suivantes : SQLite Home Page et SQL at Wikipedia.

##### Disponible à partir de la version

0.9.6y

#### DBCloseSet

##### Format

dbcloseset
dbcloseset ( )

##### Description

Close the currently open record set opened by DBOpenSet.

##### Example

See example of usage on DBOpen page.

##### See Also

DBClose, DBExecute, DBFloat, DBInt, DBOpen, DBOpenSet, DBRow, DBString

##### External Links

More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.

##### New To Version

0.9.6y

#### DBExecute

##### Format

dbexecute SqlStatement
dbexecute ( SqlStatement )

##### Description

Exécute une commande SQL sur le fichier de base de données SQLite ouvert. Cette commande ne produit pas d'enregistrement.

##### Exemple

Voir l'exemple de la page de DBOpen.

##### Voir aussi

DBClose, DBCloseSet, DBFloat, DBInt, DBOpen, DBOpenSet, DBRow, DBString

##### Liens externes

De plus amples informations (en anglais) sur les bases de données en général et SQLite en particulier sont disponibles aux adresses suivantes : Page d'accueil de SQLite et SQL sur Wikipedia.

##### Disponible à partir de la version

0.9.6y

#### DBFloat

##### Format

dbfloat ( ColumnNumber )

##### Description

Retounrne une valeur décimale (virgule flottante) de la colonne demandée de la ligne active de l'enregistrement ouvert.

##### Exemple

Voir l'exemple de la page de DBOpen.

##### Voir aussi

DBClose, DBCloseSet, DBExecute, DBInt, DBOpen, DBOpenSet, DBRow, DBString

##### Liens externes

De plus amples informations (en anglais) sur les bases de données en général et SQLite en particulier, sont disponibles aux adresses suivantes : Page d'accueil de SQLite et SQL sur Wikipedia.

##### Disponible à partir de la version

0.9.6y

#### DBInt

##### Format

dbint ( ColumnNumber )

##### Description

Retourne la valeur entière de la colonne demandée de la ligne active de l'enregistrement ouvert.

##### Exemple

Voir l'exemple de la page de DBOpen.

##### Voir aussi

DBClose, DBCloseSet, DBExecute, DBFloat, DBOpen, DBOpenSet, DBRow, DBString

##### Liens externes

De plus amples informations (en anglais) sur les bases de données en général et SQLite en particulier, sont disponibles aux adresses suivantes : Page d'accueil de SQLite et SQL sur Wikipedia.

##### Disponible à partir de la version

0.9.6y

#### DBOpen

##### Format

dbopen SQLiteFile
dbopen ( SQLiteFile )

##### Description

Ouvre un fichier de base de données SQLite. Si le fichier n'existe pas, il est créé.

##### Exemple

    #database foo - crée une base de données, peuple une table, ouvre un enregistrement et lit les données de la table.

    # crée un nouveau fichier de base de données ou l'ouvre
    dbopen "dbtest.sqlite3"

    # efface l'ancienne foo table - renvoie une erreur si c'est une nouvelle base de données
    onerror errortrap
    dbexecute "drop table foo;"
    offerror
    # crée et peuple
    dbexecute "create table foo (id integer, words text, value decimal);"
    dbexecute "insert into foo values (1,'one',3.14);"
    dbexecute "insert into foo values (2,'two',6.28);"
    dbexecute "insert into foo values (3,'three',9.43);"

    # ouvre un enregistrement et tourne en boucle  à travers les lignes de données
    dbopenset "select * from foo order by words;"
    while dbrow()
    	print dbint(0) + dbstring(1) + dbfloat(2)
    end while
    dbcloseset

    # rassemble tout
    dbclose
    end

    errortrap:
    # accepte l'erreur - n'affiche rien - va à la prochaine commande
    return

affichera

    1one3.14
    3three9.43
    2two6.28

##### Voir aussi

DBClose, DBCloseSet, DBExecute, DBFloat, DBInt, DBOpenSet, DBRow, DBString

##### Lien externes

De plus amples informations (en anglais) sur les bases de données en général et SQLite en particulier, sont disponibles aux adresses suivantes : Page d'accueil de SQLite et SQL sur Wikipedia.

##### Disponible à partir de la version

0.9.6y

#### DBClose

##### Format

dbopenset SqlStatement
dbopenset ( SqlStatement )

##### Description

Perform an SQL statement and create a record set so that the program may loop through and use the results.

##### Example

See example of usage on DBOpen page.

##### See Also

DBClose, DBCloseSet, DBExecute, DBFloat, DBInt, DBOpen, DBRow, DBString

##### External Links

More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.

##### New To Version

0.9.6y

#### DBRow

##### Format

dbrow
dbrow ( )

##### Description

Function that advances the record set to the next row. Returns a true value if there is a row or false if we are at the end of the record set.

##### Example

See example of usage on DBOpen page.

##### See Also

DBClose, DBCloseSet, DBExecute, DBFloat, DBInt, DBOpen, DBOpenSet, DBString

##### External Links

More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.

##### New To Version

0.9.6y

#### DBString

##### Format

dbstring ( ColumnNumber )

##### Description

Return a string from the specified column of the current row of the open recordset.

##### Example

See example of usage on DBOpen page.

##### See Also

DBClose, DBCloseSet, DBExecute, DBFloat, DBInt, DBOpen, DBOpenSet, DBRow

##### External Links

More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.

##### New To Version

0.9.6y

#### Degrees

##### Format

degrees ( expression )

##### Description

Convertis un angle en radians en degrés.

##### Voir aussi

Acos, Asin, Atan, Cos, Radians, Sin, Tan

#### Dim

##### Format

dim numericvariable ( integer )
dim stringvariable$ ( integer )
dim numericvariable ( rows , columns )
dim stringvariable$ ( rows , columns )

##### Description

Retourne un nouveau tableau à 1 dimension de longueur integer ou à 2 dimensions qui peut être adressé par row et column. Selon l'assignation de la variable, un tableau numérique ou de chaînes de caractères est créé.
Le premier élément d'un tableau a l'index 0 (zéro). Les index allant ainsi de 0 à {longueur}-1.

##### Voir aussi

Redim

##### Exemple

    dim z(5)
    z = {1, 2, 3, 4, 5}
    print z[0] + " " + z[4]

affichera

    1 5

##### Exemple 2

    dim c$(4)
    c$ = {"à", "bulot, "laque", "L'anneau"}
    print c$[2] + " " + c$[3] + " ";
    print c$[1] + " " + c$[0] + "!"

affichera

    L'anneau laque à bulot!

#### End

##### Format

end

##### Description

Halts program execution.

##### Example

    print "I am done."
    end
    print "Or am I?"

will print

    I am done.

#### Eof

##### Format

eof
eof()
eof(filenumber)

##### Description

Returns a binary flag (true/false) that will signal if we have read to the End Of File (EOF). If file number is not specified then file number zero (0) will be used.

##### See Also

Close, Exists, Open, Read, Readline, Reset, Seek, Size, Write, Writeline

##### New To Version

0.9.4

#### Exists

##### Format

exists ( expression )

##### Description

Returns a binary flag (true/false) that will signal if the file path specified by the expression exists.

##### See Also

Close, Eof, Open, Read, Readline, Reset, Seek, Size, Write, Writeline

##### New To Version

0.9.4

#### FastGraphics

##### Format

fastgraphics

##### Description

Turns fastgraphics mode on, until the program is halted. Fastgraphics mode means that the graphics display is not updated until a REFRESH command is issued. It can be used to significantly speed up complex animations and eliminate flicker.

##### Note

When doing animation, it's recommended to do all of your drawing commands in subroutines and use a single REFRESH command after all drawing has been done for that frame.

##### See Also

Refresh

#### Float

##### Format

float ( expression )

##### Description

Convert expression to a floating point (decimal) number. Float will convert a string or an integer to a decimal value. If the expression can not be converted then a zero will be returned.

##### See Also

Int

##### New To Version

0.9.4

#### Floor

##### Format

floor ( expression )

##### Description

Returns the greatest integer that is less than or equal to expression

##### See Also

Ceil

#### Font

##### Format

font fontname, point, weight

##### Description

Sets the font used by the text command to fontname. Size is defined in points (1/72”) Weight represents a number from 1 to 100 that defines how dark the letters will be drawn. Light=25, Normal=50, and Bold=75.

##### Example

    color grey
    rect 0,0,graphwidth,graphheight
    color red
    font "Times New Roman",18,50
    text 10,100,"This is Times New Roman"
    color darkgreen
    font "Tahoma",28,100
    text 10,200,"This is BOLD!"

Will draw.

##### See Also

Text

##### New To Version

0.9.4

#### GetColor

##### Format

getcolor
getcolor()

##### Description

Returns the RGB value of the current drawing color (last set by color statement). RGB is calculated by taking ((red * 256) + green * 256) + blue where red, green, and blue are between 0 and 255. If the drawing color has been set to CLEAR a -1 will be returned.

##### See Also

Color, Rgb

##### Example

    color red
    print getcolor

will print

    16711680

##### New To Version

0.9.5m

#### GetSlice

##### Format

getslice(x, y, width, height)

##### Description

Return a string that contains a Hexadecimal representation of the rectangle defined by the parameters. String is formatted as first 4 bytes - width, next 4 bytes - height, 6 bytes for each pixel (width * height).

##### See Also

PutSlice

##### New To Version

0.9.6b

#### Goto

##### Format

goto label

##### Description

Jumps to the specified label.

##### See Also

Gosub / Return

##### Example

    print "I";
    goto skipit
    print " don't";
    skipit: #
    print " want cookies."

will print

    I want cookies.

#### Graphheight

##### Format

graphheight
graphheight()

##### Description

Returns the height (y dimension) of the current graphics display window.

##### See Also

Graphsize, Graphwidth

##### New To Version

0.9.3

#### Graphsize

##### Format

graphsize x_expression, y_expression

##### Description

Changes the size of the graphics display window and redraws the BASIC256 application.

##### See Also

Graphheight, Graphwidth

##### New To Version

0.9.3

#### Graphwidth

##### Format

graphwidth
graphwidth()

##### Description

Returns the width (x dimension) of the current graphics display window.

##### See Also

Graphheight, Graphsize

##### New To Version

0.9.3

#### Hour

##### Format

hour
hour()

##### Description

Returns the current system clock's hour of the day (0-23).

##### Example

    # display nice date
    dim months$(12)
    months$ = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
    print year + "-" + months$[month] + "-" + right("0" + day, 2)
    # display pretty time
    h = hour
    if h > 12 then
    h = h - 12
    ampm$ = "PM"
    else
    ampm$ = "AM"
    end if
    if h = 0 then h = 12
    print  right("0" + h, 2) + "-" + right("0" + minute, 2) + "-" + right("0" + second, 2) + " " + ampm$

Will print something like.

    2010-July-15
    10-00-02 PM

##### See Also

Day, Hour, Minute, Month, Second, Year

##### New To Version

0.9.4

#### Instr

##### Format

instr( string1, string2 )

##### Description

Check to see if string2 is contained in string1. If it is, then this function will return the index of starting character of the first place where string2 occurs. Otherwise, this function will return 0.

##### Note

String indices begin at 1.

##### Example

    print instr("Hello", "lo")

will display

    4

#### Int

##### Format

int ( expression )

##### Description

Convert expression to an integer (whole) number. Int will convert a string or a float to an integer value. If the expression can not be converted then a zero will be returned.

##### See Also

Float

#### Imgload

##### Format

imgload x, y, filename
imgload x, y, scale, filename
imgload x, y, scale, rotation, filename

##### Description

Load an image or picture from a file and paint it on the Graphics Output Window.
The parameters x and y represent the location on the screen for the CENTER of the loaded image. This behaviour is different than all of the other graphics statements. The axis of rotation will also be this CENTER point.\\The Imgload starement will read in most common image file formats including: BMP (Windows Bitmap), GIF (Graphic Interchange Format),JPG/JPEG (Joint Photographic Experts Group), and PNG (Portable Network Graphics).
Optionally scales size of the loaded image by the defined scale (1=normal size). Also optionally rotates the image by a specified angle around the images center (clockwise in radians).

##### New To Version

0.9.6l

#### Input

##### Format

input expression, stringvariable
input expression, numericvariable
input stringvariable
input numericvarvariable

##### Description

Waits for the user to type a line of text into the text output window. When the user hits the enter or return key, the line is read in to stringvar or numericvariable.
User may optionally be prompted for the input by expression.
If a numeric variable is specified and non-numeric data is entered a zero will be assigned to the numeric variable.
References to array elements may also be specified.

#### Key

##### Format

key
key()

##### Description

Immediately returns an integer value corresponding to the currently pressed keyboard key. If no key has been pressed since the last call to the key function then the number zero (0) will be returned.

##### Note

    if key = 47 then print key

will not display the desired results, because it's calling key twice in succession, and will return different values each time. This code will do what you want:

    a = key
    if a = 47 then print a

#### LastError

##### Format

lasterror
lasterror ( )

##### Description

Returns the last runtime error number.

##### Example

See example of usage on Error Codes page.

##### See Also

Error Codes, Lasterrorextra, Lasterrorline, Lasterrormessage, Offerror, Onerror

##### New To Version

0.9.6z

#### LastErrorExtra

##### Format

lasterrorextra
lasterrorextra ( )

##### Description

Returns statement specific “extra” information about the error.

##### Example

See example of usage on Error Codes page.

##### See Also

Error Codes, Lasterror, Lasterrorline, Lasterrormessage, Offerror, Onerror

##### New To Version

0.9.6z

#### LastErrorLine

##### Format

lasterrorline
lasterrorline ( )

##### Description

Returns the line number in the program where the runtime error happened.

##### Example

See example of usage on Error Codes page.

##### See Also

Error Codes, Lasterror, Lasterrorextra, Lasterrormessage, Offerror, Onerror

##### New To Version

0.9.6z

#### LastErrorMessage

##### Format

lasterrormessage
lasterrormessage ( )

##### Description

Returns a string representing the last runtime error.

##### Example

See example of usage on Error Codes page.

##### See Also

Error Codes, Lasterror, Lasterrorextra, Lasterrorline, Offerror, Onerror

##### New To Version

0.9.6z

#### Left

##### Format

left( string, length)

##### Description

Returns a portion of the specified string, starting from the first character on the left and continuing for length characters.

##### See Also

Mid, Right

##### Example

    print left("Hello", 2)

will display

    He

##### New To Version

0.9.5b

#### Length

##### Format

length( string )

##### Description

Returns the number of characters in string

#### Line

##### Format

line x0, y0, x1, y1
line(x0, y0, x1, y1)

##### Description

Draws a line from the point x0,y0 to the point x1, y1.

##### Example

    color white
    rect 0,0,300,300
    color black
    line 50,50,200,200
    line 100,200,200,200
    line 100,200,50,50

draws

#### Log

##### Format

log ( expression )

##### Description

Return the base e lograthim of expression.

##### See Also

Log10

##### New To Version

0.9.5w

#### Lower

##### Format

lower( string)

##### Description

Returns string with all alphabetic characters converted to lower case.

##### See Also

Upper

    print lower("BlUe!")

will display

    blue!

##### New To Version

0.9.5e

#### Mid

##### Format

mid( string, start character, length)

##### Description

Returns a portion of the specified string, starting from the start character, and continuing for length characters.

##### See Also

Left, Right

##### Example

    print mid("Hello", 2, 3)

will display

    ell

#### Minute

##### Format

minute
minute()

##### Description

Returns the current system clock's minute of the hour (0-59).

##### Example

    # display nice date
    dim months$(12)
    months$ = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
    print year + "-" + months$[month] + "-" + right("0" + day, 2)
    # display pretty time
    h = hour
    if h > 12 then
    h = h - 12
    ampm$ = "PM"
    else
    ampm$ = "AM"
    end if
    if h = 0 then h = 12
    print  right("0" + h, 2) + "-" + right("0" + minute, 2) + "-" + right("0" + second, 2) + " " + ampm$

Will print something like.

    2010-July-15
    10-00-02 PM

##### See Also

Day, Hour, Month, Second, Year

##### New To Version

0.9.4

#### Month

##### Format

month
month()

##### Description

Returns the current system clock's month. January is 0, February is 1… December is 11.

##### See Also

Day, Hour, Minute, Second, Year

##### Example

    cls
    dim n$(12)
    n$ = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
    print day + "-" + n$[month] + "-" + year

on New Years will display

    1-Jan-2010

##### New To Version

0.9.4

#### Mouseb

##### Format

mouseb
mouseb()

##### Description

Returns the buttons that currently pressed on the mouse (if over the graphic output). Returns 0 if no click has been recorded. If multiple buttons have been pressed the value is the sum of the values for all pressed buttons.

Return Values
Value | Mouse Button Pressed
--- | ---
0 | None
1 | Left
2 | Right
4 | Center

##### See Also

Clickb, Clickclear, Clickx, Clicky, Mousex, Mousey

##### New To Version

0.9.4d

#### Mousex

##### Format

mousex
mousex()

##### Description

Returns the current or last mouse x location of the mouse pointer over the graphic output.

##### See Also

Clickb, Clickclear, Clickx, Clicky, Mouseb, Mousey

##### New To Version

0.9.4d

#### Mousey

##### Format

mousey
mousey()

##### Description

Returns the current or last mouse y location of the mouse pointer over the graphic output.

##### See Also

Clickb, Clickclear, Clickx, Clicky, Mouseb, Mousex

##### New To Version

0.9.4d

#### NetClose

##### Format

netclose
netclose ( )
netclose socket_number
netclose ( socket_number )

##### Description

Close the specified network connection (socket). If socket_number is not specified socket number zero (0) will be used.

##### Example

See example of usage on NetConnect page.

##### See Also

NetConnect, NetData, NetListen, NetRead, NetWrite

##### New To Version

0.9.6.31

#### NetConnect

##### Format

netconnect server_name, port_number
netconnect ( server_name, port_number )
netconnect socket_number, server_name, port_number
netconnect ( socket_number, server_name, port_number )

##### Description

Open a network connection (client) to a server. The IP address or host name of a server are specified in the server_name argument, and the specific network port number in the port_number argument. If socket_number is not specified socket number zero (0) will be used.

##### Example

Open two instances of BASIC-256 on a single computer. Paste the “server” code into one and the “client” code into the other. Run the server first and the client second. You can see how the messages are sent back and forth between the two different processes.

##### Server Code

    # get a message and send back success
    print "wait for connection"
    netlisten 9997
    print "got connection"
    do
       while not netdata
          pause .1
          print ".";
       end while
       n$ = netread
       print n$
       netwrite "I got '" + n$ + "'."
    until n$ = "end"
    netclose

will display

    wait for connection
    got connection
    .1 Hi There
    ....2 Hi There
    ........3 Hi There
    ..........4 Hi There
    .....5 Hi There
    .......6 Hi There
    ....7 Hi There
    ..........8 Hi There
    ....9 Hi There
    .....10 Hi There
    .end

##### Client Code

    # have the user enter a message and send it to the server
    input "enter message?", m$
    netconnect "127.0.0.1", 9997
    for t = 1 to 10
       pause rand
       netwrite t + " " + m$
       print netread
    next t
    netwrite "end"
    print netread
    netclose

will display

    enter message?Hi There
    I got '1 Hi There'.
    I got '2 Hi There'.
    I got '3 Hi There'.
    I got '4 Hi There'.
    I got '5 Hi There'.
    I got '6 Hi There'.
    I got '7 Hi There'.
    I got '8 Hi There'.
    I got '9 Hi There'.
    I got '10 Hi There'.
    I got 'end'.

##### See Also

NetClose, NetData, NetListen, NetRead, NetWrite

##### New To Version

0.9.6.31

#### NetData

##### Format

netdata
netdata ( )
netdata socket_number
netdata ( socket_number )

##### Description

Returns a true value (1) of there is data waiting to be read in using the NetRead function, else returns false (0). If socket_number is not specified socket number zero (0) will be used.

##### Example

See example of usage on NetConnect page.

##### See Also

NetClose, NetConnect, NetListen, NetRead, NetWrite

##### New To Version

0.9.6.31

#### NetListen

##### Format

netlisten port_number
netlisten ( port_number)
netlisten socket_number, port_number
netlisten ( socket_number, port_number)

##### Description

Open up a network connection (server) on a specific port address and wait for another program to connect. If socket_number is not specified socket number zero (0) will be used.

##### Example

See example of usage on NetConnect page.

##### See Also

NetClose, NetConnect, NetData, NetRead, NetWrite

##### New To Version

0.9.6.31

#### NetRead

##### Format

netread
netread ( )
netread ( socket_number )

##### Description

Read data from the specified network connection and return it as a string. This function will wait until data is received. If socket_number is not specified socket number zero (0) will be used.

##### Example

See example of usage on NetConnect page.

##### See Also

NetClose, NetConnect, NetData, NetListen, NetWrite

##### New To Version

0.9.6.31

#### NetWrite

##### Format

netwrite string
netwrite ( string )
netwrite socket_number, string
netwrite ( socket_number, string )

##### Description

Send a string to the specified open network connection. If socket_number is not specified socket number zero (0) will be used.

##### Example

See example of usage on NetConnect page.

##### See Also

NetClose, NetConnect, NetData, NetListen, NetRead

##### New To Version

0.9.6.31

#### Open

##### Format

open filename
open(filename)
open filenumber, filename
open(filenumber, filename)

##### Description

Opens a file for reading and writing. The filename is specified as a string, and may be an absolute or relative path. If the file number is not specified file number zero (0) will be used.

##### Note

BASIC256 may have up to 8 files open at a single time. The files are numbered from 0 to 7. Opening a file to a number while another is already open to that number will close the open file.

##### See Also

Changedir, Close, Currentdir, Eof, Read, Readline, Reset, Write, Writeline, Exists, Seek, Size

#### OffError

##### Format

offerror

##### Description

Turns off error trapping and restores the default error behavior.

##### Example

See example of usage on Error Codes page.

##### See Also

Error Codes, Lasterror, Lasterrorextra, Lasterrorline, Lasterrormessage, Onerror

##### New To Version

0.9.6z

#### OnError

##### Format

onerror label

##### Description

Causes the subroutine at label to be executed when an runtime error occurs. Program control may be resumed at the next statement with a Return statement in the subroutine.

##### Example

See example of usage on Error Codes page.

##### See Also

Error Codes, Lasterror, Lasterrorextra, Lasterrorline, Lasterrormessage, Offerror

##### New To Version

0.9.6z

#### Pause

##### Format

pause seconds
pause (seconds)

##### Description

Halts execution for the specified number of seconds. The seconds value may be a decimal value, so sub-second precision is possible.

#### Pixel

##### Format

pixel (x, y )

##### Description

Returns the RGB value of the pixel at the x and y coordinate. If the pixels has not been set since the last Clg command or was drawn with the color CLEAR a -1 will be returned.

##### See Also

Rgb

##### New To Version

0.9.5m

#### Plot

##### Format

plot x, y
plot ( x, y )

##### Description

Changes the pixel located at x,y in the graphics output window to the current color.

#### Poly

##### Format

poly numeric array variable
poly {x1, y1, x2, y2, x3, y3 …}

##### Description

Draws a polygon. The sides of the polygon are defined by the values stored in the array, which should be stored as x,y pairs, sequentially. The length of the array/2 will define the number of points. A polygon may also be specified using a list of x,y pairs enclosed in curly braces {}.

##### Note

The number of points in the array argument was removed from the poly statement in version 0.9.4.

##### See Also

Stamp

##### Example

    color blue
    rect 0,0,300,300
    color green
    dim tri(6)
    tri = {100, 100, 200, 200, 100, 200}
    poly tri

    color blue
    rect 0,0,300,300
    color green
    poly {100, 100, 200, 200, 100, 200}

Both programs use the poly statement to draw the following:

#### Print

##### Format

print expression [ ; ]

##### Description

Writes text to the text output window, appending a new line. If the optional semicolon is included, no new line is appended.

##### See Also

Decimal

#### PutSlice

##### Format

putslice x, y, slice$
putslice x, y, slice$, transparent color

##### Description

Put the graphics stored in the slice string on the screen at x,y. If a transparent color is specified then do not plot points of that color in the slice.

##### See Also

GetSlice

##### New To Version

0.9.6b

#### Radians

##### Format

radians ( expression )

##### Description

Converts an angle in degrees to radians.

##### See Also

Acos, Asin, Atan, Cos, Degrees, Sin, Tan

#### Rand

##### Format

rand
rand()

##### Description

Retourne un nombre au hasard entre 0 et 1. La distribution des valeurs est uniforme.

##### Note

Pour faire un nombre au hasard entre d'autre nombres, il faut multiplier ou ajouter des nombres appropriés. Example: Pour generer un nombre entier entre 0 et 10, utiliser: int(rand * 10).

#### Read

##### Format

read
read()
read(filenumber)

##### Description

Reads and returns a token from an open file. A token is any string of characters that is separated by a space, tab, or newline character. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Readline, Reset, Write, Writeline, Exists, Seek, Size

#### Readline

##### Format

readline
readline()
readline(filenumber)

##### Description

Reads and returns an entire line from an open file. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Read, Reset, Write, Writeline, Exists, Seek, Size

#### Rect

##### Format

rect x,y,width,height
rect ( x, y, width, height )

##### Description

Draws a width x height pixel rectangle using the current color. The top left corner is located at x,y.

##### Example

    color white
    rect 0,0,300,300
    color red
    rect 50,50,150,150
    color blue
    rect 100,100,150,150
    color green
    rect 10,140,280,20

draws

#### Redim

##### Format

redim numericvariable( integer )
redim stringvariable$( integer )
redim numericvariable( rows , columns )
redim stringvariable$( rows , columns )

##### Description

Re-sizes a previously created array, preserving data. If an array is enlarged then the new elements will be initialized with zero or the empty string. If an array is reduced in size the elements trimmed from the end are lost.

##### See Also

Dim

##### New To Version

0.9.5t

#### Refresh

##### Format

refresh

##### Description

Updates the graphics output window to show all drawing since the previous refresh command. Refresh only works in Fastgraphics mode

##### See Also

Fastgraphics

#### Rem

##### Format

rem commentaire
# commentaire

##### Description

Ligne de commentaire pour aider à comprendre le code. Une ligne qui commence par rem ou par # est ignorée par BASIC-256.

#### Reset

##### Format

reset
reset()
reset(filenumber)

##### Description

Clears an open file. All data stored in the file is lost. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Read, Readline, Write, Writeline, Exists, Seek, Size

#### Rgb

##### Format

rgb(red, green, blue )

##### Description

Returns the RGB value of the color made up of the red, green, and blue components. Legal values for red, greem, and blue are 0 to 255.

##### See Also

Color, GetColor, Pixel

##### New To Version

0.9.5m

#### Right

##### Format

right( string, length)

##### Description

Returns a portion of the specified string, starting from the last length characters from the right end of the of the string.

##### See Also

Mid, Left

##### Example

    print right("Hello", 2)

will display

    lo

##### New To Version

0.9.5b

#### Say

##### Format

say expression
say ( expression )

##### Description

Utilise le moteur du système de synthèse vocale (TTS - Text to Speech) pour dire l'expression. Dans GNU/Linux, les bibliothèques FLite ou eSpeak sont nécessaires. Dans Windows, la voix SAPI par défaut actuelle sera utilisée.

##### Nouveau dans la version

0.9.4

#### Second

##### Format

second
second()

##### Description

Returns the current system clock's second of the current minute (0-59).

##### Example

    # display nice date
    dim months$(12)
    months$ = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
    print year + "-" + months$[month] + "-" + right("0" + day, 2)
    # display pretty time
    h = hour
    if h > 12 then
    h = h - 12
    ampm$ = "PM"
    else
    ampm$ = "AM"
    end if
    if h = 0 then h = 12
    print  right("0" + h, 2) + "-" + right("0" + minute, 2) + "-" + right("0" + second, 2) + " " + ampm$

Will print something like.

    2010-July-15
    10-00-02 PM

##### See Also

Day, Hour, Minute, Month, Year

##### New To Version

0.9.4

#### Seek

##### Format

seek location
seek ( location )
seek filenumber, location
seek ( filenumber, location )

##### Description

Moves the read/write location to a specific location (offset in bytes from the start of the file) within an open file. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Read, Readline, Reset, Write, Writeline, Exists, Size

##### New To Version

0.9.4

#### Sin

##### Format

sin ( expression )

##### Description

Computes the sine of expression. Expression must be in radians.

##### Note

The sin function does not produce an exact result.

##### See Also

Acos, Asin, Atan, Cos, Degrees, Radians, Tan

##### Example

    clg
    color black
    # draw a line across the graphic output
    line 0,150,300,150
    # where do we start
    lastx = 0
    lasty = sin(0) * 50 + 150
    # now step across the line and draw
    for x = 0 to 300 step 5
       angle = x / 300 * 2 * pi
       y = sin(angle) * 50 + 150
       line lastx, lasty, x, y
       lastx = x
       lasty = y
    next x

Draws

#### Size

##### Format

size
size()
size(filenumber)

##### Description

Returns the length, in bytes, of an opened file. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Read, Readline, Reset, Write, Writeline, Exists, Seek

##### New To Version

0.9.4

#### Sound

##### Format

sound frequency, duration
sound ( frequency, duration )
sound ( array )
sound array
sound {frequency1, duration1, frequency2, duration2, …}

##### Description

Play a sound from the computer's speakers.Frequency is expressed in Hz and duration is expressed in milliseconds (1000 in a second). An array or list containing frequency and durations may also be passed. This eliminates any clicking between sounds when more than one is being output sequentially. Sound support for LINUX systems was added in version 0.9.5g. Sound was changed to use the default sound device in Windows in version 0.9.5h

##### See Also

Volume

#### Spritecollide

##### Format

spritecollide ( sprite1, sprite2)

##### Description

Function returns true if the two sprites are colliding. The Spritecollide function assumes that the sprites are bounded by a rectangle the size of the loaded image. Collision is calculated by using these rectangles. For round or oddly shaped sprites this function may over detect collision.

##### See Also

Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spritedim

##### Format

spritedim n
spritedim ( n )

##### Description

Create n sprite placeholders in memory. Sprites are accessed in your program by a sprite number from 0 to n-1.

##### See Also

Spritecollide, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spriteh

##### Format

spriteh ( spritenumber )

##### Description

Returns the height, in pixels, of a loaded sprite.

##### See Also

Spritecollide, Spritedim, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spritehide

##### Format

spritehide spritenumber spritehide ( spritenumber )

##### Description

Hides a sprite. All image and position information is retained.

##### See Also

Spritecollide, Spritedim, Spriteh, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spriteload

##### Format

spriteload spritenumber, filename
spriteload ( spritenumber, filename )

##### Description

Load an image or picture from a file and save it as a sprite. The sprite will be active and movable but will not display on the screen until the Spriteshow statement is executed for that sprite.\\The Spriteload statement will read in most common image file formats including: BMP (Windows Bitmap), GIF (Graphic Interchange Format),JPG/JPEG (Joint Photographic Experts Group), and PNG (Portable Network Graphics).

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spritemove

##### Format

spritemove spritenumber, dx, dy
spritemove ( spritenumber, dx, dy )

##### Description

Move a sprite from its current position by the specified number of pixels. Motion will be limited to the current screen.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spriteplace

##### Format

spriteplace spritenumber, x, y
spriteplace ( spritenumber, x, y )

##### Description

Place the center of a sprite at a specific location on the screen. Like Imgload sprite positioning is relative to the center of the sprite and not the top left corner as with most other graphical statements.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spriteshow

##### Format

spriteshow spritenumber
spriteshow ( spritenumber )

##### Description

Show a hidden sprite.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteslice, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6n

#### Spriteslice

##### Format

spriteslice spritenumber, x, y, width, height
spriteslice ( spritenumber, x, y, width, height )

##### Description

Copy the rectangular region of the screen with it's top left corner represented by x and y of the specified height and width and create a sprite. The sprite will be active and movable but will not be visible until the Spriteshow statement is executed. It is recommended that you execute the Clg command before drawing and slicing the sprite. All unpainted pixels will be transparent when the sprite is drawn on the screen. Transparent pixels may also be set by drawing with the color CLEAR.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spritemove, Spriteplace, Spriteshow, Spritev, Spritew, Spritex, Spritey

##### New To Version

0.9.6o

#### Spritev

##### Format

spritev ( spritenumber )

##### Description

Returns true if the sprite is visible.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritex, Spritey

##### New To Version

0.9.6o

#### Spritew

##### Format

spritew ( spritenumber )

##### Description

Returns the width, in pixels, of a loaded sprite.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritex, Spritey

##### New To Version

0.9.6n

#### Spritex

##### Format

spritex ( spritenumber )

##### Description

Returns the x coordinate of the center of a loaded sprite.

##### See Also

Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritey

##### New To Version

0.9.6n

#### Spritey

##### Format

spritey ( spritenumber )

##### Description

Returns the y coordinate of the center of a loaded sprite.

##### See Also

Spritecollide, Spritedim, Spriteh, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex

##### New To Version

0.9.6n

#### Stamp

##### Format

stamp x, y, array
stamp x, y, {x1, y1, x2, y2, x3, y3 …}
stamp x, y, scale, array
stamp x, y, scale, {x1, y1, x2, y2, x3, y3 …}
stamp x, y, scale, rotation, array
stamp x, y, scale, rotation, {x1, y1, x2, y2, x3, y3 …}

##### Description

Draws a polygon with top left corner (origin) at x, y. Optionally scales size of polygon by the defined scale (1=normal size). Also optionally rotates the polygon by a specified angle around the origin (clockwise in radians). The sides of the polygon are defined by the values in an array, which should be stored as x,y pairs, sequentially. The length of the array/2 will define the number of points. A stamped polygon can also be specified using a list of x,y pairs enclosed in curly braces {}.

##### See Also

Poly

##### Example

Both of the code blocks below will draw a pair of green triangles on the graphics window:

    clg
    color blue
    rect 0,0,300,300
    color green
    dim tri(6)
    tri = {0, 0, 100, 100, 0, 100}
    # stamp the triangle at 0,0 (full size)
    stamp 100, 100, tri
    # stamp the triangle at 200,100 (half size)
    stamp 200, 100, .5, tri

    clg
    color blue
    rect 0,0,300,300
    color green
    # stamp the triangle at 0,0 (full size)
    stamp 100, 100, {0, 0, 100, 100, 0, 100}
    # stamp the triangle at 200,100 (half size)
    stamp 200, 100, .5, {0, 0, 100, 100, 0, 100}

Both programs will draw:

##### New To Version

0.9.4

#### String

##### Format

string ( expression )

##### Description

Returns the string representation of a number.

##### See Also

Decimal

#### System

##### Format

system expression
system ( expression )

##### Description

Execute a system command in a terminal window. WARNING: This can be a very dangerous statement. Only use it if you know what you are doing.

##### New To Version

0.9.5h

#### Tan

##### Format

tan ( expression )

##### Description

Computes the tangent of expression. Expression must be in radians.

##### Note

The tan function does not produce an exact result.

##### See Also

Acos, Asin, Atan, Sin, Cos, Degrees, Radians

##### Example

    clg
    color black
    # draw a line across the graphic output
    line 0,150,300,150
    # where do we start
    lastx = 0
    lasty = tan(0) * 50 + 150
    # now step across the line and draw
    for x = 0 to 300 step 5
       angle = x / 300 * 2 * pi
       y = tan(angle) * 50 + 150
       line lastx, lasty, x, y
       lastx = x
       lasty = y
    next x

Draws

#### Text

##### Format

text x, y, string
text ( x, y, string )

##### Description

Paints a text string on the Graphics Output Window at x, y using the current color and font.

##### Example

    color grey
    rect 0,0,graphwidth,graphheight
    color red
    font "Times New Roman",18,50
    text 10,100,"This is Times New Roman"
    color darkgreen
    font "Tahoma",28,100
    text 10,200,"This is BOLD!"

Will draw.

##### See Also

Color, Font

##### New To Version

0.9.4

#### Upper

##### Format

upper ( string )

##### Description

Returns string with all alphabetic characters converted to upper case.

##### See Also

Lower

##### Example

    print upper("BlUe!")

will display

    BLUE!

##### New To Version

0.9.5e

#### Volume

##### Format

volume level
volume ( level )

##### Description

Adjust the volume of the notes played with the Sound command. Volume levels must be numeric values from 0 to 10. The default volume is 5.

##### See Also

Sound

##### New To Version

0.9.5i

#### WAVplay

##### Format

wavplay filename
wavplay ( filename )

##### Description

Play WAV audio file asynchronously (in the background).

##### See Also

WAVstop WAVwait

##### New To Version

0.9.4

#### WAVstop

##### Format

wavstop

##### Description

Stop playing the current asynchronous (background) WAV audio file.

##### See Also

WAVplay WAVwait

##### New To Version

0.9.4

#### Write

##### Format

write string
write ( string )
write filenumber, string
write ( filenumber, string )

##### Description

Writes string to the end of an open file. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Read, Readline, Reset, Writeline, Exists, Seek, Size

#### Writeline

##### Format

writeline string
writeline ( string )
writeline filenumber, string
writeline ( filenumber, string )

##### Description

Writes string append with a newline character to the end of an open file. If the file number is not specified file number zero (0) will be used.

##### See Also

Close, Eof, Open, Read, Readline, Reset, Write, Exists, Seek, Size

##### New To Version

0.9.4

#### Year

##### Format

year
year ( )

##### Description

Returns the current system clock's 4 digit year.

##### See Also

Day, Hour, Minute, Month, Second

##### Example

    print "today's date is ";
    print (month + 1) + "/" + day + "/" + year

will display

    today's date is 11/30/2009

##### New To Version

0.9.4

fr/singlepage.txt · Last modified: 2011/03/29 11:56 (external edit)