home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / input / input2-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  3.0 KB  |  101 lines

  1. rem Input Functionality
  2.  
  3. rem Prepare Force Feedback (if available)
  4. ForcePresent=0
  5. empty checklist
  6. PERFORM CHECKLIST FOR CONTROL DEVICES
  7. for c=1 to checklist quantity()
  8.  if checklist value a(c)=1
  9.   SET CONTROL DEVICE checklist string$(c)
  10.   ForcePresent=1
  11.  endif
  12. next c
  13.  
  14. rem Test loop
  15. do
  16.  
  17. rem Produce random values
  18. String$="hello world "+str$(rnd(99))
  19. XValue=rnd(640)
  20. YValue=rnd(480)
  21. MagnitudeValue=rnd(100)
  22. AngleValue=rnd(360)
  23. DelayValue=rnd(1000)
  24. FireButtonValueID=rnd(31)
  25. HatID=rnd(3)
  26.  
  27. rem Try each command at random
  28. if rnd(500)=1 then CLEAR ENTRY BUFFER
  29. if rnd(500)=1 then WRITE TO CLIPBOARD String$
  30. if rnd(5)=1 then WRITE TO REGISTRY "App","Field",42
  31. if rnd(5)=1 then HIDE MOUSE
  32. if rnd(5)=1 then SHOW MOUSE
  33. if rnd(5000)=1 then POSITION MOUSE XValue, YValue
  34. if ForcePresent=1
  35.  if rnd(5)=1 then FORCE UP MagnitudeValue
  36.  if rnd(5)=1 then FORCE DOWN MagnitudeValue
  37.  if rnd(5)=1 then FORCE LEFT MagnitudeValue
  38.  if rnd(5)=1 then FORCE RIGHT MagnitudeValue
  39.  if rnd(5)=1 then FORCE ANGLE MagnitudeValue, AngleValue, DelayValue
  40.  if rnd(5)=1 then FORCE NO EFFECT
  41.  if rnd(5)=1 then FORCE WATER EFFECT MagnitudeValue, DelayValue
  42.  if rnd(5)=1 then FORCE SHOOT MagnitudeValue, DelayValue
  43.  if rnd(5)=1 then FORCE CHAINSAW MagnitudeValue, DelayValue
  44.  if rnd(5)=1 then FORCE IMPACT MagnitudeValue, DelayValue
  45.  if rnd(5)=1 then FORCE AUTO CENTER ON
  46.  if rnd(5)=1 then FORCE AUTO CENTER OFF
  47. endif
  48.  
  49. rem Display data
  50. cls
  51. print "INPUT EXPRESSION DATA"
  52. print
  53. print "scancode:";SCANCODE();
  54. print " keystate1:";KEYSTATE(1);
  55. print " entry$:";ENTRY$()
  56. print "up:";UPKEY();
  57. print " down:";DOWNKEY();
  58. print " left:";LEFTKEY();
  59. print " right:";RIGHTKEY()
  60. print "control:";CONTROLKEY();
  61. print " shift:";SHIFTKEY();
  62. print " return:";RETURNKEY();
  63. print " escape:";ESCAPEKEY();
  64. print " space:";SPACEKEY()
  65. print "clipboard:";GET CLIPBOARD$()
  66. print "registry:";GET REGISTRY("App","Field")
  67. print "mouseclick:";MOUSECLICK()
  68. print "mousex:";MOUSEX();
  69. print " mousey:";MOUSEY();
  70. print " mousez:";MOUSEZ()
  71. print "mouse movex:";MOUSEMOVEX();
  72. print " movey:";MOUSEMOVEY();
  73. print " movez:";MOUSEMOVEZ()
  74. print "joystick up:";JOYSTICK UP();
  75. print " down:";JOYSTICK DOWN();
  76. print " left:";JOYSTICK LEFT();
  77. print " right:";JOYSTICK RIGHT();
  78. print " x:";JOYSTICK X();
  79. print " y:";JOYSTICK Y();
  80. print " z:";JOYSTICK Z()
  81. print "joystick fire a:";JOYSTICK FIRE A();
  82. print " b:";JOYSTICK FIRE B();
  83. print " c:";JOYSTICK FIRE C();
  84. print " d:";JOYSTICK FIRE D();
  85. print " firex:";JOYSTICK FIRE X(FireButtonValueID)
  86. print "joystick slider a:";JOYSTICK SLIDER A();
  87. print " b:";JOYSTICK SLIDER B();
  88. print " c:";JOYSTICK SLIDER C();
  89. print " d:";JOYSTICK SLIDER D()
  90. print "joystick twist x:";JOYSTICK TWIST X();
  91. print " y:";JOYSTICK TWIST Y();
  92. print " z:";JOYSTICK TWIST Z()
  93. print "joystick hat angle:";JOYSTICK HAT ANGLE(HatID)
  94. print "ForcePresent:";ForcePresent
  95. print "control device name:";CONTROL DEVICE NAME$()
  96. print "control device x:";CONTROL DEVICE X();
  97. print " y:";CONTROL DEVICE Y();
  98. print " z:";CONTROL DEVICE Z()
  99.  
  100. loop
  101.