Page 221
Quick Nav Bar
<<   Previous Contents
Op Index
Parent User Notes
Next   >>

BASIC-like Script Commands

In the command summaries that follow, when a parameter is in CAPITAL LETTERS, this means that the parameter is a flag that is either zero or one, or possibly a range such as zero to four. If the latter is the case, the range is specified in square brackets.

If the parameter is in double quotes, then the parameter is a string.

All other parameters are numeric. If WinImages F/x needs a floating point number, then that's how the number will be treated. If WinImages F/x needs an integer, any fractional part of the number will be discarded. So 1.5 is the same as 1 for an integer value.


Returns the absolute value of the parameter (a positive number.)


Returns the ASCII code for the character in the string.


Returns the arc-tangent of the parameter in radians.


Returns the nearest integer less than a.

CHAINP filename

Brings in new program lines. The old program data is discarded. Variables that have been marked by the use of the COMMON statement are retained, other variables are discarded.


Returns the ASCII character represented by the numeric parameter.


If x < a, returns a. If x > b, returns b. Otherwise returns x.


Resets all numeric variables to zero and text variables to empty.


Closes the open file by its channel number.

COMMON variable[,variable...]

This identifies a variable as one that gets passed along to a program that you bring in using the CHAINP command.


Returns the cosine of the paramater in radians.

DATA constant[,constant...]

Stores constant values for use with the READ function.


Returns the current date as a string.


Returns the day (1-31) as a string.

DEF UFfunction-name([arg[,arg...]])

Defines a function that you construct. The function name must begin with the capital letters UF (for User Function). The variables named in the left side of the statement control what is passed to the function.

The following simple example implements a negative function using inverse luma:

 10 REM shows how to use DEF
 20 DEF UFNUG(uuu,vvv) = 255-GETLUMA(uuu,vvv)
 40 X1=GETX1(0): Y1=GETY1(0): X2=GETX2(0): Y2=GETY2(0)
 50 FOR Y=Y1 TO Y2
 70 FOR X=X1 TO X2
 80     a = PUTLUMA(X,Y,UFNUG(X,Y))
 90   NEXT X
100 NEXT Y


Returns the degree value equivalent to the specified number in radians.

DIM variable(n[,n...])


10 DIM a(10,20)
20 DIM B$(100,3)


This command terminates the script immediately.


Returns -1 if the device referenced is at the end-of-file, otherwise returns zero.

ERASE variable[,variable...]

Erases variables.


Returns exponential of parameter.

FIELD #n, o AS s$ [, p AS t$...]

This allocates space in a random file buffer for device indicated by #n, allocating o bytes and assigning the bytes at this position to the variable s$, etc.

FOR n=x TO y [STEP z]


10 FOR I=0 to 10 STEP 2
20 print "The number is ";I


Returns the nearest integer greater than a.

GET #n [,record number]

GET reads the next record from a random-access file or device into the buffer associated with that file. If record number is specified, GET reads the specified record.

GOSUB line

This jumps to the specified line and begins execution. However, when it jumps, it remembers where it was when it jumped; when, at the new location, it encounters a RETURN statement, the script will resume execution at the statement or line immediately following the GOSUB statement.

GOTO line

This jumps to the specified line and begins execution there.


Returns a string which is the base-16 equivalent of the parameter n.


Returns 'a', or 'b' if a > b.


Returns the current hour as a string 0-23.

IF expression THEN statement [ELSE statement]


10 A=5
20 IF A=5 THEN PRINT "it was 5" ELSE PRINT "it was something else"

INSTR([start,] string, pattern)

Used to search for the pattern in the string. If found, will return the character position in the string where it exists; otherwise, it will return 0.


Discards the fractional part of the number, if any, and returns the integer part.

KILL "filename"

Deletes the specified file.


Returns the leftmost n characters of the string.


Returns the length of the string.

LET variable=expression (OPTIONAL)

Optional assignment statement. These do the same thing:

10 LET A=5
20 A=5


LOC returns the next record that GET or PUT statements will use.


Returns the length of the file specified by #n (see OPEN)


Returns natural log of parameter.


Returns 'a', or 'b' if a < b.

LSET x$ = expression

Transfers data from expression to the left hand side of a string variable or random access buffer field.


Returns the larger of 'a' or 'b'.

MERGEP filename

Brings in new program lines from a file. The current program is retained, and varables are not reset. To reset variables and discard the current program, use CHAIN instead.


Returns a substring of len length (if provided) starting at start.


Returns the lesser of 'a' or 'b'.


Returns a string of minutes 0-59.


