Phantom supports
several different variable types. These include variables that hold
simple data (such as integers, booleans, and character strings) as well
as more complex variables that hold different types of data and associated
functions specialized to the variable (bitmap,
window, etc.). The latter type is called
a class, with an instance of the class called an object .
disp("Hello
World");
string s = substring("hello", 2, 3); |
All variables must be declared prior to use. A variable is declaration
consists of two parts: the variable type followed by the variable name.
The type tells the interpreter what kind of data is being created. The
name is what that variable referred to as in other sections of the code.
An optional third part is the assignment of the variable. This gives
the data in the variable an initial value. Not all variable types can
be assigned an initial value.
To see what variables are available and what their values are, see the
who function. To determine if a variable
has been declared yet, see the exists
function.
Members
Complex variables can contain one or more sub or 'member' variables
and have one or more member functions. Member variables and functions
are considered a part of the complex variable. To access a member function
or variable, use the variable name, followed by a period (.) followed
by the name of the member variable or function. Parameters to member
functions are provided like ordinary member functions. Accessing a member
variable can be used to either retrieve or set its value. To see what
member variables and functions a variable type contains, use the 'members'
function.
Example
Code |
System("PhantomTarget.exe");
window w;
# Access a member
variable
w.Class = "Afx:*";
w.Tag = "Phantom Target";
disp(w.Class);
# Access member
functions
w.MoveWin(10, 10);
w.Close(); |
The following
table shows general variable types available in Phantom as part of the
'Standard' package.
Type |
Description |
Supported
Operators |
int |
Holds signed integer decimal
values. Range:
–2147483648 - 2147483647
|
+,-,*,/,^,=,==,
>=,<=,>,<,!=,!, &,|,&&,||,% |
real |
Holds signed floating
point values (double precision). Range:
+/–1.7E308, 15 digits of precision
|
+,-,*,/,^,=,==,
>=,<=,>,<,!=,! |
bool |
Holds a boolean value.
Range: true or false
|
=,==,!=,!,&&,|| |
string |
Holds a single or multi-character
string. |
+,=,==,>=,<=,
>,<,!= |
file |
Holds
a handle of an open file so read and write operations can be performed.
|
=,&&,||,! |
void |
A data type
that holds nothing. Used with functions to indicate no return type
is expected. |
N/A |
Additionally, the following variable types are available as part of
the Phantom package.
Type |
Description |
Supported
Operators |
|
Contains information about
a window, including class and tag information. Also supplies member
functions for working with windows. |
=,!,&&,|| |
|
Holds bits of data that
represent an image. Each pixel is represented by 3 bytes. One byte
for the red color, one byte for the green color, and one byte for
the blue color (RGB). |
=,==,>=,<=,>,
<,!= |
|
Contains information about
an error or warning that was produced by Phantom. Usually used in
a try-catch statement. Can also be used to produce user-defined
exceptions. |
= |
|
This is a class used to
track a set of settings or options. It is similar to a hash table
in that it contains a set of keys and corresponding values. |
N/A |
|
Holds
information about a registry key. Can be used to set and retrieve
registry keys. |
= |
For more information on the
operators, see the Operators section.
|