XLANG 1.0 programming language script file help, KG Software -2001.
Copyleft X-GUI project 1999-2001.         (Best viewed in EDIT.COM)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

READ INFO BELOW FIRST!
^^^^^^^^^^^^^^^^^^^^^^^^^
Anything with the star * means the statement can accept variable intake...
SOMETHING MyVar%,MyVar$ instead of SOMETHING 10,"??".
Anything WITHOUT the star * means you MUST define it's input....
Anything WITH the # means you CAN NOT use this statement in the REFRESHED
section.
SOMETHING 10,"??"        <-- predefined input (no star)
SOMETHING MyVar$,MyVar%  <-- variable input OR can be predefined (*)
Variables are defined as two types, a $ after the name is a STRING type
variable, and a % is a floating point variable, almost like in BASIC
programming besides in BASIC the % is a integer, where as in XLANG it's
floating point math.
PLEASE NOTE: Variables and labels in XLANG 1.0 are also case
sensitive! Unlike the common BASIC programming language.
Variables and labels may be any length in size AND contents as long as
X-GUI has enough internal memory space. In other words, try to keep labels
and variables names AND there contents to a minimal.


STATEMENT                           *#   INFORMATION
|----------------------------------|  |--|-------------------------
 SECTION something                        Defines a section of your program...
                                           Where 'something' is one of these..
                                           INFO is the aria where windows info
                                            is defined.
         example: SECTION DATA             REFRESHED is the aria where your
                                            code runs when the window must be 
                                            refreshed.
                                           LOOPED is the aria where your code
                                            runs looped when REFRESHED is NOT
                                            called.
                                           CLOSED is the aria where your code
                                            runs when the window gets closed.
                                            you would close out any open files
                                            and stop processes here.
                                           DATA is the aria where your data
                                            variables (strings and integers)
                                            are defined.

 END                                       Defines the end of a SECTION.

 WINX1 = window_start_X_location           This internal variable is set in
                                            the DATA section and tells the
                                            X-GUI interface where to put your
                                            programs window on startup.
 WINY1 = window_start_Y_location           Look at WINX1 information.
 WINX2 = window_end_X_location             Look at WINX1 information.
 WINY2 = window_end_Y_location             Look at WINX1 information.
 WINTL = "Windows Title"                   Look at WINX1 information.

 CLS                                       Clears the windows contents home.

 FNT "Myfont.fon"                   *      Changes the font for statements
                                            like PRN. DO NOT include the
                                            directory where the font is since
                                            this statements figures it's the
                                            X-GUI fonts directory.
 FNT "SYSTEM"                               Changes the font back to the
                                            system font used by the interface.

 PRN X%,Y%,"Hello!",FCOLOR%,BCOLOR% *      Prints a font string to the window.

 PCX X%,Y%,FileName$                *      Places a PCX image into the window.
 PCXMAKE X1%,Y1%,X2%,Y2%,FileName$  *      Creates a PCX image from aria in
                                            the window.
 PCXMAKR X1%,Y1%,X2%,Y2%,FileName$  *      Creates a PCX image using the full
                                           screens coordinates.
         Example: PCXMAKR 0,0,640,480,"ScrShot.PCX"

 SNAPSHOT FileName$                 *      Takes a full snapshot of the
                                            display and also showing the
          Example: SNAPSHOT "ScrShot.PCX"   mouse pointer.

 GETTIME MyTimeVariable$            *      Places time into MyTimeVariable$
 GETDATE MyDateVariable$            *      Places date into MyDateVariable$
 SETTIME MyTimeVariable$            *      Sets the systems time. HH:MM:SS
 SETDATE MyDateVariable$            *      Sets the systems date. MM/DD/YYYY

 GETTIMER MyTimerVariable%          *      Gets the timer count...
                                            MyTimerVariable% represents the
                                            number of seconds elapsed since
                                            midnight; used to time programs
                                            or parts of programs.
                                            
 GETTMP TempsDir$                   *      Get the temps directory. You may
                                            use this directory to store
                                            program information but make shure
                                            to have your program delete it
                                            after it closes.
 GETICO IconsDir$                   *      Gets the X-GUI icons directory.
                                            This would be useful if you need
                                            to load a icon graphic (using the
                                            PCX statement) and don't know for
                                            shure where the icons directory
                                            will be installed to on a users
                                            machine.
 GETTRASH TrashDir$                 *      This is a nill directory.
                                            In the future X-GUI may use this
                                            as its trashcan directory.
 GETCURDIR CurrentDir$              *      Gets the current directory, this
                                            should always be X-GUI's.

 GETWXL X%                          *      Gets the current windows X length.
   (Get Windows X Length)
 GETWYL Y%                          *      Gets the current windows Y length.
   (Get Windows Y Length)
 GETID ID$                          *      Gets the windows special ID...
                                            When any window is opened for the
                                            first time, a ID is set for that
   Example: GETID MyWindowsID$              window for the rest of the time
                                            it is open. This statement will
                                            return that ID number in a string
                                            as ID$. This can be used to save
                                            temp files under the ID$ name so
                                            that other copies of the same
                                            program running does not effect
                                            each others temp files. This is
                                            a very important thing to know
                                            when programming for XLANG.

 JMP MyLabel                         #     Jumps to a label.
 MyLabel:                                  Creates a label to jump to later.

 MOV Dest,Source                    *      Moves the contents of a variable
     Example: MOV A%,10                     or define into a variable.
     Example: MOV A$,"Hello!"               This will also work on strings...
     Example: MOV B$,A$                     MOV B$,A$ ;moves A$ into B$

 ADD Dest,Source                    *      Adds a number to a variable...
     Example: ADD A%,10  ;A%=A%+10
     Example: ADD A%,B%  ;A%=A%+B%
 SUB Dest,Source                    *      Subtract a number from a variable..
     Example: SUB A%,10  ;A%=A%-10
     Example: SUB A%,B%  ;A%=A%-B%
 MUL Dest,Source                    *      Multiply a number to a variable..
     Example: MUL A%,10  ;A%=A%*10
     Example: MUL A%,B%  ;A%=A%*B%
 DIV Dest,Source                    *      Devides a number from a variable..
     Example: DEV A%,10  ;A%=A%/10
     Example: DEV A%,B%  ;A%=A%/B%

 MBX Message$,WinTitle$,
      ButtonOKTitle$,ButtonCancel$,
      Return%                       *      Creates a message box....
                                            Message$ is your message to show
                                            WinTitle$ is the windows title
                                            ButtonOKTitle$ is the OK button
                                             label, default " OK "
                                            ButtonCancel$ is the CANCEL button
                                             label, "" for no cancel button,
                                             or "label" to use this button.
                                            Return% is the variable set of the
                                             return status...
                                              0 = window closed or error
                                              1 = ButtonOK clicked
                                              2 = ButtonCancel clicked
      Example: MBX "Hello you!","Message.."
                ," OK ","",R%
      Note: You may not put any "," within the input strings unless in
            variable form, EG: A$ "Hello, World"

 IBX Message$,WinTitle$,Default$,ButtonOKTitle$,
      ButtonCancel$,Return$         *       Creates a input box....
                                             Message$ is your message prompt
                                             WinTitle$ is the windows title
                                             Default$ is the default inputstr
                                             ButtonOKTitle$ is the OK button
                                              label, default " OK "
                                             ButtonCancel$ is the CANCEL button
                                              label, "" for no cancel button,
                                              or "label" to use this button.
                                             Return$ is the variable to put
                                              the input string into when done.
                                              If input field = "" then Return$
                                              will be "NONE" as return.
      Example: IBX "Type something...",
                "Inputbox function","Text",
                " ACCEPT "," CANCEL ",R$
               PRN 1,1,R$,0,7   ;Print the input..
      Note: You may not put any "," within the input strings unless in
            variable form, EG: A$ "Hello, World"

 MNU X%,Y%,Items$,Return$           *        Creates a popup menu....
                                              X% and Y% are where to create
                                              the popup menu at within screen.
                                              Items is a list with leading "."
                                              at the end of them.
                                              Return$ will be the item that
                                              was selected or "NONE" if none
                                              was selected.
       Example: MNU 1,1,"Item 1.Ite
                 m2.SEPARATOR.Item3.",R$
                PRN 1,1,R$,0,7

 FS Pattern$,Directory$,            *        File Selector....
     WinTitle$,Selection$                     Pattern$ is the pattern to
                                              search for, Example "*.EXE"
     Example:                                 Directory$ is the directory
      FS "*.*","","Please sele                to show the files when the
       ct a file!",S$                         FS window shows, but can be
      PRN 1,1,"File selected was..",0,7       changed by user at any time.
      PRN 1,15,S$,0,7                         WinTitle$ is the title of the
                                              FS's window.
                                              Selection$ returns the file
                                              selected or nothing if the
                                              window was closed by user (Can
                                              celed).

 CMP VarA%,VarB% or CMP VarA$,VarB$ *#       Compares two variables or a
                                              variable to a define..
                                               CMP VarA%,2
                                              Look at the conventional jumps
                                              below..

 JE Label                            #       Jumps if equal, look at CMP.
 JNE Label                           #       Jumps if NOT equal, look at CMP.
 JA Label                            #       Jumps if above, look at CMP.
 JAE Label                           #       Jumps if above or equal, look at CMP.
 JB Label                            #       Jumps if below, look at CMP.
 JBE Label                           #       Jumps if below or equal, look at CMP.
      Example: CMP A%,10
               JE ItIsEqual  ;Jumps if A%=10
               CMP A%,10
               JNE ItIsNot   ;Jumps if A%<>10
               CMP A%,10
               JAE ItsMore   ;Jumps if A%>=10

 MLI X%,Y%,B%                       *        Gets mouse location and button
                                              information. X% and Y% are
     (Mouse Location Information)             relative to the windows X1% and
                                              Y1% location. If X% is at 0 then
                                              the mouses X% is really at the
                                              windows X1% coordinate and same
                                              for mouses Y%.
 MLR X%,Y%,B%                       *        Gets the real mouse location
                                              on the screen. If X% is at 0
     (Mouse Location REAL)                    then the mouses X% is really at
                                              the screens 0 coordinate and
                                              same for mouses Y%.
 MBP X%,Y%,B%,RequestButton%        *        Returns the button pressed and
                                              it's X% and Y% coords where
     Example: MBP XChk%,YChk%,B%,1            it was pressed.
                                              You must set RequestButton% to
                                              the button to check the status
                                              on. 1 for left button, 2 for
                                              right and ect..
 MBR X%,Y%,B%,RequestButton%        *        Returns the button released and
                                              it's X% amd Y% coords where
     Example: MBR XChk%,YChk%,B%,2            it was pressed.
                                              You must set RequestButton% to
                                              the button to check the status
                                              on. 1 for left button, 2 for
                                              right and ect..

 VIEWOFF                                     Turns the windows VIEW SCREEN
                                              off so that graphics can write
                                              to the full screen and not just
                                              the windows coordinates.

 VIEWON                                      Turns the windows VIEW SCREEN
                                              back on. Look at VIEWOFF for
                                              more information.

 CALL MyLabel                        #       Call subroutine, look at RET.
 RET                                 #       Return from a CALL in code.
          Example:   CALL Demo1
                     ; some code here..
                     HALT
                     Demo1:
                       ;some code in here..
                     RET

 HALT                                        Returns control to X-GUI but does
                                              not close the program.
 SYSTEM                             *        Returns control to X-GUI and
                                              closes your application window.

 RND RandomMax%,Variable%           *        Gets a random number from 0 to
                                              RandomMax% and puts it into
                                              the variable Variable%

 INKEY Key$                         *        Gets the last keypress from the
                                              keyboard buffer and puts it into
                                              Key$.

 STRADD DestStr$,SourceStr$         *        Takes the contents from
                                              SourceStr$ and puts it at the
                                              end of DestStr$.
 LTRIM String$                      *        Left space trim a string.
 RTRIM String$                      *        Right space trim a string.
 UCASE String$                      *        Converts a string into all upper-
                                              case characters.
 LCASE String$                      *        Converts a string into all lower-
                                              case characters.
 STRLEN String$,Length%             *        Gets length of String$ and puts
                                              it into Length% variable.
 STRLEFT DestStr$,SourceStr$,
          CharactersLeft%           *        Gets CharactersLeft% left of
                                              string and puts it into DestStr$
 STRRIGHT DestStr$,SourceStr$,
           CharactersRight%         *        Gets CharactersRight right of
                                              string and puts it into DestStr$
 STRMID DestStr$,SourceStr$,Start%
         Length%                    *        Gets a portion of a string...
                                              Start% is where to start at
        Example: STRMID B$,A$,4,6             Length% is where to stop.
                        ;Gets 2 characters    

 CHARPUT DestStr$,Character%        *        Puts a ASCII character into a
                                              string. Example: CHARPUT A$,1
 CHARSTRING DestStr$,Character%,    *        Puts a string of ASCII characters
             Length%                          into a string variable.
            Example: CHARSTRING A$,1,20 ; Puts 20 happy faces into A$

 RUN FileName$                      *#       Either runs another XLANG script
                                              in a new window without exiting
     Example: RUN "another.xsf"               your current program or runs
     Example: RUN "somethng.bat"              a .exe .bat .com shell operation.
                                             
 RUNEND [FileName$]                 *#       Closes a XLANG process started
                                              by the RUN statement.
      Example: RUN "somethng.xsf"         
               RUNEND "somethng.xsf"


 KILL FileName$                     *        Deletes a file from the drive.
 RMDIR Directory$                   *        Remove a empty directory.
 MKDIR Directory$                   *        Create a directory.
 EXIST FileName$,Truth%             *        Checks if a file exists, returns
                                              a true 1 in Truth% if it does or
                                              0 false if not.
                                             
 OCOM ComNum$,COMType%,COMHandle%   *     Opens a COM port for I/O (Modem, mouse, 
                                             electronics projects)...
      Example: OCOM "COM1",0,FH1%            ComNum$ is a text designation of
               CI TheInput$                   which COM port is to be opened. For
               CLOSE FH1%                     now, only COM1 and COM2 work.
               PRN 1,1,TheInput$,0,7           COM1 - Common Mouse/Modem port
					       COM2 - Common Modem port
                                             COMType% is one of these...
                                               0 open for line input
                                               1 open for line output
                                               2 open for append output
                                               3 open for binary i/o
                                             COMHandle% will return the

                                              handle of the file opened. You
                                              do not set this, it only returns
                                              information to your program.
           
 OPEN FileName$,FileType%,FileHandle% *      Opens a file for i/o...
                                              FileName$ is the file to open
      Example: OPEN "MyFile.Txt",0,FH1%       FileType% is one of these...
               LI TheInput$                    0 open for line input
               CLOSE FH1%                      1 open for line output
               PRN 1,1,TheInput$,0,7           2 open for append output
                                               3 open for binary i/o
                                              FileHandle% will return the
                                               handle of the file opened. You
                                               do not set this, it only returns
                                               information to your program.
 CI COMHandle%,Variable$           *          Line Input from a opened COM..
                                               This will read one ASCII text
         Example: CI FH%,TheInput$             line at a time.
 LI FileHandle%,Variable$           *         Line Input from a opened file..
                                               This will read one ASCII text
         Example: LI FH%,TheInput$             line at a time.
                                             
 CP COMHandle%,Variable$           *         Line Print to a opened COM..
                                               This will print a line of ASCII
                                               text to a opened file.
 LP FileHandle%,Variable$           *         Line Print to a opened file..
                                               This will print a line of ASCII
                                               text to a opened file.
                                             
 GET FileHandle%,Character$,position% *       Gets a ASCII character from a
                                               file opened as binary i/o.
     Example:   OPEN "cool.bin",3,FH%          if position% = -1 then the
                GET FH%,A$                     position will add +1 starting at
                CLOSE FH%                      0 when file was opened.
                                             
 PUT FileHandle%,Character$,position% *       Puts a ASCII character into a
                                               file opened as binary i/o.
     Example:   OPEN "cool.bin",3,FH%          if position% = -1 then the
                PUT FH%,A$                     position will add +1 starting at
                CLOSE FH%                      0 when file was opened.
                                             
 CLOSE FileHandle%                  *         Close a file that used OPEN
       Example: CLOSE FileHandle%  ;Close a file..

 INP port%,Variable%                *         Inputs data from a port% and puts
                                               it into Variable%.
 OUT port%,Variable%                *         Outputs Variable% contents to a
                                               port%.
                                             
 3DBOX X1%,Y1%,X2%,Y2%,Puff%,       *         Draws a 3Dish looking box.
        Thickness%,InnerCol%                   X1%,Y1%,X2%,Y2% are coords..
                                               Puff% is how it shows, 0 for
                                               puffed out, 1 for puffed in.
                                               Thickness% is how thick the
                                               box is.
                                               InnerCol% is the inner form
                                               color. -1 makes no inner fill
                                               but still paints the 3D box.
 LINE X1%,Y1%,X2%,Y2%,Color%,Type%  *         Draws a line or a empty box or
                                               a filled box defined in Type%...
                                               X1%,Y1%,X2%,Y2% are the coords.
                                               Color% is a color of 256 choices
                                               Type%, 0 for line, 1 for anti-
                                               alias line, 2 for empty box,
                                               3 for filled box.
 CIRCLE CenterX%,CenterY%,Color%,   *         Draws a empty circle or filled..
         Radius%,Type%                         CenterX% and CenterY% are coords
                                               Color% is a color of 256 choices
                                               Radius% is the size of the circ.
                                               Type%, 0 for empty circle, 1
                                               for filled circle.
 PAINT X%,Y%,Color%                 *         Fills a aria with the value
                                               of Color%.
 GETPOINT X%,Y%,ColorVariable%      *         Gets the color of a pixel at
                                               X%,Y% within the window and
                                               returns in ColorVariable%.
 JOYXY X%,Y%,Buttons%,TagID%        *         Returns the joystick location...
                                               X%,Y% returns the location.
       Example JOYXY X%,Y%,B%,0                TagID% is the joystick, 0 for
                                               joystick A, 1 for joystick B (
                                               a second joystick).
                                               B% is the buttons status.
 OVERSCANSET ColorSet%              *         Sets the color of the border
                                               around the display, normally
                                               black. Useful to alert user
                                               with a white color flash, or
                                               multicolors if a user wins a
                                               game or whatever.
 SLEEP SecondCount%                 *         Makes the computer seem to
                                               sleep for a number of seconds.
                                               will NOT wait for keypress
                                               unlike QBasic.
 TICKTOCK TimerTicks%               *         Wait for a amount of slow timer
                                               ticks before program execution
                                               continues.
 WAV FileName$                      *         Plays a 8 bit PCI mono format
                                               .WAV file through the internal
                                               PC speaker OR a compatible
                                               sound blaster card depending
                                               on how the SETTINGS.INI file
                                               is set up when X-GUI was
                                               installed. KG Software will
                                               add more sound card
                                               compatibility later in versions
 SOUND Frequency%,Duration%         *         Makes the computer internal PC
                                               speaker sound a tone.
       Example: SOUND 800,1                    Frequency% is calculated in
                                               hertz from 37 to 32,767.
                                               The Duration% is the number of
                                               clock ticks the sound will last.
                                               This value is in the range from
                                               0 to 65,535. There are 18.2 clock
                                               ticks per second.
 BEEP                                         Beeps the computer internal PC
                                               speaker at 800 hertz.
 CLICK                                        Clicks the computer internal PC
                                               speaker.
 PLAY Commandstring$                          Plays music like SOUND can...
                                               The syntax is the same as
                                               the well known QBasic programming
                                               language. It is recommended to
                                               use SOUND since it does not
                                               hold up the other processes like
                                               PLAY will.
                                              
                                              
                                              
                                               


BASIC SKELETON SCRIPT FILE:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
; DEMO.XSF skeleton program example....

SECTION INFO
  ; In this section goes the stuff to control where X-GUI will put your window
  ; when your program starts, even though the user may change it's location at
  ; any time in operation.
  WINX1 = 20
  WINY1 = 70
  WINX2 = 620
  WINY2 = 150
  WINTL = "My first XLANG X-GUI program!"
  END
SECTION REFRESHED
  ; In this section is stuff to be done when the window makes a refresh, you
  ; would put code here to repair the windows graphics. You may not use GOTO
  ; and some other statements in here, anything WITH the # in the above
  ; help on the XLANG language.
  PRN   1,1,MyText$,0,7             ; PRiNt some text to 1:1 pixel of window.
  END
SECTION LOOPED
  ; In this section is stuff to be done when the window is waiting...
  END
SECTION CLOSED
  ; In this section is stuff to be done just before the window closes all the
  ; way. You would close *ALL* of your opened files here also!
  END
SECTION DATA
  ; This section contains all the data variables, strings $ and math %.
  ; This is almost like Pascal where they MUST be defined before usage within
  ; other sections...
  MyText$ "Some text! Does not have to be a variable, but why not?"
  END
