How to program things in BASIC

Discussion in 'Computer Games and General Discussion' started by naved.islam14, May 7, 2011.

May 7, 2011
  1. naved.islam14
    OP

    Member naved.islam14 Gbatemp's Official Dark Knight™

    Joined:
    Sep 12, 2009
    Messages:
    968
    Location:
    Gotham
    Country:
    Sri Lanka
    Can anyone help me find a total noob's guide for how to program with BASIC?
     
  2. Buleste

    Member Buleste Old Fart

    Joined:
    Dec 19, 2010
    Messages:
    852
    Country:
    United Kingdom
    What type of BASIC?
     
  3. naved.islam14
    OP

    Member naved.islam14 Gbatemp's Official Dark Knight™

    Joined:
    Sep 12, 2009
    Messages:
    968
    Location:
    Gotham
    Country:
    Sri Lanka
    I would like to know about how to program simple games.
     
  4. SifJar

    Member SifJar Not a pirate

    Joined:
    Apr 4, 2009
    Messages:
    6,022
    Country:
    United Kingdom
    He means what BASIC interpreter you are going to use. i.e. how are you going to run your BASIC programs? Each is a little different. A few simple commands (I almost typed "basic commands", lol") are:

    PRINT

    Displays text on screen

    Example:[/p]
    Code:
    10 PRINT "Hello World!"
    INPUT

    Get input from the user of the program

    Example:[/p]
    Code:
    10 INPUT "What is your name?", NAME$
    (stores the name in a "variable" called NAME$)

    GOTO

    Jump to a specific line (this depends on BASIC interpreter, not all use line numbers - if yours does, you number each line, starting with 10, then 20 etc. (so if you need to add more later, you don't need to renumber every line after it)

    Example:[/p]
    Code:
    10 PRINT "Hello World"
    20 GOTO 10
    END

    Ends the program

    Example:[/p]
    Code:
    10 PRINT "Hello World"
    20 END
    IF...THEN

    Does a comparison and then performs an action if it is true

    Example:[/p]
    Code:
    10 "Type 2:", A$
    20 IF A$ = 2 THEN GOTO 10
    30 END
    I think this is all right, been a long time since I programmed BASIC.

    A good reference is here: http://en.wikipedia.org/wiki/BASIC#Syntax
     
  5. Fishaman P

    Member Fishaman P Speedrunner

    Joined:
    Jan 2, 2010
    Messages:
    3,174
    Location:
    Wisconsin
    Country:
    United States
    Just get Liberty BASIC, the free version, and experiment.

    Or get Petit Computer for the Japanese DSi.
     
  6. Buleste

    Member Buleste Old Fart

    Joined:
    Dec 19, 2010
    Messages:
    852
    Country:
    United Kingdom
    Do you want to learn Visual BASIC, Bywater BASIC, True BASIC, RealBASIC. Do you want to learn BASIC on Retro Computers or even some Retro consoles had BASIC (Atari Greatest Hits Volume 2 has 2 different versions of BASIC on it)? Do you want to pay or do you want a free BASIC? Do you want to programme BASIC in Windows Linux or Mac OS?

    There are many versions of BASIC all with their own syntax's so you would need to be a bit more specific.
     
  7. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,696
    Country:
    United Kingdom
    Learning programming is great and do not let me stop you but

    I dislike having to be the person doing this but I really should- Basic (of any flavour that I know of up to and including visual basic/VB.net in some circles) is not held in high regard among programmers in general. Of course there is a lot of debate on the subject (as there is with most things) and I am more than happy to side with those saying it got a bad rap.

    By all means do it but can I at least steer you away from it as a first language- learn at least the basics with something else and return to Basic if you wish (there is a phrase among programmers that you tend to only program in your first language regardless of what language you are supposedly using at the time and you run the risk of being seriously disadvantaged if Basic is your chosen language). I am assuming you mean some of the more modern microsoft led efforts in things like visual basic and VB.net rather than the more traditional basic languages seen on the old home consoles and the like.

    That is not to say you can not get things done with it and many of the tools I use day in and day out make extensive use of it. Equally it is quite easy to pick up but
    Skills transfer is fairly difficult (although the slide from VB6 to VB.net to c# is not that bad) compared to some other languages
    .net lessened it but you will still see people complain about runtimes if you head down this path.
    With the more from more interpreted to more compiled stuff speed did increase but it is still not brilliant compared to a lower level thing.
    Depending on how much you want to listen to open source types things can appear there (although mono helps).
    Your code will likely not end up doing anything like drivers, operating systems, serious purpose code- games beyond things that would probably be described as flash games, web browsers, graphics editors and things like that not to mention stuff intended for embedded systems (like the consoles).
    As a counterpoint of being easier it might not stress some of the more "important" concepts of programming- optimising loops, general branching code, pointers, recursion, many aspects of low level data handling (if you were looking at some of the stuff the hacking tools do and thinking "yeah I like that idea" then when it comes to it you might feel some of the concepts to be quite alien where others march on without a worry) and other such things which would be quizzers like to test you on.
    It is not quite as popular as it might be meaning there is not as much out there in the way of examples, libraries and other related items. It also means other than maybe being able to build and maybe follow a bit of it then you can not really contribute much to a lot of the projects you might see around and even if you can the dependency on .

    There are a great many "simple" languages if you do not want the hassle of learning an older more low level language and equally there are many others far better suited to teaching concepts. Name list in no order whatsoever

    PERL- possibly falling out of favour it works, lots of people use it to script simple and more complex tasks.

    php- not used so much as a standalone language it does however see major use in modern websites.

    Javascript- laugh if you will but it works, every major web browser supports it (and although it is something of a dick waving contest they all seem to be speeding it up), equally there is node.js which is doing interesting things these days.

    python- usually mentioned in the same breath as perl they rose to prominence at similar times.

    java- falling a bit out of favour since Oracle purchased Sun but it got very very popular (many schools even dropped everything in favour of it).

    scheme- more traditionally used as a teaching tool it is quite nice

    LISP- another teaching language it is however very good at doing what it does and incorporating new ideas.

    Lua- a scripting language but one that has a fair fanbase among the simple games crowd.

    Do a search on any of those and what pops up under the related languages discussion. Likewise all the ones I just mentioned with the possible exception of Lua are taught across education so you should be able to find some great books on the subject- from my bookmarks
    http://www.gigamonkeys.com/book/
    http://www.greenteapress.com/thinkpython/thinkpython.html
    http://computer.howstuffworks.com/c.htm (a bit old and do have a look at some of the other things there but they give a solid grounding in things).
     
  8. naved.islam14
    OP

    Member naved.islam14 Gbatemp's Official Dark Knight™

    Joined:
    Sep 12, 2009
    Messages:
    968
    Location:
    Gotham
    Country:
    Sri Lanka
    The one justbasic program.
    BTW: What are the differences on the different versions of BASIC?
     

Share This Page