home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / E / E_Examples / UserInput / Docs / NameExample.TXT < prev   
Encoding:
Text File  |  1997-02-26  |  1.2 KB  |  36 lines

  1. NameExample.e By Edward Farrow
  2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. First of all, we create an area of memory that the user can play in. This
  4. I have called 'moo'.
  5.  
  6.    DEF moo[256]:STRING
  7.                 ^Type      -  STRING allows you to use `\s' later on.
  8.            ^Bytes          -  The size in which to make it.
  9.        ^Name               -  The area name.
  10.    ^Define                 -  E keyword.
  11.  
  12. Now we display the message, leaving off the `\n' so that we can display a
  13. decent prompt.
  14.  
  15.    WriteF('What Is Your Name? ')
  16.  
  17.              - Notice The space after `?' this allows us to have an easy to
  18.                read line for the user.
  19.  
  20. Next we read the user input. This should be quick and easy not needing to
  21. load any modules!
  22.  
  23.    ReadStr(stdout,moo)
  24.                   ^Where To      -  Area of memory/buffer we have made
  25.            ^Where From           -  The place to read from (could be a file)
  26.    ^Command                      -  The E command.
  27.  
  28. Once this is done it is a simple case of displaying the name on the screen.
  29.  
  30.    WriteF('Your Name Is \s\n',moo)
  31.  
  32.       \s = moo          -  the earlier string we defined as moo containing
  33.                            the result from ReadStr.
  34.  
  35.  
  36.