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 / Global Dim not Global

Author
Message
Firewood
19
Years of Service
User Offline
Joined: 24th Jul 2005
Location:
Posted: 28th Dec 2006 23:26
If i make a dim in my program of more then one array. Like
Dim CheckList$(25,3)
And i call a Function where this array is used the array is Local again for that function.

E.g

Dim CheckList$(15,3)

CheckList$(10,1) = "Player move"
CheckList$(10,2) = "Player Won"
DisplayWhat(2)


Function DisplayWhat(Pointing as integer)
Text 100,100,CheckList$(10,Pointing)
Text 100,120,"Is the status of the game"
EndFunction

The outcome is nothing. In the function DisplayWhat the array is somhow turning back to Local. The second line is printed.
Or did i do something wrong here.
Because in my program i have the array completly filled out but nothing is printing out to the screen.

Never say a question is stupid. Questions not ask are stupid.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 29th Dec 2006 00:40
It could be two reasons. If you're using Classic it won't allow declaring the data type inside the function call. And if you're using Pro in this example you don't have anything to pause the action of the program so you don't see any output... it just runs and errors out instantly. Always put an "end" before any functions so the program quits normally.

It'll work even without declaring the data type.

Firewood
19
Years of Service
User Offline
Joined: 24th Jul 2005
Location:
Posted: 29th Dec 2006 22:03
I know what you mean but that is not the point here.

I use PRO. And when i call the function. At the end of the program loop i put a SYNC. I use a SYNC rate of 60. And if you read the question good. You see that the second line in the function is working. Only the line with CheckList$(xx,xx) is not working. My problm is why does a single array works but a more demensioned array not. If i use a single array the function works.

BUT i like the awnser you did give me. The posebillety that it was that is there. Thanks.

Never say a question is stupid. Questions not ask are stupid.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th Dec 2006 00:45 Edited at: 30th Dec 2006 00:47
For me both lines in the function work. I've attached a screenshot of what I see along with the code (with only "wait key" and "end" added to your code).

You should post your entire code... there may be another error somewhere that causing the problem.

Attachments

Login to view attachments
Firewood
19
Years of Service
User Offline
Joined: 24th Jul 2005
Location:
Posted: 30th Dec 2006 20:32
I have figur it out. The problem is from myself. Because i give here a example with a few lines. It works fine. But i did make a lot of lines put them a in data and read them in.

Unwillingly i did read the data in starting from index 0. And when i start printing on the screen i did start backwards. Because my index was 50,100 Index 50 and 100 are empty. But i did thinking in indx from 1 to 50 and 1 to 100. But th program reads index from 0 to 49 and 0 to 99. So when i did print indext 50,100 i did print a empty string on the screen.

I did corrected the problem now and everything is working. I got the line i want to have.

This game is was making is a text base adventure. For now its 10% finished. The walking grid is compleet. Including 3 maze's with strange behavour. The text Lines are complet. Now i have to make the verbs and nouns.

Thanks for the time you spend for me.

Never say a question is stupid. Questions not ask are stupid.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 31st Dec 2006 02:36
Np.

I love text adventures... whats yours about?
Firewood
19
Years of Service
User Offline
Joined: 24th Jul 2005
Location:
Posted: 1st Jan 2007 22:42
The story line is not complete. What i am doeing now is preparing a basic program part. I have a idea of making a egypt adventure. Something about you a an adventurer going in a piramid and then get traped inside. Your coal is to escape the piramide. I give you a idea how i set it up and what i espect from the player.

- You are a adventurer who hase discovered a new piramid. Who is burid there is unknone. There are a lot of artifects inside. But to get there you must overcome a lot op traps. Dr Strangelove who have hired you for exploring this tomb, was flying in on the moment you did found the entrance.

Dr Strangelove give you the honour the enter as the first person. You enter the piramid and on the moment cross the entreance line Dr Stranglove start lauching. Before you could do somthing Dr Stranglove yell at you:"You fool. This is not the real entry. This is the dummy. The real entrance will open if the first fool enter the fake one. You will die here because you are the fool who opened the real entrace. Farewell....". A big block of granit falls down. Close your only exit you had. Or is it.

You ar raped now and you get two goals to work on. Your first goal is to escape the piramid alive. Before you food and drink are running out.
And if you do. Find Dr Strangelove to let him pay for his crime.

Thats what i have so far.

Never say a question is stupid. Questions not ask are stupid.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 2nd Jan 2007 04:40
Sounds cool! I can't wait to try it.

It reminds me of the Infocom game Infidel (also a text adventure). Infocom made top-of-the-line text adventures.

http://infocom.elsewhere.org/gallery/infidel/infidel.html

Login to post a reply

Server time is: 2024-09-25 15:29:50
Your offset time is: 2024-09-25 15:29:50