Back


The Linguist basic package

These are the keywords supplied for basic numeric, string and control purposes. Many non-GUI applications can be built using this package alone.

add Arithmetic add, or string append.
after Set up an anonymous forked timer.
alias Set one variable to point to another.
append Append a string.
buffer Declare a string buffer or an array of buffers.
cancel Cancel timer(s).
clear Clear a variable.
close Close a file, module or process.
constant Declare a numeric constant.
copy Copy a file.
create Create a variable.
data Declare constant numeric data.
decode Decode a hashtable from a string.
decrement Decrement a value.
decrypt Decrypt a string.
delete Delete a file.
dispatcher Declare a dispatcher variable.
dispose Dispose of a variable.
divide Arithmetic divide.
echo Output a prompt to the console or to a dialog.
encode Encode a hashtable to a string.
encrypt Encrypt a string.
enum Declare an enumeration of arithmetic constants.
every Set up a repeating timed event.
exit Exit the module.
file Declare a file variable.
fork Set up a concurrent execution thread.
get Get a filename or a value from a hashtable.
go The infamous GOTO.
gosub Call a subroutine.
hashtable Declare a hashtable variable.
if A conditional statement.
import Import variables from another module
increment Increment a variable.
index Set up an array index.
invert Invert (ones complement) a variable.
load Load a variable from a disk file or URL.
module Declare a module variable.
multiply Arithmetic multiply.
negate Negate (twos complement) a variable.
new Continue using a new thread.
on Define an event handler.
open Open a disk file.
play Play a sound.
pop Pop a variable off the stack or skip a subroutine return.
process Declare a process variable.
push Push a value onto the stack.
put Assign a value to a variable.
queue Declare a queue variable.
read Read data from a file.
register Register Linguist.
remove Remove an item from a hashtable.
rename Rename a disk file.
replace Replace part of a string with another string.
reset Reset a hashtable.
return Return from subroutine.
run Run another module or a class file.
save Save a hashtable to a file.
send Send a message to a module.
set Set the value or an attribute of something.
sort Sort the elements of an array.
sound Declare a sound variable.
start Start a timer.
stop Stop a timer, a process or a sound.
string Declare a constant string.
switch Set up a multiway branch.
system Call an operating-system command.
take Arithmetic subtraction.
timer Declare a timer.
toggle Perform a boolean NOT on a variable.
trim Trim whitespace from a string.
variable Declare a 64-bit numeric variable.
vector Declare a vector variable.
wait Wait for a given length of time.
while A simple control loop.
write Write data to a file.

Numeric values
String values
Conditional expressions


Numeric Values

These values can be used in either a numeric or string expression:

true
Returns the value 1.

false
Returns the value 0.

<variable>
Returns the current contents of <variable>.

ascii <string>
Returns the ASCII value of the first character in <string>.

random <value>
Returns a random number between zero and <value>-1 inclusive.

the index of <variable>
Returns the current value of the index for this variable.

the length of <string>
Returns the number of characters in <string>.

the lines in <string>
Returns the number of lines in <string>.

the value of <string>
Returns the value of <string> if it can be converted to an integer. If not it returns zero.

the words in <string>
Returns the number of words in <string>.

half <value>
Returns half the given value.

item <key> of <hashtable>
Returns the requested element in the hashtable by looking up the key.

time {value}
(Deprecated) Converts a string such as "14:20:35" into a timestamp (milliseconds as above) assuming today's date. If a millisecond value is given instead of a string, it returns a formatted time string corresponding to that value.

date {value}
(Deprecated) Converts a string such as "19/07/0008" into a timestamp (milliseconds as above). If a millisecond value is given instead of a string, it returns a formatted date string corresponding to that value.

datime {value}
Returns a number, being the timestamp (milliseconds since January 1, 1970) of the string, which is assumed to be in the format DD MM YYYY HH MM SS.

the millisecond
Returns an integer representing the current time. This is the number of milliseconds since January 1, 1970, 00:00:00 GMT.

the second
Returns an integer representing the current time. This is the number of seconds since January 1, 1970, 00:00:00 GMT.

the year/month/date/hour/minute
Returns a numeric value for the requested item, based on the current time.

the year/month/date/hour/minute of {time}
Returns a numeric value for the requested item, based on the numerical time value given.

the year/month/date/hour/minute at {timezone}
Returns a numeric value for the requested item, based on the timezone string - e.g. Europe/London - given.

the day
Returns the day of the week, where Monday is zero and Sunday is 6.

<value> added to <value>
Returns the first value added to the second.

<value> taken from <value>
Returns the first value taken (subtracted) from the second.

