Hi again, On Thu, Jul 21, 2011 at 2:49 PM, Rugxulo <rugx...@gmail.com> wrote: > > A better way could definitely be done in a variety of languages > (BWBASIC? DEBUG?).
Well, I took a look at doing it with BWBASIC. There are two or three problems with that approach. First, for some reason the binary (despite claiming to use "TTY") doesn't redirect to file, so I can't use "set /e" directly there. (It must be doing direct-screen writes as even DJGPP's "redir -eo" doesn't help.) It does let you do 'environ$ "RANDOM" = str$(int(rnd * 4) + 1)', but (no surprise) that environment is gone once you exit BWBASIC, so it isn't saved. (I know there are tricks to modify the master environment, but most people don't do that.) So you have to basically "randomize timer", open a file for output, write the random number, then close. Then after generating the file, "set /e random=type rand4.txt". It's kinda kludgy, but it works. randomize timer num = int(rnd * 4) + 1 open "rand4.txt" for output as #myfile print #myfile, mid$(str$(num),2,len(str$(num))-1) close #myfile print "With FreeCOM 0.84-pre2, run this, then 'set /e random=type rand4.txt' " print "Manual output redirction to file fails with BWBASIC, sadly. :-(" print "'environ$ " + CHR$(&H22) + "RANDOM" + CHR$(&H22) ; print " = ...' loses its value at program exit. :-(" system Who knows, perhaps a recompile would fix this to be more friendly to redirection, but it's not crucial anyways. As is, I just decided to figure it out, with pre-existing binary, for my own amusement. ;-) Actually, it would probably be easier to generate MYPROMPT.BAT directly from BWBASIC instead of doing two separate (kludgy) steps. Oh well. P.S. Keep in mind a few things about BWBASIC: it's not the same as QBASIC (lacks some built-ins, e.g. LTRIM), it ignores precision suffixes (everything is the same size), and everything *except* variables is case insensitive, so "print" and "PRINT" are the same, but a$ and A$ are distinct. Oh, and it hates "?" and "'" shortcuts for PRINT and REM, respectively. Oh, and if you're having trouble finding your syntax error: "DO NUM", "RUN", "LIST". That should help. Just FYI. ------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel