Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,915 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,141 people online right now. Registration is fast and FREE... Join Now!




Vision Impaired Dice Roller

 
Reply to this topicStart new topic

Vision Impaired Dice Roller

SSMGWEB
18 Dec, 2007 - 12:19 PM
Post #1

New D.I.C Head
*

Joined: 18 Dec, 2007
Posts: 3


My Contributions
What I need is some help setting up a dice roller program for sight impaired friend. I am not a VB.Net programmer so could really use some help writhing this in VB.NET. I need to allow him to press a limited number of keys (1,2,3,4,5,6,7,8,9,0,{space},{Ctrl},X) then display the results on the screen in 300 (or larger) point font.

The basic idea is that it will start with a lower case “d” displayed. when the number keys are pressed and the pointer is set to 1 then a number will appear before the “d” telling the system how many dice to roll. If the pointer is set to 2 then the number will appear after to “d” telling the system what type of die to roll. So “2d6” would mean roll 2 six sided dice and add the number together. When the space bar is pressed the pointer will go from 1 to 2 or from 2 to 1 after rolling the die and displaying the data on the screen. If the {crtl} is pressed then the number being worked on will blank and allows a new number to be entered. If the x is pressed then the program will end.

I should note that I’m a PICK programmer and have taken one VB.NET class 3 years ago. Could really use some help navigating thru the process.

The following is my logic flow,

(this is not code)

* MAIN BODY
Dim DISP(2)
POINTER = 1
CLOSEIT = FALSE
LOOP UNTIL CLOSEIT DO
GOSUB ACCESS.VALUE
BEGIN CASE
CASE BUFF.VALUE = -1
IF POINTER = 1 AND DISP(1) NE "" THEN POINTER = 2
IF POINTER = 2 AND DISP(2) NE "" THEN
GOSUB ROLL
GOSUB DISPLAY.ROLLED
DISP(1) = ""
DISP(2) = ""
POINTER = 1
END
CASE BUFF.VALUE = -3
DISP(POINTER) = ""
CASE BUFF.VALUE = -2
CLOSEIT = TRUE
CASE 1
DISP(POINTER)= ALPHA(VALUE(DISP(POINTER))*10+BUFF.VALUE)
END CASE

REPEAT

* USE SOME FUNCTION TO DETERMIN WHAT KEYS ARE BEING PRESSED
ACCESS.VALUE:
BUFF.DESC = INKEY()
BUFF.VALUE = 0
BEGIN CASE
CASE BUFF.DESC = "1"
BUFF.VALUE = 1
CASE BUFF.DESC = "2"
BUFF.VALUE = 2
...
CASE BUFF.DESC = "X"
BUFF.VALUE = -2
CASE BUFF.DESC = " " ;*{SPACE}
BUFF.VALUE = -1
CASE BUFF.DISC = {CTRL}
BUFF.VALUE = -3
CASE 1
GOTO ACCESS.VALUE
END CASE
RETURN

ROLL:
REPS = VALUE(DISP(1))
IF DISP(2) = "00" THEN
ROLLED = INT(RAND()*100)+1
ELSE
DICE = VALUE(DISP(2))
ROLLED = 0
FOR T = 1 TO REPS
ROLLED = ROLLED + INT(RAND()* DICE)+1
NEXT T
EEND
RETURN

DISPLAY.ROLLED:
CLS
SET.PRINT.FONT = 300
PRINT ROLLED
LOOP UNTIL INKEY() NE "" DO
RETURN

What I would like is someone to tell me how to read the keyboard buffer and display large type on the screen. as this is not ment as a learning process any and all other help would be welcomed!

Just to be clear I don’t expect anyone to code it for me. I’m just looking for the commands that can intercept keyboard activity and display data to the screen. I’ll not turn down more help but I can stumble thru the rest of it myself.

I assume I will have to open a form, put in a display only testbox and do the .net version of an inkey() command.


This post has been edited by SSMGWEB: 18 Dec, 2007 - 04:53 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 02:18PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month