<value> multiplied by <value>
Returns the first value multiplied by the second.

<value> divided by <value>
Returns the first value divided by the second.

<value> modulo <value>
Returns the first value modulo the second, i.e. the remainder after dividing the first by the second.

<value> xor <value>
Returns the first value exclusive-or the second.

the free memory
Returns an estimate of the current amount of free memory.

the total memory
Returns the current total amount of free memory.

Return to top


String Values

To concatenate strings together use cat, as in

prompt Message cat quote cat N cat quote cat return

The following values can be used in a string expression:

"<text>"
Returns the quoted string.

<buffer>
Returns the current contents of the buffer.

<variable>
Returns the current contents of the variable converted to a string.

<queue>
Returns the next value from the named queue. Be sure to test first using if queue is [not] empty.

ascii <value>
Returns a single character having the given ASCII value.

left <value> of <string>
Returns the leftmost <value> characters from <string>.

right <value> of <string>
Returns the rightmost <value> characters from <string>.

line <value> of <string>
Returns the specified line from <string>.

word <value> of <string>
Returns the specified word from <string>.

char[acter] <start> [to <end>/end] of <string>
Returns character(s) from <string>, starting at <start>. If no end is specified only one character is returned, otherwise all characters up to and including <end> are returned. If the word end is given, everything from <start> to the end of <string> is returned.

the first/second/third/.../tenth char[acter]/word/line of <string>
Returns the appropriate element.

quote
Returns a double-quote character.

return
Returns a return character (hex 0x0d).

newline
Returns a newline character (hex 0x0a).

tab
Returns a tab character.

lowercase {string}
The supplied string, converted to lower case.

uppercase {string}
The supplied string, converted to upper case.

next {hashtable}
Returns the next value from the hashtable (see reset);.

the index of <variable>
Returns the current index for this variable, as a string.

the message
Returns the content of the most recent message sent to this script module. See send and on message.

the sender
Returns the name of the sender of the most recent message.

the parent
Returns the name of the parent of this module. If there is none, an empty string is returned..

the system name
Returns the name of the operating system, e.g. "Windows 95".

the time
Returns a formatted value representing the current time.

the directory
Returns a string holding the current path in the local file system.

the file path
Returns a string holding the path to the last file accessed using a file dialog. See open.

the files in <path>
Returns a string holding a list of all the files in the named directory, one per line. Use "." for the current directory.

the network name
Returns a string holding the name of the computer as defined by its own network properties.

encode <string>
Returns a string comprising the string value given but in a form that is safe to use as a value in a CGI request. The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same. The space character ' ' is converted into a plus sign '+'. All other characters are converted into the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the lower 8-bits of the character.

decode <string>
Decodes the encoded string value back to its original form

datime <value> [format <format>]
Returns a string comprising the value expressed as a time and date. If a format string is provided this will be used (format strings follow standard Java conventions documented in SimpleDateFormat); otherwise the default "dd/MM/yyyy HH:mm" will be used.

Return to top


Conditional Expressions

The basic package recognizes the following conditional expressions, which may be used in an if or while command:

<value>
Tests if <value> is non-zero and if so returns true.

<value1> is <value2>
Tests if <value1> is equal to <value2>; if so returns true.

<value1> is not <value2>
Tests if <value1> is not equal to <value2>; if so returns true.

<value1> is greater than <value2>
Tests if <value1> is greater than <value2>; if so returns true.

<value1> is not greater than <value2>
Tests if <value1> is less than or equal to <value2>; if so returns true.

<value1> is less than <value2>
Tests if <value1> is less than <value2>; if so returns true.

<value1> is not less than <value2>
Tests if <value1> is greater than or equal to <value2>; if so returns true.

<value> is negative
Tests if <value> is negative and if so returns true.

<value> is positive
Tests if <value> is positive or zero and if so returns true.

[not] at end of {file}
Tests if we have read to the end of the file.

file {name} exists
Tests if the named file exists; returns true if so.

file {name} does not exist
Tests if the named file exists; returns false if so.

file {name} is open
Tests if the named file is open; returns true if so.

file {name} is not open
Tests if the named file is open; returns false if so.

<string1> contains <string2>
Tests if the second string is contained in the first string.

<string1> starts with <string2>
Tests if the first string starts with the second string.

<string1> ends with <string2>
Tests if the first string ends with the second string.

<hashtable> has more data
Returns true if the named hashtable has received data.

<queue> is [not] empty
Returns true if the named queue is (or is not) empty.

<module> is [not] running
Tests if the module given is running.

Return to top


Back