~~ODT~~
BASIC-256 programs consist of a series of statements separated by newlines, which are executed in order.
Numeric constants are any numeric characters, preceded by an optional minus sign to indicate negative numbers, and an optional decimal followed by more numeric characters to indicate floating point values.
Positive integer values may also be expressed in binary (base 2), octal (base 8), and hexadecimal (base 16). Precede binary values with 0b (0b1110 = 14), octal with 0o (0o177 = 127), and hexadecimal with 0x (0xff = 255).
String constants are zero or more characters enclosed by double quotation marks(“).
Variables that hold numeric values must begin with a letter, and may consist of any number of alpha-numeric characters. They are case sensitive. They may be used interchangeably with numeric constants.
Variables that hold string values follow the same rules as numeric variables, but must end with a dollar sign ($). They may be used interchangeably with string constants.
Arrays are allocated using the DIM command or resided using Redim. They may hold numeric or string data. Access to specific elements in an array is accomplished by using square brackets along with the integer offset of the element, starting from zero. Arrays may also be dimensioned and accessed using two dimensions.
Array sizes may also be extracted using [?] [?,] and [,?] on the end of the array variable.
print myarray[4]
will display on the screen the fifth element in 'myarray'
The operators +, -, *, /, ^, %, and \ are used to perform addition, subtraction, multiplication, division, exponentiation, modulo, and integer division of their operands, respectively. Valid operands are numeric constants and/or numeric variables.
The = operator is used both for assignment to variables, and to test for equality. The + operator may be used to perform concatenation of any combination of string constants and string variables. The : operator can separate multiple statements on a single line. The ; operator suppresses the new line that is printed from a PRINT statement. The # operator is a shortcut for the Rem statement, and is interchangeable with it.
Order of Operations | ||
---|---|---|
Level | Operators | Category/Description |
1 | ( ) | Grouping |
2 | ^ | Exponent |
3 | - | Unary Minus |
4 | * / \ | Multiplication and Division |
5 | % | Integer Remainder (Mod) |
6 | + - | Addition, Concatenation, and Subtraction |
7 | < ⇐ > >= = <> | Comparison (Numeric and String) |
8 | NOT | Unary Not |
9 | AND | Logical And |
10 | OR | Logical Or |
11 | XOR | Logical Exclusive Or |
abs ( Ausdruck )
Gibt den absoluten Wert von Ausdruck zurück.
c = abs(a-b)
acos ( expression )
Computes the arc-cosine of expression. Angles are expressed in radians (0 to 2pi).
asc ( expression )
Converts the first character in a string expression to an integer representing it's ASCII value.
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 |
print asc("A") print asc("blue")
will print
65 98
0.9.4
asin ( expression )
Computes the arc-sine of expression. Angles are expressed in radians (0 to 2pi).
atan ( expression )
Computes the arc-tangent of expression. Angles are expressed in radians (0 to 2pi).
ceil ( Ausdruck )
Gibt die kleinste ganze Zahl zurück, die größer oder gleich Ausdruck ist.
i = floor(-1.25) rem i ist -1
changedir expression
changedir ( expression )
Change the current working directory to the path specified in expression. For all systems (including Windows) a forward slash (/) will be used to separate folders in a full path.
0.9.6r
chr ( expression )
Converts the integer expression into a single character string expression with the ASCII value of the number. See asc for a complete ASCII character conversion chart.
print chr(66)+chr(111)+chr(111)+chr(33)
will print
Boo!
0.9.4
circle x,y,r
circle ( x,y,r )
Zeichnet einen mit der aktuellen Farbe ausgefüllten Kreis mit Mittelpunkt x,y und Radius r.
color yellow circle 20,20,10
clickb
clickb ( )
Returns the buttons that the user last clicked 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 |
# clear any prior mouse click clickclear # wait for the user to click the mouse print "click mouse on the graphics output" while clickb = 0 pause .01 endwhile # show where the user clicked print "The user clicked at (" + clickx + "," + clicky + ")"
0.9.4d
clickclear
clickclear ( )
Sets ClickB, Clickx, and Clicky to zero so that we can easily tell when the next mouse click is recorded.
See sample program on Clickb.
0.9.4d
clickx
clickx ( )
Returns the mouse x location of the mouse pointer over the graphic output last time the user clicked a mouse button.
See sample program on Clickb.
0.9.4d
clicky
clicky ( )
Returns the mouse y location of the mouse pointer over the graphic output last time the user clicked a mouse button.
See sample program on Clickb.
0.9.4d
clg
Löscht den Inhalt des Grafikfensters.
close
close filenumber
close ( filenumber )
Schließt die aktuell geöffnete Datei. Wenn gerade keine Datei offen ist, hat der Befehl keine Wirkung.
cls
Löscht den Inhalt des Textfensters.
color Farbname
color ( Farbname )
color r, g, b
color ( r, g, b )
color rgb
color ( rgb )
Setzt die aktuelle Farbe auf Farbname.
color blue
cos ( Ausdruck )
Berechnet den Kosinus von Ausdruck. Ausdruck muss ein Bogenmaß sein.
Die cos-Funktion liefert kein besonders genaues Ergebnis.
c = cos( 2*PI*deg/360)
currentdir
currentdir ( )
Returns the fully qualified path name to BASIC-256's current directory. For all systems (including Windows) a forward slash (/) will be used to separate folders in a full path.
0.9.6r
day
day ( )
Returns the current system clock's day of the month (1-31).
print "today's date is "; print (month + 1) + "/" + day + "/" + year
will print|
today's date is 11/30/2009
0.9.4
dbclose
dbclose ( )
Close the currently open SQLite database file.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbcloseset
dbcloseset ( )
Close the currently open record set opened by DBOpenSet.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbexecute SqlStatement
dbexecute ( SqlStatement )
Execute an SQL statement on the open SQLite database file. This statement does not create a record set.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbfloat ( ColumnNumber )
Return a floating point (decimal value) from the specified column of the current row of the open recordset.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbint ( ColumnNumber )
Return an integer value from the specified column of the current row of the open recordset.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbopen SQLiteFile
dbopen ( SQLiteFile )
Open an SQLite database file. If the file does not exist then create it.
#database foo - create a database, populate a table, open a recordset and read data from table. # create a new database file or open it dbopen "dbtest.sqlite3" # delete old foo table - trap error if new database onerror errortrap dbexecute "drop table foo;" offerror # create and populate 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);" # open a recordset and loop through the rows of data dbopenset "select * from foo order by words;" while dbrow() print dbint(0) + dbstring(1) + dbfloat(2) end while dbcloseset # wrap everything up dbclose end errortrap: # accept error - display nothing - return to next statement return
will display
1one3.14 3three9.43 2two6.28
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbopenset SqlStatement
dbopenset ( SqlStatement )
Perform an SQL statement and create a record set so that the program may loop through and use the results.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbrow
dbrow ( )
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.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
dbstring ( ColumnNumber )
Return a string from the specified column of the current row of the open recordset.
See example of usage on DBOpen page.
More information about databases in general and SQLite specifically can be found at SQLite Home Page and SQL at Wikipedia.
0.9.6y
degrees ( expression )
dim numericvariable( AnzahlElemente )
dim stringvariable$( AnzahlElemente )
dim numericvariable( rows , columns )
dim stringvariable$( rows , columns )
Liefert ein neu erzeugtes Feld der Länge AnzahlElemente zurück. Der Typ des erzeugten Feldes (Zeichenkettenfeld oder numerisches Feld) wird durch den Typ von Variable bestimmt.
Auf Elemente des Feldes wird via Variable[Index] zugegriffen. Index läuft von 0 bis (AnzahlElemente - 1)
dim f(100) f[0] = 1 dim c$(5) c$[4] = "Hi!"
end
Beendet die Ausführung des Programmes.
eof
eof()
eof(filenumber)
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.
0.9.4
exists ( expression )
Returns a binary flag (true/false) that will signal if the file path specified by the expression exists.
0.9.4
fastgraphics
Schaltet in den FastGraphics-Modus, bis das Programm beendet wird. Der FastGraphics-Modus bedeutet, dass der Inhalt des Grafikfensters erst beim nächsten REFRESH-Befehl aktualisiert wird. Dadurch können komplexe Animationen deutlich beschleunigt und Flimmern vermieden werden.
Bei Animationen wird empfohlen, alle Grafikbefehle in Unterprogramme auszulagern und einen einziges REFRESH-Befehl zu benutzen, sobald das Einzelbild fertig ist.
float ( expression )
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.
0.9.4
floor ( Ausdruck )
Gibt die größte ganze Zahl zurück, die kleiner oder gleich Ausdruck ist.
Ceil
' ' i = floor(-1.25) rem i ist -2' '
font fontname, point, weight
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.
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!"
0.9.4
getcolor
getcolor()
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.
color red print getcolor
will print
16711680
0.9.5m
getslice(x, y, width, height)
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).
0.9.6b
goto Sprungmarke
Springt zu Sprungmarke.
Eine Sprungmarke wird mit Bezeichner>: erzeugt, z.B. nochmal:. Basic-Befehle sind als Bezeichner nicht zulässig.
' ' goto nochmal' '
graphheight
graphheight()
Returns the height (y dimension) of the current graphics display window.
0.9.3
graphsize x_expression, y_expression
Changes the size of the graphics display window and redraws the BASIC256 application.
0.9.3
graphwidth
graphwidth()
Returns the width (x dimension) of the current graphics display window.
0.9.3
hour
hour()
Returns the current system clock's hour of the day (0-23).
# 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
0.9.4
instr Zeichenkette1, Zeichenkette2
Prüft, ob Zeichenkette2 in Zeichenkette1 enthalten ist. Wenn ja, wird der Index des Anfangszeichens des ersten Vorkommens von Zeichenkette2 zurückgeliefert. Anderenfalls gibt der Befehl 0 zurück.
Alle Indexe/Positionen innerhalb von Zeichenketten beginnen mit 1.
' ' Die Zeile
print instr("Hallo", "lo")
gibt
4
im Textfenster aus.' '
int ( Ausdruck )
int ( Zeichenkettenausdruck )
Umwandlung in eine ganze Zahl (Integer). Int() schneidet die Dezimalstellen einer Fließkommazahl ab oder wandelt eine Zeichenkette (String) in eine ganze Zahl um.
c$ = "12a" : i = int(c$) print c$ print i
12a 12
imgload x, y, filename
imgload x, y, scale, filename
imgload x, y, scale, rotation, filename
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).
0.9.6l
input Zeichenkette, Stringvariable
Gibt Zeichenkette aus und erwartet eine Texteingabe im Textfenster. Die Eingabe muß mit der Eingabe-Taste abgeschlossen werden. Die eingelesene Zeile wird in Variable Stringvariable gespeichert. ==== Beispiel ==== ' ' input “Bitte gib Deinen Namen ein: ”, name$' '
key
Liefert sofort den zur gerade gedrückten Taste gehörenden ganzzahligen Wert zurück. Wenn keine Taste gedrückt ist, wird der Wert 0 zurückgeliefert
Dieses Programmstück \\
if key = 47 then print key
tut nicht das gewünschte, denn der KEY-Befehl wird 2 Mal hintereinander aufgerufen, liefert im allgemeinen also 2 verschiedene Werte zurück. Richtig müßte der Quelltext so aussehen: \\
a = key if a = 47 then print a
lasterror
lasterror ( )
Returns the last runtime error number.
See example of usage on Error Codes page.
0.9.6z
lasterrorextra
lasterrorextra ( )
Returns statement specific “extra” information about the error.
See example of usage on Error Codes page.
0.9.6z
lasterrorline
lasterrorline ( )
Returns the line number in the program where the runtime error happened.
See example of usage on Error Codes page.
0.9.6z
left( string, length)
Returns a portion of the specified string, starting from the first character on the left and continuing for length characters.
print left("Hello", 2)
will display
He
0.9.5b
length ( Zeichenkette )
Liefert die Anzahl von Zeichen in Zeichenkette zurück.
' ' i = length( “Hallo” ) rem i ist 5' '
line x0, y0, x1, y1
Zeichnet eine Linie von Punkt x0,y0 zu Punkt x1, y1.
' ' line 0,0,299,299' '
log ( expression )
Return the base e lograthim of expression.
0.9.5w
lower( string)
Wandelt die Buchstaben eines string in Kleinbuchstaben um.
0.9.5e
mid ( Zeichenkette, Startindex, Länge )
Gibt ein Länge Zeichen langes Teilstück der Zeichenkette zurück, startend beiStartindex.
' ' Die Zeile
print mid("Hello", 2, 3)
gibt im Textfenster
ell
aus.' '
minute
minute()
Returns the current system clock's minute of the hour (0-59).
# 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
0.9.4
month
month()
Returns the current system clock's month. January is 0, February is 1… December is 11.
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
0.9.4
mouseb
mouseb()
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 |
0.9.4d
mousex
mousex()
Returns the current or last mouse x location of the mouse pointer over the graphic output.
0.9.4d
mousey
mousey()
Returns the current or last mouse y location of the mouse pointer over the graphic output.
0.9.4d
netclose
netclose ( )
netclose socket_number
netclose ( socket_number )
Close the specified network connection (socket). If socket_number is not specified socket number zero (0) will be used.
See example of usage on NetConnect page.
0.9.6.31
netconnect server_name, port_number
netconnect ( server_name, port_number )
netconnect socket_number, server_name, port_number
netconnect ( socket_number, server_name, port_number )
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.
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.
# 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
# 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'.
0.9.6.31
netdata
netdata ( )
netdata socket_number
netdata ( socket_number )
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.
See example of usage on NetConnect page.
0.9.6.31
netlisten port_number
netlisten ( port_number)
netlisten socket_number, port_number
netlisten ( socket_number, port_number)
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.
See example of usage on NetConnect page.
0.9.6.31
netread
netread ( )
netread ( socket_number )
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.
See example of usage on NetConnect page.
0.9.6.31
netwrite string
netwrite ( string )
netwrite socket_number, string
netwrite ( socket_number, string )
Send a string to the specified open network connection. If socket_number is not specified socket number zero (0) will be used.
See example of usage on NetConnect page.
0.9.6.31
open Dateiname
Öffnet eine Datei zum Lesen und Schreiben. Der Dateiname muß als Zeichenkette angegeben werden
und kann eine absolute oder relative Pfadangabe enthalten.
Zu einem gegebenen Zeitpunkt kann nur eine Datei geöffnet sein. Wenn eine neue Datei geöffnet wird, während eine andere Datei bereits offen ist, wird diese andere Datei geschlossen.
Close, Read, Write, Reset
offerror
Turns off error trapping and restores the default error behavior.
See example of usage on Error Codes page.
0.9.6z
onerror label
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.
See example of usage on Error Codes page.
0.9.6z
pause Sekunden
Hält die Programmausführung für die angegebene Anzahl Sekunden an. Der Sekunden-Wert kann eine Fließkommazahl sein, damit sind auch Pausen kleiner als eine Sekunde möglich.
' ' pause 0.1' '
pixel (x, y )
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.
0.9.5m
plot x, y
Gibt dem Pixel an der Koordinatenposition x,y im Grafikfenster die aktuelle Farbe.
' ' plot 10,10' '
poly Feld
Zeichnet ein Polygon. Die Seiten des Polygons werden durch die Werte im Feld bestimmt, welche immer abwechselnd x-Werte und y-Werte sein sollten.
' ' dim a(6)<br> …<br>poly a' '
print Ausdruck [ ; ]
Gibt einen Text im Textfenster aus, gefolgt von einem Zeilenumbruch. Wenn das optionale Semikolon am Ende vorhanden ist, erfolgt kein Zeilenumbruch.
' ' print “Hallo ”; : print“Du !”' '
putslice x, y, slice$
putslice x, y, slice$, transparent color
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.
0.9.6b
radians ( expression )
rand
Liefert eine Zufallszahl zwischen 0 und 1 zurück. Die Werteverteilung ist gleichförmig.
Um Zufallszahlem mit einem anderen Wertebereich zu erzeugen, können die notwendigen Zahlen zum RAND-Ergebnis addiert oder damit multipliziert werden. Um zum Beispiel eine ganzahlige Zufallszahl zwischen 0 und 10 (einschließlich) zu erzeugen, kann int(rand * 10) benutzt werden.
read
Liest einen Token von der gerade geöffneten Datei ein und gibt ihn zurück. Ein Token ist jegliche Zeichenkette, die mit einem Leerzeichen, einem Tabulator oder dem Zeilenende endet.
Open, Close, Write, Reset
readline
readline()
readline(filenumber)
Reads and returns an entire line from an open file. If the file number is not specified file number zero (0) will be used.
rect x,y,b,h
Zeichnet ein mit der aktuellen Farbe ausgefülltes Rechteck mit der Höhe h Pixel und der Breite b Pixel. Die obere linke Ecke hat die Koodinaten x,y.
redim numericvariable( integer )
redim stringvariable$( integer )
redim numericvariable( rows , columns )
redim stringvariable$( rows , columns )
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.
0.9.5t
refresh
Aktualisiert das Grafikfenster mit allen Grafikbefehlen, die seit dem vorherigen REFRESH abgesetzt wurden. REFRESH funktioniert nur im FastGraphics-Modus.
rem Kommentar ==== Beschreibung ==== Steht am Anfang einer Kommentarzeile. Zeilen, die mit REM beginnen, werden bei der Programmausführung ignoriert.
reset
Löscht den Inhalt der aktuell geöffneten Datei. Der Inhalt der Datei geht verloren.
Open, Read, Close, Write
rgb(red, green, blue )
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.
0.9.5m
right( string, length)
Returns a portion of the specified string, starting from the last length characters from the right end of the of the string.
print right("Hello", 2)
will display
lo
0.9.5b
say expression say ( expression )
Uses the the system Text to Speech (TTS) engine to say the expression. In LINUX the FLite or eSpeak libraries are required. In Windows the current default SAPI voice will be used.
0.9.4
second
second()
Returns the current system clock's second of the current minute (0-59).
# 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
0.9.4
seek location
seek ( location )
seek filenumber, location
seek ( filenumber, location )
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.
0.9.4
sin ( Ausdruck )
Berechnet den Sinus von Ausdruck. Ausdruck muss ein Bogenmaß sein.
Die sin-Funktion liefert kein besonders genaues Ergebnis.
Cos, Tan
' ' s = sin( 2*PI*deg/360)' '
size
size()
size(filenumber)
Returns the length, in bytes, of an opened file. If the file number is not specified file number zero (0) will be used.
0.9.4
sound frequency, duration
sound ( frequency, duration )
sound ( array )
sound array
sound {frequency1, duration1, frequency2, duration2, …}
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
spritecollide ( sprite1, sprite2)
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.
Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spritedim n
spritedim ( n )
Create n sprite placeholders in memory. Sprites are accessed in your program by a sprite number from 0 to n-1.
Spritecollide, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spriteh ( spritenumber )
Returns the height, in pixels, of a loaded sprite.
Spritecollide, Spritedim, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spritehide spritenumber spritehide ( spritenumber )
Hides a sprite. All image and position information is retained.
Spritecollide, Spritedim, Spriteh, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spriteload spritenumber, filename
spriteload ( spritenumber, filename )
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).
Spritecollide, Spritedim, Spriteh, Spritehide, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spritemove spritenumber, dx, dy
spritemove ( spritenumber, dx, dy )
Move a sprite from its current position by the specified number of pixels. Motion will be limited to the current screen.
Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spriteplace spritenumber, x, y
spriteplace ( spritenumber, x, y )
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.
Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteshow, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spriteshow spritenumber
spriteshow ( spritenumber )
Show a hidden sprite.
Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteslice, Spritev, Spritew, Spritex, Spritey
0.9.6n
spriteslice spritenumber, x, y, width, height
spriteslice ( spritenumber, x, y, width, height )
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.
Spritecollide, Spritedim, Spriteh, Spritehide, Spritemove, Spriteplace, Spriteshow, Spritev, Spritew, Spritex, Spritey
0.9.6o
spritev ( spritenumber )
Returns true if the sprite is visible.
Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritex, Spritey
0.9.6o
spritew ( spritenumber )
Returns the width, in pixels, of a loaded sprite.
Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritex, Spritey
0.9.6n
spritex ( spritenumber )
Returns the x coordinate of the center of a loaded sprite.
Spritecollide, Spritedim, Spriteh, Spritehide, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritey
0.9.6n
spritey ( spritenumber )
Returns the y coordinate of the center of a loaded sprite.
Spritecollide, Spritedim, Spriteh, Spriteload, Spritemove, Spriteplace, Spriteshow, Spriteslice, Spritev, Spritew, Spritex
0.9.6n
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 …}
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 {}.
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}
0.9.4
string ( Ausdruck )
Liefert die Zahl Ausdruck als Zeichenkette zurück.
' ' s$ = string(12*13) rem s$ ist “156”' '
system expression
system ( expression )
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.
0.9.5h
tan ( Ausdruck )
Berechnet den Tangens von Ausdruck. Ausdruck muss ein Bogenmaß sein.
Die tan()-Funktion liefert kein besonders genaues Ergebnis.
Sin, Cos
' ' t = tan( 2*PI*deg/360 )' '
text x, y, string
text ( x, y, string )
Paints a text string on the Graphics Output Window at x, y using the current color and font.
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!"
0.9.4
upper ( string )
Wandelt die Buchstaben eines string in Großbuchstaben um.
print upper("BlaU!")
Ausgabe
BLAU!
0.9.5e
volume level
volume ( level )
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.
0.9.5i
wavplay filename
wavplay ( filename )
Play WAV audio file asynchronously (in the background).
0.9.4
wavstop
Stop playing the current asynchronous (background) WAV audio file.
0.9.4
write Zeichenkette
Schreibt die Zeichenkette an das Ende der aktuell geöffneten Datei.
Open, Read, Close, Reset
writeline string
writeline ( string )
writeline filenumber, string
writeline ( filenumber, string )
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.
0.9.4
year
year ( )
Returns the current system clock's 4 digit year.
print "today's date is "; print (month + 1) + "/" + day + "/" + year
will display
today's date is 11/30/2009
0.9.4