|
-
Connection data transfer functions. Nonblocking
sockets are used internally so script should orgonize looped call of
WaitEvent function to wait for events such as new data arrived, user
input, timer event, or broadcaste message from other script. All
functions don't wait for transfer complete and for example recv can
return empty string if no available data arrived on call time.
|
|
|
|
|
Disconnects connections without terminationg script's
executions. Script execution terminates on any other data transfer function
error.
function Recvch: string;
Receives or gets from buffer and returns 1 character.
Terminates script if connection is broken.
function Recv: String;
Receives or gets from buffer all accessible data. Terminates
script if connection is broken.
function Recvln: String;
Receives or gets from buffer string ending by chr(13)+chr(10).
Terminates script if connection is broken.
procedure Send(s: string);
Sends string s to remote side. Terminates script if connection
is broken.
procedure SetEcho(EchoOn:integer);
Enable data echo - every received from remote charachter will
be immediately echoed to remote side.
Returns the line, sets by last call of SendBroadcast
from any script running within this terminal, working in server mode,
this allows the scripts to exchange data between one another.
function GetInputText(var s1,s2:
string): integer;
In s1, s2 returns the text from terminal's text input fields.
Function returns the bit mask in which is installed bit 0 if CRLF checkbox is checked and
bit 1 is LOG checkbox is checked.
procedure Gotoxy(x,y,rlt: integer);
If rlt=0 that installs the cursor in absolute position x,y.
If rlt=1 then x,y is the relative coordinates from current position.
Clears line from cursor to end of line.
Clears screen, sets cursor to (0;0)
function Readln(question: string): string;
Shows dialogue window with text question and text input field. Returns entered
by user text.
Sets broadcast string to s and sends message with code 7 to all other scripts
procedure SetInputText(i:integer; s:
string);
Sets text in specified input field. If i=0 then sets text in 1st filed, if i=1 then sets text in 2nd field.
Sets global background color.
Changes terminal font. By default Lucida Console is used, be carefull with this functions - text align will be corrupted
if selected fond can't display fixed text
Sets virtual screen line length
procedure SetOemCP(i: integer);
If i=1 then OEM copepages used, else - ANSI
procedure SetStatus(s: string);
Sets status text.
procedure TextFont(i: integer);
i
- bitmask font flags. Not all fonts correctly supported all flags.
Áèò
0 - bold
Áèò
1 - italic
Áèò
2 - underlined
Áèò
3 - straked out
Set current text background text.
procedure TextColor(i: integer);
Sets text color.
function WhereX: integer;
Return cursor position X.
function WhereY: integer;
Return cursor position Y.
procedure Write(s: string);
Prints text from the cursor position.
procedure Writeln(s: string);
Prints text from the cursor position. Additionally moves cursor to the beginning of the next line.
Return 2 for terminal script.
procedure SetTimer(i:integer);
Starts/stops timer for this script. Timer sends to script messages with code 8 every specified period of time
interval -time period in milliseconds. If interval=0 then rimer will be disabled.
procedure SyncScript(I: Longint);
If I=1 then scripts enters critical section, if I=0 - leaves it. Only one script can own scritical section.
function WaitEvent(var v1,v2: integer):
integer;
General function for event-handling loop. Wait for event, return its code and 2 additional event parameters.
Event |
Why, what to do |
Parameter v1 |
Parameter v2 |
0 |
Connection disconneted |
- |
- |
1 |
New data arrived. You can use next function to receive all or part of the new data: Recv, Recvln,
Recvch |
- |
- |
4 |
User pressed/depressed key in main window |
If bit 7 set then key is pressed, else depressed |
Virtual key-code |
5 |
User enters character in main widnows/ |
- |
Character code |
6 |
User pressed Enter in one of the text input fields. See GetInputText,
SetInputText |
- |
0 if 1st field
0 if 2nd field
|
7 |
Some script called SendSendBroadcast.
You can get broadcast string by calling of GetBroadcast |
- |
- |
8 |
Timer event.
Ñì SetTimer |
- |
- |
function NV_CNAME: string;
Returns local host name.
Returns remote IP.
function NV_PORT: integer;
Returns socket port number.
Return remote IP address in network byte order.
|