Subj : Re: Finger mod
To   : Finnigann
From : Angus McLeod
Date : Sat Feb 02 2008 09:12 am

 Re: Re: Finger mod
 By: Finnigann to Angus McLeod on Fri Feb 01 2008 18:22:00

> Thanks. I'll comb other .JS files for suitable code examples. to see if
> they paste together and run/work.
>
> I was looking at lightbar.js, how would this be called? I assume, that
> at the least, I'd have to pass the file location to provide the lines of
> text to make up the menu.

Ok, try this:

Create a file called /sbbs/exec/hosts.pick or similar, and in it, put the
following:

 nimbus.synchro.net^The Nimbus BBS
 pbox.servebbs.com^The Penalty Box
 phantomrage.org^PhantomRage Studios
 bnb.synchro.net^Bits-N-Bytes
 www.hdcbbs.net^The Hard Drive Cafe
 vert.synchro.net^Vertrauen
 bbs.foxybanana.com^The Realm of Dreams
 derbycitybbs.com^Derby City BBS

Obviously, you can put in whatever you want here, but follow the same
format.  Note the "^" character separating the hostname from the BBS name.
Also, I am indenting by two spaces -- you don't do that in the actual
file.

Now code up a piece of JS as follows:

 load("lightbar.js");

 // the name of the hosts picklist file you used
 hosts = "/sbbs/exec/hosts.pick";

 console.clear();      // say howdy
 writeln( "Host-Pick Test Program" );

 // create lightbar object and set up a few options
 pick = new Lightbar();
 pick.xpos = 10;       pick.ypos = 3;
 pick.fg = 2;          pick.bg = 0;
 pick.hfg = 14;        pick.hbg = 7;

 // create file object for hosts file and open it for reading
 f = new File( hosts );
 if (!f.open("r")) {
   writeln( "Can't open \"" + hosts + "\"" );
   exit;
 }

 // read each line, split it into parts,
 // and add them to the lightbar object
 while (line = f.readln()) {
   part = line.split( "^" );           // same separator
   pick.add( part[1], part[0] );
 }
 f.close();    // done with file

 v = pick.getval();            // get value from lightbar object

 // display results
 console.clear();
 writeln( "Returned Value = " + v );
 console.pause();

Now save that as /sbbs/exec/hostpick.js or something similar, and try
running it.  It should give you a list of BBSs by *name* and when you make
your selection, it should return the matching *host* for that BBS.

See if you can get that going.

---
Amarok: 17,459 tracks from 1,238 albums by 1,349 artists, but none playing.
� Synchronet � Making sure Jason works OK at The ANJO BBS