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 / variable element array

Author
Message
SlashX1896
13
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 1st May 2011 19:30
I am doing work for a class where we are creating a Hangman game.



is my statement and it is supposed to print each letter of gitem (which is named earlier in the program)
but when the program is run it does not print anything from the array

what am i missing or do you need me to show you more code?
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 1st May 2011 23:27
Hi. Welcome to the forum!

Well the code you've put there seems correct so long as li = the length of the string gitem$ and gitem$ has the string you want in it. I've adapted your code by adding the lines setting up those variables.



I'm guessing the problem is in the way your setting up your variables. If you can't work out from this example what you need to change in your own codes, then post more of your code up here so that we can check it for you.

Also, I should point out that there do seem to be some slightly strange things about the way you've written this code like the use of an array of string to store a single string and the use of the array when you would seem to be able to bypass it and just print the mid$(gitem$,c). I'm guessing these things are deliberately part of the exercise for your class, right?

Hope this helps.
SlashX1896
13
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 1st May 2011 23:48 Edited at: 2nd May 2011 01:43
Edit: Okay Did that and it fixed my problem thank you very much.

But am running through some more problems along the way, most in which i fixed on my own but one is troublign me.

This is for the hangman game from the darkbasic book.


i have that repeated for li = 5 , li = 4 and li = 3
with that I have no problems. But my trouble is when all the guessed letters are correct and = gitem$ it needs to display "You win" 30 times randomly.
How do i create a variable that will put all correct guesses into one single variable where i can create an if statement for it to show you win?
sorry if this is not clear, best i could think of.
SlashX1896
13
Years of Service
User Offline
Joined: 1st May 2011
Location:
Posted: 2nd May 2011 02:41
Well once again fixed my problem. WIll stop posting for now Unless i happen to come across more problems and spend hours trying to fix them without being successful

Login to post a reply

Server time is: 2024-09-29 02:28:12
Your offset time is: 2024-09-29 02:28:12