PDA

View Full Version : How do you change a key to a string



Harry1
10-20-2006, 10:29 PM
http://forums.parallax.com/images/smilies/wink.gif·http://forums.parallax.com/images/smilies/smurf.gif·http://forums.parallax.com/images/smilies/smhair.gif I am working on an hangman game that runs on a propeller chip and i am trying to get a keyboard input. My program is below, but i can get the keys but i cant get the strings to show up on the TV.

VAR
Long Index
Long numLetters
Long marker
Byte theWord
Long moveCounter
CON
· _clkmode = xtal1 + pll16x······
· _xinfreq = 5_000_000
· NewLine = 13
· ClearScreen = 0
· dpine = 26
· cpine = 27
·'
OBJ
· VideoDisplay: "TV_Terminal"·················· 'Creates the object VideoDisplay
· keyboard : "Keyboard"
'
DAT
Str1 byte "crrers",0
PUB Start
'
· DisplayTextOnMonitor
'
PRI DisplayTextOnMonitor | Count
· VideoDisplay.start(12)·····················
· SetScreenWhiteOnDarkGreen····················
· numLetters :=5
· Index :=0
· marker := 0·····································
'
·' Repeat Count From 1 To 200000·······················
· ' WaitCnt(40_000_000 + Cnt)
··· VideoDisplay.str(string("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"))
··· numberLettersInWordater
··· VideoDisplay.str(string("O······· WELCOME TO GUESS THE WORD······ O"))·····

··
··········· VideoDisplay.str(string("O·········· Copyright 1983·············· O"))
··············· VideoDisplay.str(string("O······································· O"))
··················· VideoDisplay.str(string("O······································· O"))
······················· VideoDisplay.str(string("O······································· O"))·
······ VideoDisplay.str(string( " _______······························· "))··
····· VideoDisplay.str(string( "·· |··· 0································ "))
······ VideoDisplay.str(string( "·· |·· /|\·················· Wrong Guesses "))·
······ VideoDisplay.str(string( "· |·· / \······························ "))····
······· VideoDisplay.str(string( "· __|____············· "))
····································
··· VideoDisplay.out(NewLine)
······
··· VideoDisplay.out(NewLine)
···· VideoDisplay.str(string( "_________ TRY TO GUESS THIS WORD__________"))··
···· VideoDisplay.str(string( "············································· "))
···· repeat Index from 1 to numLetters
····· VideoDisplay.str(string(" __ "))
·······
· ' VideoDisplay.dec(Count)··················
·'· VideoDisplay.out(NewLine)··················
··· WaitCnt(40_000_000 + Cnt)
' VideoDisplay.out(ClearScreen)···············
'
PUB startx
··
PRI numberLettersInWordater
·
· numLetters := strsize(@Str1)·················· 'testing only remove
PRI SetScreenWhiteOnDarkGreen···················
· VideoDisplay.out(1)
· VideoDisplay.out(5)
PRI MoveCounterizer
·

Please help me...ill give you a hug ^^http://forums.parallax.com/images/smilies/cool.gif http://forums.parallax.com/images/smilies/freaked.gif http://forums.parallax.com/images/smilies/lol.gif http://forums.parallax.com/images/smilies/roll.gif http://forums.parallax.com/images/smilies/shakehead.gif http://forums.parallax.com/images/smilies/smile.gif http://forums.parallax.com/images/smilies/yeah.gif

acantostega
10-22-2006, 07:45 AM
I believe Mike Green posted some routines to do just this, use the search feature.