Returns a string for month, 1-12

NAME oldfile AS newfile

Renames the specified file.


Used with FOR

ON variable GOSUB

Allows you to associate a series of subroutines with different values of a variable. Example:

10 A=2
20 ON A GOSUB 100,200,300
30 PRINT "We're back..."
40 END
100 PRINT "sub 1":RETURN
200 PRINT "sub 2":RETURN
300 PRINT "sub 3":RETURN

ON variable GOTO

Allows you to associate a series of jump-out targets with different values of a variable. Example:

10 A=2
20 ON A GOTO 100,200,300
30 PRINT "Whoops - A was not matched!"
40 END
100 PRINT "target 1":END
200 PRINT "target 2":END
300 PRINT "target 3":END

OPEN "O"|"I"|"R", #n, filename, [,recordlength] filename FOR INPUT|OUTPUT|APPEND AS #n [,LEN=recordlength]

You can actually use OPEN two ways:

  1. OPEN "O"|"I"|"R", #n, filename [,recordlength]
  2. OPEN filename FOR INPUT|OUTPUT|APPEND AS #n [,LEN=recordlength]

The first form, with the O/I/R options, allows you to select sequential or random file access. The R option is the random access option, while I and O are sequential.

The second form allows only sequential file access.

See the PRINT statement for an example of the use of the second form.


Controls the referencing of arrays. With OPTION BASE 1 in effect (the default), this statement:

10 DIM A(10)

…will result in array elements from A(1) through A(10).

With OPTION BASE 0 in effect, this statement:

10 DIM A(10)

…will result in array elements from A(0) through A(9).


Returns a number represeting the character position on the output (PRINT) line.

PRINT [#n]|[USING format] expressions

PRINT is the means to write information to dialogs in WinImages F/x, and also to files. Used by itself as PRINT expression, output is sent to WinImages F/x. Used with a device number and an open file, you can write almost anything to the file.

PRINT expressions are text strings or variables separated either by commas, which act as TABs, or by semicolons, which act to juxtapose one portion of an expression next to the next portion. Examples:

10 PRINT "This is a test."
20 A=5
30 PRINT "The value of A is ";A
40 B=7
60 OPEN "c:\scripttest.txt" FOR OUTPUT AS #1
70 PRINT #1,"Data for the file"
80 PRINT #1,"A+B=";A+B
90 CLOSE #1

PUT #n[,recordnumber]

PUT outputs the next available record or the record specified by recordnumber to the specified channel.


Returns the radian value equivalent to the specified number in degrees.


Seeds the script language random number generator.

READ variable[,variable]

Reads information contained in DATA statements.

REM ignored content


Resets the READ statement so that it points back to the beginning of the information contained in the DATA statements.


This statement is only used in subroutines. When you call a subroutine with GOSUB, this statement causes execution to result at the line or statement following the GOSUB call.


Returns the rightmost n characters of string.


Returns a random number ranging from zero to 1.

RSET x$ = expression

Places the data specified by expression into the right side of a string variable or random access buffer field.


Returns a string representing seconds in the range 0-59.


Returns either -1, 0 or 1, depending on the sign of the argument.


Argument n is in radians.


If x < a, returns 0. If x > b, returns 1. Otherwise, returns a smoothed value to make the step between 0 and 1 smooth.


Returns a string with n spaces in it.


Square root function.


If x < a, returns 0. Otherwise returns 1.


Returns a string of the number.


Removes all leading and trailing spaces and tabs from a string, but does not remove any that are "interior" elements, that is, that might be separating words or numbers interior to the string.

SWAP variable,variable

Swaps two variables of identical types.


Sends spaces until the column indicated by n is reached. Intended to be used with PRINT.


Argument is in radians.


Returns the current time as a text string.


Returns the value (a number) of a string that contains a text representation of a number.


Ends a WHILE loop, see WHILE.

WHILE expression

Will loop as long as the expression evaluates as true (-1).

WIDTH #n,n

Sets the number of columns assumed to the be the full width of the specified output channel.

WRITE #n,expression[,expression]

Somewhat like print; outputs variables in a formatted manner.


Returns a string containing the year.

Quick Nav Bar
<<   Previous Contents
Op Index
Parent User Notes
Next   >>
Page 221

WinImages F/x, WinImages Morph and all associated documentation
Copyright © 1992-2007 Black Belt Systems ALL RIGHTS RESERVED Under the Pan-American Conventions

WinImages F/x Manual Version 7, Revision 5, Level B

HTML Documentation Management System © 1992-2007 Black Belt Systems