Home      Downloads             Documentation      FAQ     

Documentation>ETP-Basic reference>Function library

 

A set of procedure and function is included in the ETP-Basic compiler. You have nothing to do for load them. You can use them directly. For the moment, there are not a lot of function but next functions will be added according to needs of developers. Do not hesitate to make a suggestion to the author.

 
Locate
Line
ContrastUp
ContrastDown
DrawPixel
GetPixel
Wait
Message
Font
WaitKey
GrayOn
GrayOff
DarkPlane
LightPlane
Clear
ClearAll
Left
Right
Mid
ValInt
ValLong
Len
GetKey
Rand



Locate

Prototype

Locate (x as Integer, y as Integer, str as String, d as Integer)

Description

Displays the string str at x,y coordinates.

d is a display parameter. Use d=4 for a normal display.

Example

Locate 10,30,"Hello!!",4

This example displays "Hello!!" at 10,30 coordinates

 

Line

Prototype

Line (x1 as Integer, y1 as Integer,x1 as Integer, y1 as Integer,d as Integer)

Description

Displays a line between the dot defined by x1,y1 and the point defined by x2,y2

d is a display parameter. Use d=4 for a normal display.

Example

Line 10,30,40,20,4

This example displays a line with (10;30) and (40;20) as extremities.

 

 

ContrastUp

Prototype

ContrastUp ()

Description

Increases the contrast of the screen.

Example

Local i as Integer

For i=1 To 5
   ContrastUp
Next

This example increases the contrast by 5.

 

ContrastDown

Prototype

ContrastDown ()

Description

Decreases the contrast of the screen.

Example

Local i as Integer

For i=1 To 5
   ContrastDown
Next

This example decreases the contrast by 5.

 

DrawPixel

Prototype

DrawPixel (x as Integer, y as Integer, d as Integer)

Description

Displays the pixel given by x,y coordinates.

d is a display parameter. Use d=4 for a normal display.

Example

DrawPixel 10,30,4

This example displays a pixel at 10,30 coordinates.

 

GetPixel

Prototype

GetPixel (x as Integer, y as Integer) as Integer

Description

Returns 1 if the pixel at x,y is activated and 0 else. You can use it for a conditional test of for an affectation.

Example

If GetPixel (10,30)<>0 Then
     'instructions...
EndIf

This example allows to execute some instructions if the pixel at 10,30 coordinates is actived.

 

 

Wait

Prototype

Wait (delay as Integer)

Description

Waits during a time defined by delay parameter. delay must be given in a 1/20 of a second. So put delay=20 to make wait your calculator during one seconde.

Example

Wait 20
Locate 10,30,"It took one seconde",4
Wait 100
Locate 10,40,"It took 5 secondes",4

This example waits during one second and displays "It took one seconde"

and then, the calculator waits 5 secondes et displays "It took 5 secondes"

 

Message

Prototype

Message (str as String)

Description

Displays a message defined by str in the toolbar on the bottom side of the screen.

Example

Message "I'm at bottom.."

This example allows to display a text in the bottom side of the screen.

 

Font

Prototype

Font (ft as Integer)

Description

Allows to change the current font. There are the font in your calculator system: Small, Normal et Huge. Choose the ft parametre according to the font you want to select

  Size ft =
Small 4x6 0
Normal 6x8 1
Huge 8x10 2

Example

Font 0
Locate 10,30,"Small",4
Font 1
Locate 10,40,"Normal",4
Locate 10,60,"Normal too",4

Font 2
Locate 10,60,"Big",4

This example displays these texts: "Petit","Normal","Normal too " and "Grand" with different sizes.

 

 

WaitKey

Prototype

WaitKey ()

Description

Waits the user to press a key. WaitKey does not allow to know which key was pressed.

Example

Locate 1,30,"Press a key to continue",4
WaitKey
Locate 1,40,"You pressed a key!!",4

This example displays a text, waits the user to press a key and then displays the message "You pressed a key!!"

 

