BBS: Inland Empire Archive Date: 05-30-92 (12:31) Number: 136 From: JEFF FREEMAN Refer#: NONE To: ALL Recvd: NO Subj: Jdibas 3/5 Conf: (2) Quik_Bas
This message was from JEFF FREEMAN to ALL, originally in conference (V) V-TREK and was forwarded to you by JEFF FREEMAN. ------------------------- >>> Continued from previous message FUNCTION MORE$ JDI.LineCount = 0 FC = JDI.FC Bc = JDI.Bc JColor (JDI.MoreFc), (JDI.MoreBc) JPrint RTRIM$(JDI.MoreMsg), False DO K$ = UCASE$(JInKey$) LOOP UNTIL INSTR("YNC" + CHR$(13), K$) AND K$ <> Null$ IF K$ = CHR$(13) THEN K$ = "Y" JColor FC, Bc JDI.FC = FC BackSpace LEN(RTRIM$(JDI.MoreMsg)) MORE$ = UCASE$(K$) END FUNCTION FUNCTION NCase$ (Name$) Name$ = RTRIM$(LCASE$(Name$)) IF Name$ = Null$ THEN EXIT FUNCTION MID$(Name$, 1, 1) = UCASE$(LEFT$(Name$, 1)) FOR X = 1 TO LEN(Name$) IF MID$(Name$, X, 1) = CHR$(32) THEN MID$(Name$, X + 1, 1) = UCASE$(MID$ NEXT X NCase$ = Name$ END FUNCTION SUB OpenCom (ComPort, Baud&) JDI.LFNum = FREEFILE OPEN "CON" FOR OUTPUT AS #JDI.LFNum IF ComPort = 0 THEN JDI.IsLocal = True ELSE JDI.IsLocal = False ON UEVENT GOSUB ErrorInDoor 'Carrier Loss trap END IF IF ComPort = 0 THEN HS = 0 ELSE HS = 1 OpenComm ComPort, 0, 8, 0, Baud&, HS END SUB SUB OpenDorinfo (DF$) IF DF$ = Null$ THEN DF$ = "DORINFO1.DEF" IF NOT JEXIST(DF$) THEN DF$ = "..\DORINFO1.DEF" END IF JOpen DF$, "I", DFNum, 0 IF DFNum = 0 THEN CloseDoor LINE INPUT #DFNum, JDI.BBSName 'name of the BBS LINE INPUT #DFNum, Dummy1$ 'Sysop's first name LINE INPUT #DFNum, Dummy2$ 'Sysop's last name JDI.SysopName = Dummy1$ + CHR$(32) + Dummy2$ LINE INPUT #DFNum, Dummy1$ 'COMx ComPort = VAL(RIGHT$(Dummy1$, 1)) LINE INPUT #DFNum, Dummy1$ 'BAUD and parity (8N1 is assumed) Baud& = VAL(Dummy1$) LINE INPUT #DFNum, Dummy1$ 'network type LINE INPUT #DFNum, Dummy1$ 'Player's first name LINE INPUT #DFNum, Dummy2$ 'Player's last name JDI.PlrName = Dummy1$ + CHR$(32) + Dummy2$ IF JDI.PlrName = JDI.SysopName THEN JDI.Sysop = True LINE INPUT #DFNum, Dummy1$ 'player's city, state zip LINE INPUT #DFNum, Dummy1$ 'graphics mode JDI.Ansi = VAL(Dummy1$) IF JDI.Ansi > 0 THEN JDI.Ansi = True LINE INPUT #DFNum, Dummy1$ 'security level JDI.SecLevel = VAL(Dummy$) CLOSE DFNum OpenCom ComPort, Baud& END SUB SUB ViewFile (F$, MorePrompts) IF JDI.Ansi AND JEXIST(F$ + ".ANS") THEN F$ = F$ + ".ANS": HR = False 'no CRLF for Ansi files ELSE F$ = F$ + ".ASC": HR = True 'CRLF's for Ascii files END IF JOpen F$, "I", VFNum, 0 IF VFNum = 0 THEN EXIT SUB TP = JDI.Pauses: JDI.Pauses = False 'turn these off temp. LNum = JDI.LineCount + 1 WHILE (NOT EOF(VFNum)) IF JInKey$ <> Null$ THEN LNum = 23 LINE INPUT #VFNum, L$: JPrint L$, HR IF MorePrompts THEN LNum = LNum + 1 IF LNum > 22 THEN SELECT CASE MORE$ CASE IS = "Y" 'continue LNum = 0 CASE IS = "N" 'don't continue CLOSE #VFNum JDI.Pauses = TP 'restore Pauses JDI.LineCount = 0 EXIT SUB 'quit CASE ELSE MorePrompts = False 'turn em off END SELECT END IF END IF WEND CLOSE #VFNum JDI.Pauses = TP 'restore pauses JDI.LineCount = LNum END SUB Following are the docs to JDI.BAS, QuickBASIC 4.5 door writing routines. Jeff Freeman 9417 Mixon #235 Dallas, TX 75220 DEFINT A-Z It is important to note that JDI.BAS is written with DEFINT A-Z. This means the default data type is not the SINGLE precision numeric variable, but the INTEGER variable. All of the subs and functions expect to be passed INTEGERs! If the need arrises to pass a numeric variable of a different type to a sub or function, then pass the variable by value. (Place the variable in parin's). FUNCTION JEXIST (F$) This function returns TRUE if the file (F$) exists. FUNCTION JInKey$ () This function works exactly like INKEY$. If no key is pressed, JInKey$ returns a null string, otherwise it returns the key pressed. If you want to wait for the user to press a key, then use like so: DO : A$ = JINKEY$ : LOOP UNTIL A$ <> NULL$ FUNCTION JRND (Lo, Hi) This function returns a random number (INTEGER!) between Lo and Hi. A standard six-sided dice roll would be: Dice = JRND(1,6)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET