Data.htm 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Data list_of_values</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. list_of_values = a list of comma delimited values (strings must be inside quotes)
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Data is used to create neat, comma delimited lists of values of a constant nature that you will be reading (and probably reusing) during the execution of your game. You may store level information (number of enemies, stars, etc) there or just about anything you can think of! You can easily mix datatypes (strings, integers, floats) in your Data statements, as long as they are read properly with the Read command later. You will need to use the Restore command to point to the .Label that begins your Data statements. See the related commands for more information and more examples.
  21. <br>
  22. <br>
  23. See also: <a class=small href=Read.htm>Read</a>, <a class=small href=Restore.htm>Restore</a>.
  24. </td>
  25. </tr>
  26. </table>
  27. <h1><a href=../2d_examples/Data.bb>Example</a></h1>
  28. <table>
  29. <tr>
  30. <td>
  31. Print "Here we go!" <br />
  32. <br />
  33. ; Restore to the start of the Data statements <br />
  34. Restore startData <br />
  35. <br />
  36. ; Get the first number which is the total number of users <br />
  37. Read Users <br />
  38. <br />
  39. ; Print them all! <br />
  40. For T = 1 To Users <br />
  41. Read firstname$ <br />
  42. Read age <br />
  43. Read accuracy# <br />
  44. Read lastname$ <br />
  45. Print firstname$ + " " + lastname$ + " is " + age + " years old with " + accuracy# + " accuracy!" <br />
  46. Next <br />
  47. <br />
  48. While Not KeyHit(1) <br />
  49. Wend <br />
  50. End <br />
  51. <br />
  52. .startData <br />
  53. Data 3 <br />
  54. Data "Shane", 31, 33.3333, "Monroe" <br />
  55. Data "Bob", 28, 12.25, "Smith" <br />
  56. Data "Roger", 54, 66.66, "Rabbit"
  57. </td>
  58. </tr>
  59. </table>
  60. <br>
  61. <a target=_top href=../index.htm>Index</a><br>
  62. <br>
  63. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Data&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  64. </html>