Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / error on hangman from book

Author
Message
david220
15
Years of Service
User Offline
Joined: 7th Nov 2009
Location:
Posted: 7th Nov 2009 18:37
hi

have entered the code for the hangman game from dbpro volume 1

but comes up an error on line 98


subscript must be integer or dword??

full code is


what does the error mean, have checked spellings etc

regards
dave
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 7th Nov 2009 19:29
I'm sure this problem has been posted before.

Was the code typed in by you or loaded off a CD that came with the book. I ask because it's not indented and this lack of indentation is hiding many of the problems you are having.

Take the CheckForLetter() function for example. When indented:



Clearly something wrong there as you can see when indented...

There are lots of errors when I try to run it, but to be honest I've not checked to see what version of DBP I'm currently running. Having said that, I'm petty sure the version I'm using has nothing to do with that code not running.

That's why I always say that code in on-line tutorials is far, far superior than in books because printing errors in books usually don't get fixed straight away.

Quote: "alreadyused = Pos(lettersguessed$,guess$)"


Pascal has a native Pos command, but DBP does not, so this is referring to a function which is missing from your code.

As I said, programs in books are very problematic at the best of times. Hangman has been covered in a tutorial on here anyway - without all the hassles...

TDK

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Nov 2009 23:18 Edited at: 7th Nov 2009 23:27
try putting the stringLibrary.dba in to the code at the top first line.



Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2024-11-24 00:37:48
Your offset time is: 2024-11-24 00:37:48