GrayOn

Prototype

GrayOn ()

Description

Allows to turn the GrayScale Mode ON

To learn more about GrayScale

 

GrayOff

Prototype

GrayOff ()

Description

Allows to turn the GrayScale Mode OFF. If you have turned this mode ON during your program, you must use this one to quit properly and turn this mode off.

To learn more about GrayScale

 

 

LightPlane

Prototype

LightPlane ()

Description

Sets the LightPlane as the current layer. Every display function after LightPlane instruction will draw something on the Light Layer

To learn more about GrayScale

Example

GrayOn

LightPlane
Locate 20,40,"This is light!",4
Locate 20,50,"Same thing",4

DarkPlane
Locate 1,10,"This is dark!",4
Locate 1,20,"This is dark tooi!",4

This example activates GrayScale Mode with the GrayOn instruction

First, we set the light plane as current draw layer for writing some messages in light, and then we choose the dark one to put some messages in a dark color.

 

DarkPlane

Prototype

DarkPlane ()

Description

Sets the DarkPlane as the current layer. Every display function after DarkPlane instruction will draw something on the Dark Layer

To learn more about GrayScale

Example

GrayOn

LightPlane
Locate 20,40,"This is light!",4
Locate 20,50,"Same thing",4

DarkPlane
Locate 1,10,"This is dark!",4
Locate 1,20,"This is dark tooi!",4

This example activates GrayScale Mode with the GrayOn instruction

First, we set the light plane as current draw layer for writing some messages in light, and then we choose the dark one to put some messages in a dark color.

 

Clear

Prototype

Clear ()

Description

Clears the screen. If you don't work in GrayScale mode, this function clears all the clear. If you are in GrayScale mode, the function clears only the DarkPlane. In this case, you had to use ClearAll function to clear the both layers.

Example

Locate 1,30,"Press a key to clear",4
Locate 1,40,"the screen",4
WaitKey
Clear

This example displays a text, waits the user to press a key and clears the screen.

 

ClearAll

Prototype

ClearAll ()

Description

This function must to be used only in GrayScale Mode. It allows to clear the screen.

Example

GrayOn

LightPlane
Locate 20,40,"This is light!",4
DarkPlane
Locate 1,10,"This is dark!",4

ClearAll

This example displays a text in light color, another one in dark color and clear both of them.

 

Left

Prototype

Left (str as String, lg as Integer) as String

Description

Retourne le caractères les plus à gauche de la chaine de caractère str. Le nombre de caractère à retourner est défini par lg.

Example

Complet = "Je suis heureux de vous voir"
Partial = Left(Complet,7)

Cet Example affecte le texte "Je suis heureux de vous voir" à la variable Complet. On appelle la fonction Left pour recopier les 7 premiers caractères de Complet dans Partial. La variable Partial contient donc "Je suis"

 

Right

Prototype

Right (str as String, lg as Integer) as String

Description

Retourne le caractères les plus à droite de la chaine de caractère str. Le nombre de caractère à retourner est défini par lg.

Example

Complet = "Je suis heureux de vous voir"
Partial = Right(Complet,7)

Cet Example affecte le texte "Je suis heureux de vous voir" à la variable Complet. On appelle la fonction Right pour recopier les 7 derniers caractères de Complet dans Partial. La variable Partial contient donc "us voir"

 

Mid

Prototype

Mid (str as String,start as Integer, lg as Integer) as String

Description

Retourne le caractères de longueur lg, contenu dans str, en commençant au caractère qui se trouve à la place start.

Example

Complet = "Je suis heureux de vous voir"
Partial = Mid(Complet,9,7)

Cet Example affecte le texte "Je suis heureux de vous voir" à la variable Complet. On appelle la fonction Mid pour recopier 7 caractères de Complet dans Partial en commençant par le neuvième. La variable Partial contient donc "heureux"

 

 

 

 

Documentation>ETP-Basic reference>Tables

     
    About ETP Contact Us