home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR10
/
TLXTW110.ZIP
/
TWLOGOFF.SLT
< prev
next >
Wrap
Text File
|
1993-08-22
|
16KB
|
396 lines
// Twlogoff.slt
//
// Congratulations! You have been recruited into the wonderful world of
// Telix SALT programming. This files requires editing to work
// properly.
//
// This script requires editing for each particular BBS.
// You only need to edit three small sections:
// 1. do_bbs() function
// 2. Offline_maintenance() function
// 3. comment out line 289 (approximatelly)
//
// Each section is commented describing what it does.
//
// What this script does:
//
// This script will be called from DNINTG (Ctrl-D, Download Interrogation
// Reports) or CIM_WARP (Ctrl-L, Level Diagram Generator) if you choose to do
// so.
//
// It exits Tradewars from the "Command [TL=" prompt, (cloaks or remains on a
// planet) then logs off the BBS and runs CRAI and anything else you want to
// do. (Can be run offline if you just want to do the offline stuff) You can
// run Ctrl-D and gather all the reports and after its finished it will call
// this script that will log you off the BBS and do any maintenance you want
// to do, all automatically.
//
// (Stuff I do, you may/will have to change some of this,
// all this is done in the Offline_maintenance() function)
//
// Moves the capture file from d:\cap to the game's directory
// Stuffs the keyboard and runs Twassist
// Calls Twastlog.slc
// Calls Crai,
// Runs Twlog
//
// See also line 289 (approximatelly)
///////////////////////////////////////////////////////////////////////////////
int a, b, dr, f, fd, fs, h, i, s, x, y,
stat, t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,
old_chk_key, tm, chrcolor, statline, statline_color,
key = 0;
str
f1[64], buf[255], drs[3], tmpbuf[30],
bbsname[8], shortname[3],
planet_remain[64],
planet_no[5],
gamedir[64];
do_bbs() // Edit this
{
if ( !carrier() ) return;
substr( _entry_name, 0, 4, bbsname); strupper( bbsname );
///////////////////////////////////////////////////////////////////////////////
// Enter the first four characters from the BBS in all CAPITOL LETTERS below.
// followed by the prompts that will get you off the BBS.
//
// This is what must be done after you see the "Returning to BBS"
// message to get you off the BBS.
//
// first 4 chars of BBS name from the dialing directory. (all CAPS)
// │
// └───┬──┐ whatever gets you off (the BBS).
// │ │ ┌──────────────────────────────────────────┐
// │ │ │ │
///////////////////////////////////////////////////////////////////////////////
if(bbsname=="19TH"){ waitfor("Menu" ,30);delay_scr(10);cputs("GY"); delay_scr(50); }
else if(bbsname=="CAST"){ waitfor("Menu" ,30);delay_scr(10);cputs("GY"); delay_scr(50); }
else if(bbsname=="CHES"){ waitfor("ce ]?" ,30);delay_scr(10);cputs("G^MY^M"); delay_scr(50); }
else if(bbsname=="COMP"){ waitfor("mand?" ,30);delay_scr(10);cputs("G^M"); delay_scr(50); }
else if(bbsname=="HITC"){ waitfor("wars" ,30);delay_scr(10);cputs("!YN"); delay_scr(50); }
else if(bbsname=="JUNG"){ waitfor("Main" ,30);delay_scr(10);cputs("-"); delay_scr(50); }
else if(bbsname=="MARI"){ waitfor("Menu" ,60);delay_scr(10);cputs("GY"); delay_scr(50); }
else if(bbsname=="QUAD"){ waitfor("it be" ,60);delay_scr(10);cputs("MQ"); delay_scr(50); }
else if(bbsname=="ROBI"){ waitfor("Menu" ,60);delay_scr(10);cputs("Q");
waitfor("Menu" ,60);delay_scr(10);cputs("GY"); delay_scr(50); }
else if(bbsname=="TERM"){ waitfor("Menu" ,30);delay_scr(10);cputs("Q-"); delay_scr(50); }
else if(bbsname=="TWIL"){ waitfor("Queen" ,60);delay_scr(10);cputs("/O"); delay_scr(50); }
else if(bbsname=="TEST") return -2;
else {
soft_wind("BBSname not defined in TWLogoff.slt", 40 ); return -3;
}
}// end of do_bbs()
///////////////////////////////////////////////////////////////////////////////
// This section does all the offline maintenance.
// This is all the stuff *I* do. You can delete anything you want or add
// more here.
// (note: keyin is a keyboard stuffer. Stuffing the keyboard seems to
// be particular to each machine's setup/configuration. so you may need
// to stuff more or less, or delete it. There are many different keyboard
// stuffers available on many BBS'es.
Offline_maintenance() // Edit this
{ //
if ( carrier() ) hangup(); capture("*close*"); //
//
newdir( gamedir ); //
if(filefind("d:\cap",0) > 0) //<─┐
{ // │ copy the capture file
fcopy( "d:\cap", "cap" ); // │ to the game's directory
fdelete("d:\cap"); // │
} //<─┘
//
call("crai"); // run crai
newdir( gamedir ); //
//
run("keyin", "/cr-mecap/cr-" ,0); //<─┐
run("keyin", " /cr-/cr-/cr-/cr-/cr-/cr-" ,0); // │ stuff the keyboard
run("keyin", " q/cr-/cr-x"); // │ and run Twassist.
run("twassist"," twassist", 0); //<─┘
//
call("Twastlog"); //<── reads twassist.log
newdir( gamedir ); // looking for blocked
// ports. (see TWASTLOG.SLT)
//
buf = " cap "; //<── runs Twlog - Stephen
strcat( buf, shortname ); // Whitis' program,
run( "twlog ", buf); // TWLOG080.*
//
newdir( gamedir ); //
buf = " cap"; //
strcat( buf, shortname ); //
run( "c:\qc25\tw\read", buf, 0 ); //
//
prints(""); pstra("Calling hangup...", 3 ); //<── call hangup.slc
call("hangup"); //
//
newdir( _telix_dir ); //
//
}// end of Offline_maintenance() //
//////////////////////////////////////////////////////////////////////////////
// Soft Wind
soft_wind(str message, int duration)
{
int old_chk_key; old_chk_key = _scr_chk_key; _scr_chk_key = 0;
int l, h, x, y, key = 0, ts;
cursor_onoff(0);
x=getx(); y=gety();
l = strlen(message)/2;
h = vsavearea(37-l, 10, 43+l, 14);
box(37-l, 10, 43+l, 14, 3, 0, 5 );
pstraxy(message, 40-l , 12, 11 );
ts = timer_start(duration);
while( !key && !time_up(ts)) key=inkey();
vrstrarea(h);
cursor_onoff(1);
gotoxy(x,y);
timer_free(ts);
_scr_chk_key = old_chk_key;
if (key > 0) return key;
return key;
}
//////////////////////////////////////////////////////////////////////////////
// Soft_wind() with countdown timer tenth/sec.
soft_wind_timer(str message, int duration)
{
_scr_chk_key=old_chk_key; _scr_chk_key = 0; cursor_onoff(0);
int l, x, y, h, key, tstart, tleft;
str tlefts[5];
l = strlen(message)/2;
x=getx(); y=gety();
h = vsavearea(37-l, 10, 43+l, 14);
box(37-l, 10, 43+l, 14, 3, 0, 31);
pstraxy(message, 40-l , 12, 30 );
tstart = timer_start(duration);
while( !key && !time_up(tstart) && carrier() )
{
key=inkey();
tleft = ( duration - timer_total(tstart) ) ;
itos(tleft, tlefts);
strcat(tlefts, " ");
inschrs(" ", tlefts, 0, 1);
inschrs(".", tlefts, strlen(tlefts) - 2, 1);
l = 40 - strlen(tlefts) / 2;
pstraxy(tlefts, l, 13, 30);
}
vrstrarea(h);
gotoxy(x,y);
cursor_onoff(1);
timer_free(tstart);
_scr_chk_key = old_chk_key;
if ( key > 0 ) return key;
else return(-1);
}
//////////////////////////////////////////////////////////////////////////////
fill_spaces() // Filters out characters illegal in DOS filenames.
{
int i;
str chr[1];
int count = 0;
while (count < 6)
{ if (count == 0) chr = ".";
else if (count == 1) chr = "+";
else if (count == 2) chr = " ";
else if (count == 3) chr = "?";
else if (count == 4) chr = "*";
else if (count == 5) chr = "/";
i=0; while (1) { i = strpos(bbsname, chr, i); if (i == -1) break;
setchr(bbsname, i ,'_'); i = i + 1; } ++count; } return; }
///////////////////////////////////////////////////////////////////////////////
// Check Row and Color of Status Line
chk_stat ( int statchk )
{ gotoxy(67, statchk);
if ((vgetchr() & 255) == 79 ){ Statline = statchk; statline_color = vgetchr()/256; }
else return(-1);
}
///////////////////////////////////////////////////////////////////////////////
// Check Prompt and ANSI
chk_prompt(str prompt)
{ _scr_chk_key = old_chk_key; _scr_chk_key = 0; cursor_onoff(0);
int l, h, key, ts; str promptbuf[20];
l = strlen( prompt ); x=getx(); y=gety(); vgetchrs(0, y, promptbuf, 0, l);
gotoxy(2,y); chrcolor = vgetchr() / 256; gotoxy(x,y); // get color attr
if (strcmpi(prompt, promptbuf) != 0) return(-1);
// if (chrcolor != 7 ) pstra("ANSI is ON", 31); // Clear the Status Line
// x=getx(); y=gety();pstraxy(" │", 0, statline, statline_color);gotoxy(x,y);
cursor_onoff(1); _scr_chk_key = old_chk_key; return;
}
///////////////////////////////////////////////////////////////////////////////
str Buffer[16384];
fcopy(str Infname, str Outfname )
{
cursor_onoff(0);
int a, b, fs, fp, h, i, g, gpos, l,
text_color = 15,
box_color = 1,
hi_color = 30,
lo_color = 7,
Infile, Outfile, BytesRead;
str fsbuf[10], fps[12];
a = 20; b = 8; gpos = a+2;
h = vsavearea( a-18, b-1,a+58,b+7 ); box( a-18 ,b-1,a+58,b+7, 2, 0,box_color);
pstraxy( "╡", a+44, b-1,box_color);pstra(" Fcopy ",text_color);pstra("╞",box_color);
pstraxy("From : ", a+2,b+1,text_color); pstra( Infname , lo_color);
pstraxy("To : ", a+2,b+2,text_color); pstra( Outfname, lo_color);
pstraxy("Bytes: ", a+2,b+3,text_color);
pstraxy("░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░", a+2,b+6,31);
fs = filesize( Infname ); itos( fs, fsbuf );
if ( (Infile=fopen(Infname, "r")) != -1 )
{
if ( (Outfile=fopen(Outfname, "w")) != -1 )
{
while ( !feof(Infile) )
{
Bytesread = fread(Buffer, 16384, Infile);
/////////////////////// Bytes, Percentage, Bar Graph /////////////////////
fp = ftell(Infname);
if (fp == 0) fp = 1;
itos(fp, fps); pstraxy(fps, a+10, b+3,lo_color); // bytes of
pstra(" of ",lo_color); pstra(fsbuf,lo_color); pstra(" bytes",lo_color); // bytes
g = fp * 35 / fs; // graph
// fp = fp * 100 / fs; itos(fp, fps); // %
for(i = gpos; i <= gpos + g; ++i) pstraxy("▓", i, b+6, 14);// graph
// pstraxy(fps, a+18, b+4, 30); pstra(" %", 30); // %
/////////////////////////////////////////////////////////////////////////////
fwrite(Buffer, BytesRead, Outfile);
}
fclose(Outfile);
}
fclose(Infile);
}
cursor_onoff(1); vrstrarea( h );
}
///////////////////////////////////////////////////////////////////////////////
Remain_on_Planet()
{
track_free(0);
t1 = track("abort", 0);
t2 = track("Planet command", 0);
t3 = track("turning to", 0);
t4 = track("not in this", 0);
cputs("L");
while( carrier() )
{ terminal(); stat=track_hit(0); if(!stat) continue;
else if (stat == t1) { track_free(t1); delay_scr(dr); cputs(planet_no);
if ( stoi( planet_no) < 200 ) cputc(13);
}
else if (stat == t2) { track_free(t2); cputs("C" );
if ( chrcolor != 7 ) cputs(" ");
cputs("RYY");
if ( chrcolor != 7 ) cputs(" ");
}
else if (stat == t3) break;
else if (stat == t4) { track_free(0); return -1; }
}
track_free(0); return;
}
///////////////////////////////////////////////////////////////////////////////
main()
{
update_term();
///////////////////////////////////////////////////////////////////////////////
//
// Delete this line after you have edited do_bbs() and Offline_maintenance()
// above. This is the only line you have to edit in this section.
//
// --------------------------------
// registration
soft_wind("You must edit TWLOGOFF.SLT first", 50 ); return -1;
// registration
// --------------------------------
//
//
///////////////////////////////////////////////////////////////////////////////
int old_chk_key; old_chk_key=_scr_chk_key; _scr_chk_key=0;
if (carrier()) ustamp("++ TLXTW : TWLogoff ONline - ", 1, 0);
else ustamp("++ TLXTW : TWLogoff OFFline - ", 1, 0);
ustamp( _entry_name, 0, 1 );
if (getenv("f1", f1) < 1) { soft_wind("F1 environment variable not found",25); _scr_chk_key=1; return(-1); }
i = strlen(f1); if (subchr(f1, i - 1) != '\') copystr("\", f1, i, 1);
if ( getenv("Temp", planet_remain) < 1 )
{ soft_wind("TEMP environment variable not found",25); _scr_chk_key=1; return(-1); }
if( subchr( planet_remain, strlen(planet_remain) -1 ) != '\' )
strcat( planet_remain, "\" );
strcat( planet_remain, "planet.tmp" );
if (getenv("dr", drs) < 1) { soft_wind("DR environment variable not found", 25); _scr_chk_key=1; return(-1); }
dr = stoi(drs);
if ( _entry_name == "" )
if (call("bbsname") == -1) { _scr_chk_key = 1; return(-1); }
bbsname = _entry_name; fill_spaces();
strcat(f1, bbsname);
if ( !filefind( f1, 16 ) )
if (call("bbsname") == -1) { _scr_chk_key = 1; return(-1); }
strcat(f1, "\");
gamedir = f1;
x=getx(); y=gety();if (chk_stat(0) == -1)chk_stat(24); gotoxy(x,y);
x=getx();y=gety();pstraxy("Calling Twlogoff │", 0,statline,statline_color); pstraxy(_entry_name, 17, statline, statline_color);gotoxy(x,y);
substr ( bbsname, 0, 3, shortname );
delay_scr(dr);
if(carrier())
{ if (chk_prompt("Command [TL") < 0 )
{ while( cinp_cnt() ) terminal();
delay_scr(20);
}
if (chk_prompt("Command [TL") < 0 ){soft_wind("Get to the ^0034Command [TL=^0034 prompt first.", 25);return(-1);}
}
if ( filefind( planet_remain, 0 ) > 0 )
{
if ((f = fopen( planet_remain, "r" ) ) != 0 )
{ a=0;
while( !feof(f) )
{
fgets( buf, 64, f ); ++a;
if ( a == 1 )
{ strupper( buf );
substr( _entry_name, 0, strlen(_entry_name), tmpbuf );
strupper( tmpbuf );
if (( strcmpi( buf, tmpbuf )) != 0 )
{
prints("");
pstra("Entryname doesn't match Planet.tmp file", 7); prints("");
pstra("_Entry_name= ", 7); pstra( tmpbuf, 7 ); prints("");
pstra("Planet.tmp = ", 7); pstra( buf, 7 ); prints("");
fclose(f);
return -1;
}
}
planet_no = buf;
}
} fclose( f ); fdelete( planet_remain );
}
if ( planet_no )
{
f = Remain_on_Planet();
if ( f < 0 ) { _scr_chk_key=old_chk_key; return -1; }
}
else
{
t1 = track("med? (Y/N)?", 0);
t2 = track("king Device?", 0);
t3 = track("turning to", 0);
_scr_chk_key = 1;
cputs("Q");
while(carrier() && inkey() != 27 )
{ terminal(); stat=track_hit(0); if(!stat) continue;
else if (stat == t1) { track_free(t1); delay_scr(dr); cputs("Y"); }
else if (stat == t2) { track_free(t2); delay_scr(dr); cputs("Y"); }
else if (stat == t3) { track_free(0); _scr_chk_key=old_chk_key; capture("*close*");
break; }
}
}
i = do_bbs(); if ( i == -2 ) return -2;
else if ( i == -3 ) return -3;
if (soft_wind_timer("Waiting to hang up....",50) < 0)
Offline_maintenance();
timer_free(tm); _scr_chk_key=old_chk_key; return;
}