User Tools

Site Tools


de:singlepage

~~ODT~~

BASIC-256 Syntax Reference

Program Syntax

BASIC-256 programs consist of a series of statements separated by newlines, which are executed in order.

2016/01/01 22:38

Numeric Constants

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).

2016/01/01 22:37

String Constants

String constants are zero or more characters enclosed by double quotation marks(“).

2016/01/01 22:38

Variables

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.

2016/01/01 22:38

Arrays

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.

Example
print myarray[4]

will display on the screen the fifth element in 'myarray'

2016/01/01 22:37
 

Operators

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
LevelOperatorsCategory/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)
8NOTUnary Not
9ANDLogical And
10ORLogical Or
11XORLogical Exclusive Or
2016/01/01 22:38

Statements and Functions - Alphabetic

Abs

Format

abs ( Ausdruck )

Beschreibung

Gibt den absoluten Wert von Ausdruck zur&uuml;ck.

Beispiel
c = abs(a-b)
2016/01/01 22:37

Acos

Format

acos ( expression )

Description

Computes the arc-cosine of expression. Angles are expressed in radians (0 to 2pi).

See Also
2016/01/01 22:37

Asc

Format

asc ( expression )

Description

Converts the first character in a string expression to an integer representing it's ASCII value.

AscChrAscChrAscChrAscChrAscChrAscChr
32SPACE48064@80P96`112p
33!49165A81Q97a113q
3450266B82R98b114r
35#51367C83S99c115s
36$52468D84T100d116t
37%53569E85U101e117u
38&54670F86V102f118v
39'55771G87W103g119w
40(56872H88X104h120x
41)57973I89Y105i121y
42*58:74J90Z106j122z
43+59;75K91[107k123{
44,60<76L92\108l124|
45-61=77M93]109m125}
46.62>78N94^110n126~
47/63?79O95_111o127
See Also

Chr

Example
print asc("A")
print asc("blue")

will print

65
98
New To Version

0.9.4

2016/01/01 22:37

Asin

Format

asin ( expression )

Description

Computes the arc-sine of expression. Angles are expressed in radians (0 to 2pi).

See Also
2016/01/01 22:37

Atan

Format

atan ( expression )

Description

Computes the arc-tangent of expression. Angles are expressed in radians (0 to 2pi).

See Also
2016/01/01 22:37

Ceil

Format

ceil ( Ausdruck )

Beschreibung

Gibt die kleinste ganze Zahl zur&uuml;ck, die gr&ouml;&szlig;er oder gleich Ausdruck ist.

Siehe auch
Beispiel
i = floor(-1.25)
rem i ist -1
2016/01/01 22:37

Changedir

Format

changedir expression
changedir ( expression )

Description

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.

See Also
New To Version

0.9.6r

2016/01/01 22:37

Chr

Format

chr ( expression )

Description

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.

See Also

Asc

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

will print

Boo!
New To Version

0.9.4

2016/01/01 22:37

Circle

Format

circle x,y,r
circle ( x,y,r )

Beschreibung

Zeichnet einen mit der aktuellen Farbe ausgef&uuml;llten Kreis mit Mittelpunkt x,y und Radius r.

Beispiel
color yellow
circle 20,20,10
2016/01/01 22:37

Clickb

Format

clickb
clickb ( )

Description

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
ValueMouse Button Pressed
0None
1Left
2Right
4Center
See Also
Example
# 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 + ")"
New To Version

0.9.4d

2016/01/01 22:37

Clickclear

Format

clickclear
clickclear ( )

Description

Sets ClickB, Clickx, and Clicky to zero so that we can easily tell when the next mouse click is recorded.

See Also
Example

See sample program on Clickb.

New To Version

0.9.4d

2016/01/01 22:37

Clickx

Format

clickx
clickx ( )

Description

Returns the mouse x location of the mouse pointer over the graphic output last time the user clicked a mouse button.

See Also
Example

See sample program on Clickb.

New To Version

0.9.4d

2016/01/01 22:37

Clicky

Format

clicky
clicky ( )

Description

Returns the mouse y location of the mouse pointer over the graphic output last time the user clicked a mouse button.

See Also
Example

See sample program on Clickb.

New To Version

0.9.4d

2016/01/01 22:37

Clg

Format

clg

Beschreibung

L&ouml;scht den Inhalt des Grafikfensters.

2016/01/01 22:37

Close

Format

close
close filenumber
close ( filenumber )

Beschreibung

Schlie&szlig;t die aktuell ge&ouml;ffnete Datei. Wenn gerade keine Datei offen ist, hat der Befehl keine Wirkung.

Siehe auch
2016/01/01 22:37

Cls

Format

cls

Beschreibung

L&ouml;scht den Inhalt des Textfensters.

2016/01/01 22:37

Color

Format

color Farbname
color ( Farbname )
color r, g, b
color ( r, g, b )
color rgb
color ( rgb )

Beschreibung

Setzt die aktuelle Farbe auf Farbname.

Beispiel
color blue
2016/01/01 22:37

Cos

Format

cos ( Ausdruck )

Beschreibung

Berechnet den Kosinus von Ausdruck. Ausdruck muss ein Bogenma&szlig; sein.

Note

Die cos-Funktion liefert kein besonders genaues Ergebnis.

Siehe auch

Sin, Tan

Beispiel
c = cos( 2*PI*deg/360)
2016/01/01 22:37

Currentdir

Format

currentdir
currentdir ( )

Description

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.

See Also
New To Version

0.9.6r

2016/01/01 22:37

Day

Format

day
day ( )

Description

Returns the current system clock's day of the month (1-31).

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

will print|

today's date is 11/30/2009
New To Version

0.9.4

2016/01/01 22:37

DBClose

Format

dbclose
dbclose ( )

Description

Close the currently open SQLite database file.

Example

See example of usage on DBOpen page.

See Also

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

2016/01/01 22:37

DBCloseSet

Format

dbcloseset
dbcloseset ( )

Description

Close the currently open record set opened by DBOpenSet.

Example

See example of usage on DBOpen page.

See Also
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

2016/01/01 22:37

DBExecute

Format

dbexecute SqlStatement
dbexecute ( SqlStatement )

Description

Execute an SQL statement on the open SQLite database file. This statement does not create a record set.

Example

See example of usage on DBOpen page.

See Also
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

2016/01/01 22:37

DBFloat

Format

dbfloat ( ColumnNumber )

Description

Return a floating point (decimal value) from the specified column of the current row of the open recordset.

Example

See example of usage on DBOpen page.

See Also
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

2016/01/01 22:37

DBInt

Format

dbint ( ColumnNumber )

Description

Return an integer value from the specified column of the current row of the open recordset.

Example

See example of usage on DBOpen page.

See Also
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

2016/01/01 22:37

DBOpen

Format

dbopen SQLiteFile
dbopen ( SQLiteFile )

Description

Open an SQLite database file. If the file does not exist then create it.

Example
#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
See Also
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

2016/01/01 22:37

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
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

2016/01/01 22:37

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
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

2016/01/01 22:37

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
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

2016/01/01 22:37

Degrees

Format

degrees ( expression )

Description

Converts an angle in radians to degrees.

See Also
2016/01/01 22:37

Dim

Format

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

Beschreibung

Liefert ein neu erzeugtes Feld der L&auml;nge AnzahlElemente zur&uuml;ck. Der Typ des erzeugten Feldes (Zeichenkettenfeld oder numerisches Feld) wird durch den Typ von Variable bestimmt.

Note

Auf Elemente des Feldes wird via Variable[Index] zugegriffen. Index l&auml;uft von 0 bis (AnzahlElemente - 1)

Beispiel
dim f(100)
f[0] = 1
dim c$(5)
c$[4] = "Hi!"
2016/01/01 22:37
 

End

Format

end

Beschreibung

Beendet die Ausf&uuml;hrung des Programmes.

2016/01/01 22:37

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
New To Version

0.9.4

2016/01/01 22:37

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
New To Version

0.9.4

2016/01/01 22:37

FastGraphics

Format

fastgraphics

Beschreibung

Schaltet in den FastGraphics-Modus, bis das Programm beendet wird. Der FastGraphics-Modus bedeutet, dass der Inhalt des Grafikfensters erst beim n&auml;chsten REFRESH-Befehl aktualisiert wird. Dadurch k&ouml;nnen komplexe Animationen deutlich beschleunigt und Flimmern vermieden werden.

Note

Bei Animationen wird empfohlen, alle Grafikbefehle in Unterprogramme auszulagern und einen einziges REFRESH-Befehl zu benutzen, sobald das Einzelbild fertig ist.

2016/01/01 22:37

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

2016/01/01 22:37

Floor

Format

floor ( Ausdruck )

Beschreibung

Gibt die gr&ouml;&szlig;te ganze Zahl zur&uuml;ck, die kleiner oder gleich Ausdruck ist.

Siehe auch

Ceil

Beispiel

' ' i = floor(-1.25) rem i ist -2' '

2016/01/01 22:37

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
New To Version

0.9.4

2016/01/01 22:37
 

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
Example
color red
print getcolor

will print

16711680
New To Version

0.9.5m

2016/01/01 22:37

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
New To Version

0.9.6b

2016/01/01 22:37

Goto

Format

goto Sprungmarke

Beschreibung

Springt zu Sprungmarke.

Note

Eine Sprungmarke wird mit Bezeichner>: erzeugt, z.B. nochmal:. Basic-Befehle sind als Bezeichner nicht zul&auml;ssig.

Beispiel

' ' goto nochmal' '

2016/01/01 22:37
 

Graphheight

Format

graphheight
graphheight()

Description

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

See Also
New To Version

0.9.3

2016/01/01 22:37

Graphsize

Format

graphsize x_expression, y_expression

Description

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

See Also
New To Version

0.9.3

2016/01/01 22:37

Graphwidth

Format

graphwidth
graphwidth()

Description

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

See Also
New To Version

0.9.3

2016/01/01 22:37

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
New To Version

0.9.4

2016/01/01 22:37

Instr

Format

instr Zeichenkette1, Zeichenkette2

Beschreibung

Pr&uuml;ft, ob Zeichenkette2 in Zeichenkette1 enthalten ist. Wenn ja, wird der Index des Anfangszeichens des ersten Vorkommens von Zeichenkette2 zur&uuml;ckgeliefert. Anderenfalls gibt der Befehl 0 zur&uuml;ck.

Note

Alle Indexe/Positionen innerhalb von Zeichenketten beginnen mit 1.

Beispiel

' ' Die Zeile

print instr("Hallo", "lo")

gibt

4

im Textfenster aus.' '

2016/01/01 22:37

Int

Format

int ( Ausdruck )

int ( Zeichenkettenausdruck )

Beschreibung

Umwandlung in eine ganze Zahl (Integer). Int() schneidet die Dezimalstellen einer Fließkommazahl ab oder wandelt eine Zeichenkette (String) in eine ganze Zahl um.

Beispiel
c$ = "12a" : i = int(c$)

print c$
print i
Ausgabe
12a
12
2016/01/01 22:37
 

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

2016/01/01 22:37

Input

Format

input Zeichenkette, Stringvariable

Beschreibung

Gibt Zeichenkette aus und erwartet eine Texteingabe im Textfenster. Die Eingabe mu&szlig; mit der Eingabe-Taste abgeschlossen werden. Die eingelesene Zeile wird in Variable Stringvariable gespeichert.

Beispiel

' ' input “Bitte gib Deinen Namen ein: ”, name$' '

2016/01/01 22:37

Key

Format

key

Beschreibung

Liefert sofort den zur gerade gedr&uuml;ckten Taste geh&ouml;renden ganzzahligen Wert zur&uuml;ck. Wenn keine Taste gedr&uuml;ckt ist, wird der Wert 0 zur&uuml;ckgeliefert

Note

Dieses Programmst&uuml;ck \\

if key = 47 then print key

tut nicht das gew&uuml;nschte, denn der KEY-Befehl wird 2 Mal hintereinander aufgerufen, liefert im allgemeinen also 2 verschiedene Werte zur&uuml;ck. Richtig m&uuml;&szlig;te der Quelltext so aussehen: \\

a = key
if a = 47 then print a
2016/01/01 22:37

LastError

Format

lasterror
lasterror ( )

Description

Returns the last runtime error number.

Example

See example of usage on Error Codes page.

See Also
New To Version

0.9.6z

2016/01/01 22:37

LastErrorExtra

Format

lasterrorextra
lasterrorextra ( )

Description

Returns statement specific “extra” information about the error.

Example

See example of usage on Error Codes page.

See Also
New To Version

0.9.6z

2016/01/01 22:37

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
New To Version

0.9.6z

2016/01/01 22:37

LastErrorMessage

Format

lasterrormessage
lasterrormessage ( )

Description

Returns a string representing the last runtime error.

Example

See example of usage on Error Codes page.

See Also
New To Version

0.9.6z

2016/01/01 22:37

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
Example
print left("Hello", 2)

will display

He
New To Version

0.9.5b

2016/01/01 22:37

Length

Format

length ( Zeichenkette )

Beschreibung

Liefert die Anzahl von Zeichen in Zeichenkette zur&uuml;ck.

Beispiel

' ' i = length( “Hallo” ) rem i ist 5' '

2016/01/01 22:37

Line

Format

line x0, y0, x1, y1

Beschreibung

Zeichnet eine Linie von Punkt x0,y0 zu Punkt x1, y1.

Beispiel

' ' line 0,0,299,299' '

2016/01/01 22:37

Log

Format

log ( expression )

Description

Return the base e lograthim of expression.

See Also
New To Version

0.9.5w

2016/01/01 22:37
 

Lower

Format

lower( string)

Beschreibung

Wandelt die Buchstaben eines string in Kleinbuchstaben um.

Siehe auch

Upper

print lower("BlaU!")

Ausgabe

blau!
Neu ab Version

0.9.5e

2016/01/01 22:37

Mid

Format

mid ( Zeichenkette, Startindex, L&auml;nge )

Beschreibung

Gibt ein L&auml;nge Zeichen langes Teilst&uuml;ck der Zeichenkette zur&uuml;ck, startend beiStartindex.

Beispiel

' ' Die Zeile

print mid("Hello", 2, 3)

gibt im Textfenster

ell

aus.' '

2016/01/01 22:37

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
New To Version

0.9.4

2016/01/01 22:37

Month

Format

month
month()

Description

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

See Also
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

2016/01/01 22:37

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
ValueMouse Button Pressed
0None
1Left
2Right
4Center
See Also
New To Version

0.9.4d

2016/01/01 22:37

Mousex

Format

mousex
mousex()

Description

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

See Also
New To Version

0.9.4d

2016/01/01 22:37

Mousey

Format

mousey
mousey()

Description

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

See Also
New To Version

0.9.4d

2016/01/01 22:37

NetClose

Format

netclose
netclose ( )
netclose socket_numberinteger expression representing one of the current network sockets
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
New To Version

0.9.6.31

2016/01/01 22:37

NetConnect

Format

netconnect server_name, port_number
netconnect ( server_name, port_number )
netconnect socket_numberinteger expression representing one of the current network sockets, 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
New To Version

0.9.6.31

2016/01/01 22:37

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
New To Version

0.9.6.31

2016/01/01 22:37

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
New To Version

0.9.6.31

2016/01/01 22:37

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
New To Version

0.9.6.31

2016/01/01 22:37

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
New To Version

0.9.6.31

2016/01/01 22:37

Open

Format

open Dateiname

Beschreibung

&Ouml;ffnet eine Datei zum Lesen und Schreiben. Der Dateiname mu&szlig; als Zeichenkette angegeben werden

          und kann eine absolute oder relative Pfadangabe enthalten.
Note

Zu einem gegebenen Zeitpunkt kann nur eine Datei ge&ouml;ffnet sein. Wenn eine neue Datei ge&ouml;ffnet wird, w&auml;hrend eine andere Datei bereits offen ist, wird diese andere Datei geschlossen.

Siehe auch

Close, Read, Write, Reset

2016/01/01 22:37

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
New To Version

0.9.6z

2016/01/01 22:37

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
New To Version

0.9.6z

2016/01/01 22:37

Pause

Format

pause Sekunden

Beschreibung

H&auml;lt die Programmausf&uuml;hrung f&uuml;r die angegebene Anzahl Sekunden an. Der Sekunden-Wert kann eine Flie&szlig;kommazahl sein, damit sind auch Pausen kleiner als eine Sekunde m&ouml;glich.

Beispiel

' ' pause 0.1' '

2016/01/01 22:38

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

2016/01/01 22:38

Plot

Format

plot x, y

Beschreibung

Gibt dem Pixel an der Koordinatenposition x,y im Grafikfenster die aktuelle Farbe.

Beispiel

' ' plot 10,10' '

2016/01/01 22:38

Poly

Format

poly Feld

Beschreibung

Zeichnet ein Polygon. Die Seiten des Polygons werden durch die Werte im Feld bestimmt, welche immer abwechselnd x-Werte und y-Werte sein sollten.

Beispiel

' ' dim a(6)<br> …<br>poly a' '

2016/01/01 22:38

Print

Format

print Ausdruck [ ; ]

Beschreibung

Gibt einen Text im Textfenster aus, gefolgt von einem Zeilenumbruch. Wenn das optionale Semikolon am Ende vorhanden ist, erfolgt kein Zeilenumbruch.

Beispiel

' ' print “Hallo ”; : print“Du !”' '

2016/01/01 22:38

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
New To Version

0.9.6b

2016/01/01 22:38

Radians

Format

radians ( expression )

Description

Converts an angle in degrees to radians.

See Also
2016/01/01 22:38

Rand

Format

rand

Beschreibung

Liefert eine Zufallszahl zwischen 0 und 1 zur&uuml;ck. Die Werteverteilung ist gleichf&ouml;rmig.

Note

Um Zufallszahlem mit einem anderen Wertebereich zu erzeugen, k&ouml;nnen die notwendigen Zahlen zum RAND-Ergebnis addiert oder damit multipliziert werden. Um zum Beispiel eine ganzahlige Zufallszahl zwischen 0 und 10 (einschlie&szlig;lich) zu erzeugen, kann int(rand * 10) benutzt werden.

2016/01/01 22:38

Read

Format

read

Beschreibung

Liest einen Token von der gerade ge&ouml;ffneten Datei ein und gibt ihn zur&uuml;ck. Ein Token ist jegliche Zeichenkette, die mit einem Leerzeichen, einem Tabulator oder dem Zeilenende endet.

Siehe auch

Open, Close, Write, Reset

2016/01/01 22:38

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
2016/01/01 22:38

Rect

Format

rect x,y,b,h

Beschreibung

Zeichnet ein mit der aktuellen Farbe ausgef&uuml;lltes Rechteck mit der H&ouml;he h Pixel und der Breite b Pixel. Die obere linke Ecke hat die Koodinaten x,y.

2016/01/01 22:38

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

2016/01/01 22:38

Refresh

Format

refresh

Beschreibung

Aktualisiert das Grafikfenster mit allen Grafikbefehlen, die seit dem vorherigen REFRESH abgesetzt wurden. REFRESH funktioniert nur im FastGraphics-Modus.

2016/01/01 22:38

Rem

Format

rem Kommentar ==== Beschreibung ==== Steht am Anfang einer Kommentarzeile. Zeilen, die mit REM beginnen, werden bei der Programmausf&uuml;hrung ignoriert.

2016/01/01 22:38

Reset

Format

reset

Beschreibung

L&ouml;scht den Inhalt der aktuell ge&ouml;ffneten Datei. Der Inhalt der Datei geht verloren.

Siehe auch

Open, Read, Close, Write

2016/01/01 22:38

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
New To Version

0.9.5m

2016/01/01 22:38
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
Example
print right("Hello", 2)

will display

lo
New To Version

0.9.5b

2016/01/01 22:38

Say

Format

say expression say ( expression )

Description

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.

New To Version

0.9.4

2016/01/01 22:38

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
New To Version

0.9.4

2016/01/01 22:38

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
New To Version

0.9.4

2016/01/01 22:38

Sin

Format

sin ( Ausdruck )

Beschreibung

Berechnet den Sinus von Ausdruck. Ausdruck muss ein Bogenma&szlig; sein.

Note

Die sin-Funktion liefert kein besonders genaues Ergebnis.

Siehe auch

Cos, Tan

Beispiel

' ' s = sin( 2*PI*deg/360)' '

2016/01/01 22:38

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
New To Version

0.9.4

2016/01/01 22:38

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
2016/01/01 22:38

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
New To Version

0.9.6n

2016/01/01 22:38

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
New To Version

0.9.6n

2016/01/01 22:38

Spriteh

Format

spriteh ( spritenumber )

Description

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

See Also
New To Version

0.9.6n

2016/01/01 22:38

Spritehide

Format

spritehide spritenumber spritehide ( spritenumber )

Description

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

See Also
New To Version

0.9.6n

2016/01/01 22:38

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
New To Version

0.9.6n

2016/01/01 22:38

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
New To Version

0.9.6n

2016/01/01 22:38

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
New To Version

0.9.6n

2016/01/01 22:38

Spriteshow

Format

spriteshow spritenumber
spriteshow ( spritenumber )

Description

Show a hidden sprite.

See Also
New To Version

0.9.6n

2016/01/01 22:38

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
New To Version

0.9.6o

2016/01/01 22:38

Spritev

Format

spritev ( spritenumber )

Description

Returns true if the sprite is visible.

See Also
New To Version

0.9.6o

2016/01/01 22:38

Spritew

Format

spritew ( spritenumber )

Description

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

See Also
New To Version

0.9.6n

2016/01/01 22:38

Spritex

Format

spritex ( spritenumber )

Description

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

See Also
New To Version

0.9.6n

2016/01/01 22:38

Spritey

Format

spritey ( spritenumber )

Description

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

See Also
New To Version

0.9.6n

2016/01/01 22:38

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
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

2016/01/01 22:38

String

Format

string ( Ausdruck )

Beschreibung

Liefert die Zahl Ausdruck als Zeichenkette zur&uuml;ck.

Beispiel

' ' s$ = string(12*13) rem s$ ist “156”' '

2016/01/01 22:38

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

2016/01/01 22:38

Tan

Format

tan ( Ausdruck )

Beschreibung

Berechnet den Tangens von Ausdruck. Ausdruck muss ein Bogenma&szlig; sein.

Note

Die tan()-Funktion liefert kein besonders genaues Ergebnis.

Siehe auch

Sin, Cos

Beispiel

' ' t = tan( 2*PI*deg/360 )' '

2016/01/01 22:38

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
New To Version

0.9.4

2016/01/01 22:38

Upper

Format

upper ( string )

Beschreibung

Wandelt die Buchstaben eines string in Großbuchstaben um.

Siehe auch
Beispiel
print upper("BlaU!")

Ausgabe

BLAU!
Neu ab Version

0.9.5e

2016/01/01 22:38

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
New To Version

0.9.5i

2016/01/01 22:38

WAVplay

Format

wavplay filename
wavplay ( filename )

Description

Play WAV audio file asynchronously (in the background).

See Also
New To Version

0.9.4

2016/01/01 22:38

WAVstop

Format

wavstop

Description

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

See Also
New To Version

0.9.4

2016/01/01 22:38
 

Write

Format

write Zeichenkette

Beschreibung

Schreibt die Zeichenkette an das Ende der aktuell ge&ouml;ffneten Datei.

Siehe auch

Open, Read, Close, Reset

2016/01/01 22:38

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
New To Version

0.9.4

2016/01/01 22:38

Year

Format

year
year ( )

Description

Returns the current system clock's 4 digit year.

See Also
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

2016/01/01 22:38
de/singlepage.txt · Last modified: 2016/01/01 22:38 (external edit)