Coming From QBasic
- Posted by Lynn Kilroy <leks_transportation at hotmail.com> Jan 14, 2006
- 560 views
My biggest curiousity is how do I get it to use subs in Included files? I type the include file line. It accepts that fine. Then I try to get it to do the screen mode thing, and that it doesn't seem to do so well. Also, if it's a one-line sub, perhaps I can just plug the line in to my code without the rest of the sub? One line subs only make sense to me if they are a sub that's called often and by many different routines, and I want it to look purdy instead of using the languages default command synstax. An example from QBasic is my Inkey routine. It's call is purdy simple: > Inkey a -where a is the name of a string variable. I use Inkey as a subroutine because I think a = INKEY$ is purdy ugly, so I stuck the command in a subroutine so in my program, I need only a = INKEY$ once. The rest of the time, it's Inkey a. This demonstrates some of my confusion, actually, and from whence it stemms. Euphoria was defined as an easy language to use. Defined as even easier to use than QBasic, it seemed to imply. I figured then it should be pretty easy to begin playing with it. But there seems to be a few things it's conspicuously missing. In the instance above, a subroutine is defined by a DECLARE SUB statement, with variables to pass to it defined after. > DECLARE SUB Inkey (a AS STRING) The sub is delineated by SUB ... END SUB. > SUB Inkey (a AS STRING) > > a = INKEY$ > > END SUB The subroutine name then becomes a KEYWORD. > DIM a AS STRING > > WHILE a <> CHR$(27) > > Inkey a > > WEND This is pretty simple. Now how do I do this in Euphoria? Speaking of Screen Modes, one of my programs uses a Screen Mode about which I can find no information in Euphoria Documentation available to me. I use the QBASIC command > WIDTH 80, 50 to obtain this screen mode. It is a text only mode, 80 columns by 50 rows. I would use 80 x 60, but ... That's a graphical screen mode, called by the combination > SCREEN 12 > WIDTH 80, 60 and tends to be a bit slow. Not that it matters, it's a smaller program. As I've not gotten the program to do any of these things yet, I've note reached any of the other parts that I'm curious about. I have looked through the code, and wondered about things like PUT and GET for graphics. I have mine own versions of these, but they require special files that I have to be able to write a program to write. They work well with 16 colors, but more than that, they're pretty much useless, as they don't compress files too well with more than sixteen colors. I've some theories how to expand it's abilities, but really have no need to use them {my graphics tend to stop at 16 colors, usually fewer, if I use them at all}. Basically, what I'm looking for is something with the flexibility and ease of use of QBasic but for more modern programming environments. Euphoria looks like it might be able to fill the bill, but first, I have to understand the very basic differences between it and QB. I don't mean the technical stuff like variable groups and nests and stuff {all that's kind of neat, though, and part of my attraction to the language}, but the basic syntax and use of the language, and perhaps help in handling graphics with the simplicity of QB, but without all the buggery errors. Another thing ... I have a QB Compiler. From what I saw in the documentations, there is no Euphoria Compiler. This is something of a drawback to me. I can purchase a Euphoria binder program, I can even purchase a Euphoria to C translater. But no Euphoria direct to Executable Compiler. I imagine this is not a problem with Linux, but with Windows, it becomes a problem that is really quite large. From what I can see, there are no free c compilers for Windows. This means that no matter the cost of the binder and translator, the overall cost of Euphoria for the programmer is still prohibitively expensive. Sure, QB is old, and yes, it's very limited. But at least I can distribute my QBasic Programs in such a format that people don't have to download a QB interpreter to use them, or, worse, purchase a $500.00 program in order to compile it and use it. Nor do I have to risk the uncredited theft my source code {which I make available under GPL, but still, the compiled version preserves my status as original author on the original code}. Love & Friendship & Blessed Be! Lynn Erika Kilroy