home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
telecomm
/
stkr3dmo.zoo
/
stkr3dmo
/
demo.bts
< prev
next >
Wrap
Text File
|
1991-11-15
|
12KB
|
380 lines
// STalker 3 script file for disabled demo
include "stalker.bth" // definitions for built-in functions
function show_fkeys() // show function key assignments
string buffer[80];
int i;
i = 0;
repeat
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE); // display controls
printf("fkey%02d = \"%s\"", i + 1,
get_string_param(FKEY_PARAM, i, buffer, sizeof(buffer)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
until (i = i + 1) >= 20;
putchar('\n');
endfunction
function show_logon(
int entry_num
) // display the automatic logon entries
int i;
int print_title;
string prompt[10];
string response[30];
print_title = TRUE;
i = 0;
repeat
get_string_param(DIALER_LOGON_PARAM, entry_num + ((DIALER_LG_PROMPT + i) << 16), prompt, sizeof(prompt));
if get_int_param(DIALER_LOGON_PARAM, entry_num + ((DIALER_LG_HIDDEN + i) << 16)) then
strcpy(response, "«Hidden»"); // it's a hidden string (password)
else
get_string_param(DIALER_LOGON_PARAM, entry_num + ((DIALER_LG_RESPONSE + i) << 16), response, sizeof(response));
endif
if prompt[0] OR response[0] then
if print_title then
puts(" Prompt Response\r\n");
puts(" --------- -----------------------------\r\n");
print_title = FALSE;
endif
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf(" %-11.9s%s", prompt, response);
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
endif
until (i = i + 1) >= 8;
putchar('\n');
endfunction
function show_dialer() // display autodialer entries
int group;
int i;
int count;
string name[20];
string number[20];
string script[10];
i = 0;
count = 0;
repeat
get_string_param(DIALER_NAME_PARAM, i, name, sizeof(name));
get_string_param(DIALER_NUMBER_PARAM, i, number, sizeof(number));
if name[0] OR number[0] then
if (count = count+1) == 1 then // only the first time around
puts("BBS/Service Name Group Phone Number $$/Hr Limit Script\r\n");
puts("------------------- ----- ------------------- ----- ----- --------\r\n");
endif
group = get_int_param(DIALER_GROUP_PARAM, i);
if group < 0 then
group = ' ';
else
group = group + '0';
endif
get_string_param(DIALER_SCRIPT_PARAM, i, script, sizeof(script));
printf("%-23.19s%c %-19.19s %2d.%02d %2d.%02d %s\r\n",
name, group, number,
get_int_param(DIALER_COST_PARAM, i) / 100, get_int_param(DIALER_COST_PARAM, i) % 100,
get_int_param(DIALER_LIMIT_PARAM, i) / 100, get_int_param(DIALER_LIMIT_PARAM, i) % 100,
script
);
show_logon(i);
endif
until (i = i + 1) >= 30;
if count == 0 then // no entries
puts("Oh, it doesn't look like you have any dialer entries set.\r\n");
endif
endfunction
function show_modem() // show the modem configuration settings
string buf[80];
int i;
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf("Modem Init: «%s»", get_string_param(MDM_INIT_PARAM, 0, buf, sizeof(buf)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf(" Prefix: «%s»", get_string_param(MDM_PREFIX_PARAM, 0, buf, sizeof(buf)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf(" Suffix: «%s»", get_string_param(MDM_SUFFIX_PARAM, 0, buf, sizeof(buf)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf(" Hangup: «%s»", get_string_param(MDM_HANGUP_PARAM, 0, buf, sizeof(buf)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
i = 0;
repeat
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf(" Connect%d: «%s»", i + 1, get_string_param(MDM_CONNECT_PARAM, i, buf, sizeof(buf)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
until (i = i + 1) >= 2;
i = 0;
repeat
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, TRUE);
printf(" Fail%d: «%s»", i + 1, get_string_param(MDM_FAILURE_PARAM, i, buf, sizeof(buf)));
set_int_param(MISC_PARAM, SHOW_CONTROL_CHARS, FALSE);
puts("\r\n");
until (i = i + 1) >= 4;
printf("Use DCD: %d Use DTR: %d Character Delay: %d\r\n",
get_int_param(MDM_USE_DCD_PARAM, 0), get_int_param(MDM_USE_DTR_PARAM, 0),
get_int_param(MDM_DELAY_PARAM, 0));
endfunction
function show_path() // display STalker's file paths
string buf[256];
printf("Download Path: %s\r\n", get_string_param(PATH_PARAM, PATH_DOWNLOAD, buf, sizeof(buf)));
printf(" Script Path: %s\r\n", get_string_param(PATH_PARAM, PATH_SCRIPT , buf, sizeof(buf)));
printf(" General Path: %s\r\n", get_string_param(PATH_PARAM, PATH_GENERAL , buf, sizeof(buf)));
printf(" Scrap Path: %s\r\n", get_string_param(PATH_PARAM, PATH_SCRAP , buf, sizeof(buf)));
endfunction
function waitkey() // wait for a key to be pressed
puts( "\r\n\r\nPress any key to continue..." );
getchar();
endfunction
function show_settings() // show all of the settings
puts( "\033ETo start with, here are the function key strings:\r\n\n" );
show_fkeys();
waitkey();
puts( "\033EAnd here are your autodialer settings:\r\n\n" );
show_dialer();
waitkey();
puts( "\033EThis is the modem configuration:\r\n\n" );
show_modem();
waitkey();
puts( "\033EAnd these are the current paths:\r\n\n" );
show_path();
waitkey();
endfunction
// Test all of the possible colour combinations allowed by
// VT52 and VT100/ANSI emulations.
function show_colors()
int orig_emulation;
string s;
orig_emulation = get_emulation(); // save emulation
s = "This text is being written with the colour set to ";
set_emulation(EMUL_VT52); // force to VT-52
puts("\033E\t\t\033b1\033p VT52 Mode \033q\r\n");
printf("\033b0%sWHITE\r\n", s);
printf("\033b1%sBLACK\r\n", s);
printf("\033b2%sRED\r\n", s);
printf("\033b3%sGREEN\r\n", s);
printf("\033b4%sBLUE\r\n", s);
printf("\033b5%sCYAN\r\n", s);
printf("\033b6%sYELLOW\r\n", s);
printf("\033b7%sMAGENTA\r\n", s);
printf("\033b8%sLIGHT WHITE (LIGHT GREY)\r\n", s);
printf("\033b9%sLIGHT BLACK (GREY)\r\n", s);
printf("\033b:%sLIGHT RED\r\n", s);
printf("\033b;%sLIGHT GREEN\r\n", s);
printf("\033b<%sLIGHT BLUE\r\n", s);
printf("\033b=%sLIGHT CYAN\r\n", s);
printf("\033b>%sLIGHT YELLOW\r\n", s);
printf("\033b?%sLIGHT MAGENTA\r\n", s);
puts("\n\t\t\033b1\033p VT100/ANSI Mode \033q\r\n");
set_emulation(EMUL_VT100);
printf("\23337m%sWHITE\r\n", s);
printf("\23330m%sBLACK\r\n", s);
printf("\23331m%sRED\r\n", s);
printf("\23332m%sGREEN\r\n", s);
printf("\23333m%sYELLOW\r\n", s);
printf("\23334m%sBLUE\r\n", s);
printf("\23335m%sMAGENTA\r\n", s);
printf("\23336m%sCYAN\r\n", s);
printf("\23330m"); // Restore colour to BLACK
set_emulation(orig_emulation); // restore emulation
endfunction
// Tests the play_sound() builtin function.
function show_tunes()
string buffer[80];
puts("\033E");
while TRUE do
puts("Sound number to play (0-5, Return to exit) -> ");
if gets(buffer, sizeof(buffer)) <= 0 then
return;
endif
play_sound(atoi(buffer));
endwhile
endfunction
// Copy a file to the STalker terminal window.
function show_file(string file)
string buffer[256];
int fd;
if (fd = file_open(file, 0)) < 0 then
printf("Error %d opening '%s'\r\n", fd, file);
return;
endif
while file_gets(buffer, sizeof(buffer), fd) > 0 do
puts(buffer);
endwhile
file_close(fd);
endfunction
function show_a_file()
string source_file[14];
string source_full[128];
string source_path[128];
source_path[0] = file_get_drive();
source_path[1] = ':';
file_get_dir(0, source_path + 2);
strcat(source_path, "\\*.*");
source_file[0] = 0;
if fsel(source_path, source_file, source_full, "File to Display?") then
if source_file[0] == 0 then
return;
endif
puts("\033E");
show_file(source_full);
endif
waitkey();
endfunction
// Tests the file_dir_first/next() builtin routines by showing a directory
function show_dir()
string buffer[24];
string temp[80];
int chars;
int f_attr;
int f_time;
int f_date;
int f_size;
string f_name; // Pointer into 'buffer' at file name
int subdir;
int success;
puts( "\033EEnter the path (with wildcards) to get the directory for.\r\n\
Example: C:\\*.*\r\n-> " );
chars = gets( temp, sizeof(temp) );
if chars==0 then
return;
endif
puts("Attr Time Date FileSize FileName\r\n");
success = file_dir_first(temp, 0x31, buffer);
while success do
f_attr = buffer[0];
f_time = (buffer[1] << 8) | buffer[2];
f_date = (buffer[3] << 8) | buffer[4];
f_size = (buffer[5] << 24) | (buffer[6] << 16) | (buffer[7] << 8) | buffer[8];
f_name = buffer + 9;
if f_attr BITAND 0x10 then
subdir = '\\';
else
subdir = ' ';
endif
printf(" %02x ", f_attr );
strftime(temp, sizeof(temp), "%H:%M %m/%d", (f_date<<16) | f_time);
printf("%s %8d %s%c\r\n", temp, f_size, f_name, subdir);
success = file_dir_next(buffer);
endwhile
waitkey();
endfunction
// The fun begins here!
function main()
int emulation;
int key;
int time;
int valid;
emulation = get_emulation(); // save emulation
set_emulation(0); // and set to VT100
puts( "\033E\tWelcome to the STalker 3 demonstration!\r\n\n\
This script will show you just some of the capabilities\r\n\
of the BackTALK script language. List the file DEMO.BTS\r\n\
to see what this script looks like.\r\n\n\n" );
time = 0;
repeat
if (time = time+1) > 1 then
puts( "\033E" ); // clear screen after first time through
endif
puts("Please choose an option from the menu below:\r\n\n\
\t\033p1\033q Show STalker's settings\r\n\
\t\033p2\033q Show VT-100/PC-ANSI colors\r\n\
\t\033p3\033q Play the built-in tunes\r\n\
\t\033p4\033q Show a text file\r\n\
\t\033p5\033q Get disk directory\r\n\
\t\033pQ\033q Quit this demo\r\n\r\n" );
valid = FALSE;
repeat
key = getchar();
if key == '1' then
show_settings();
valid = TRUE;
else
if key == '2' then
show_colors();
valid = TRUE;
else
if key == '3' then
show_tunes();
valid = TRUE;
else
if key == '4' then
show_a_file();
valid = TRUE;
else
if key == '5' then
show_dir();
valid = TRUE;
else
if (key&0x5F) == 'Q' then
puts( "\r\n\r\nThank you for running the demo!\r\n\r\n" );
set_emulation(emulation); // restore old emulation
return;
endif
endif
endif
endif
endif
endif
until valid;
until FALSE;
endfunction