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 / DB Pro Tutorial 6 bug?

Author
Message
TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 11th Apr 2012 14:03
I tried using some code copied EXACTLY from tutorial 6 to recreate it, but it didn't work.
I got a "Could not determine parameter type of '"#" or' at line 112."
The offending line and the one after it was:

Does anyone see any problems with this code?
Ramon156
13
Years of Service
User Offline
Joined: 13th Jul 2011
Location: Netherlands
Posted: 11th Apr 2012 23:22 Edited at: 11th Apr 2012 23:23
Could you post a link to the tutorial so we can see the rest of the code.

I think you need to put the code on one line instead of 2.

It shows up at my page like 2 lines.




If that's true you should set it to one line like this.

TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 12th Apr 2012 00:42
It is the 6th tutorial in the DB Pro product page. Here's the link:
http://www.thegamecreators.com/?m=view_product&id=2000&page=tutorials
I tried what you said might work, but it didn't. Do you see any problems from the full code?
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 12th Apr 2012 02:27 Edited at: 12th Apr 2012 02:28
That line should actually be written like this.

if map$(curposx,curposz)="#" or map$(curposx,curposz)="S"

Also change every occurrence of this,

map$(int(curposx),int(curposz))

to this, in the program.

map$(curposx,curposz)

The Problem is, as written the variables curposx and curposz are already integers.
TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 12th Apr 2012 13:53
Now I'm getting the same error at line 119:

I changed it, so what could be wrong now?
Lewis999
14
Years of Service
User Offline
Joined: 23rd Oct 2010
Location:
Posted: 12th Apr 2012 18:44
move the next line so it's just after the "or", like this:
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 12th Apr 2012 21:32
Below is an example of you code modified a little (I took it from your first post). Open a new DBPro document, copy this code and paste it to the new document and run.



Explanation: You did not place a space between the "=" and the function call's last bracket, hence the machine thought that
Quote: "curposz)=":""

was to be passed a single parameter (methinks) instead of just "curposz".

Also:
*Always try to keep a set of conditions on one line
*You need not declare variable types when passing parameters, ie MyFunc$(param1, param2) is fine.
*Keep code neat. By doing so you can easily spot errors/debug/avert mishaps.

Good Luck!

TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 13th Apr 2012 00:16
Okay, now I have everything done with the suggestions everyone has given me. It compiles, but then I get the following:

What could be wrong now?
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 13th Apr 2012 02:19 Edited at: 13th Apr 2012 03:17
TheKGuy, the main problem you’re having is because the QuickStart Tutorial 6 - Huge Dungeons PDF document is using automatic word wrapping. The following line appears in the document like this.



The indentation on the first line is a clue. This is how the line should be.


Edit: But remember to change all occurrences of map$(int(curposx),int(curposz)) to map$(curposx,curposz) in the program.

nonZero, now try using map$ as a multidimensional string array, like it’s used in the program.



For me this is giving a Subscript must be Integer or DWORD when referencing as array error. I know, you should be able to convert an integer to an integer. I think this may be another bug in DBPro. Also spacing does make the code easier to read, but it compiles for me with or without it.

Edit2: But your are right, sometimes a space will make a difference.
TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 13th Apr 2012 02:57
WickedX, the compiler doesn't seem to see any errors in the syntax. It might be a problem with my computer, but all of the other TGC tutorials work just fine. My computer is pretty old, it runs XP and has an old ATI Radeon 9800 GPU, however, I just re-installed Windows on it. Could that contribute?
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 13th Apr 2012 13:21
@WickedX
Quote: "nonZero, now try using map$ as a multidimensional string array, like it’s used in the program."

lol, I assumed it was a function. Have not read t3h b00kz and only looked code posted - my bad x_x
Quote: "For me this is giving a Subscript must be Integer or DWORD when referencing as array error"

Strange, I copy-pasted the code you posted directly into my editor and it ran fine, no errors. Try modifying this line:

to

and if it runs, try:

If that gives an error, try adding this above:

because:

which I think may accidentally happen ?? That's Why I use the new compiler but the old editor = speed = stability.

@TheKGuy:
Are your sure you have "END" seperating your main program code from all your functions? No functions must be above this END line, ie:


That is the only reason for
Quote: "You have hit a FUNCTION declaration mid-program"
unless you are bypassing the END statement with a GOTO/GOSUB. Posting your full code may help if this doesn't fix the problem.

WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 14th Apr 2012 00:33
@nonZero

It's the first snippet that was not compiling.

Quote: "
if map$(curposx, curposz) = "#" or map$(curposx, curposz) = "S"
"


Who was it that come up with that fix? Oh it was me.

I have had the source in question on my system for several years, but never before tried to compiler it. Compiled the code as originally written with 7.7RC7 and it compiles. So the bug is fixed. I was using Update 7.4.
TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 14th Apr 2012 13:41
I might as well post the whole code. I think it's pretty much identical to the tutorial:



If it helps, I was using the free download on thegamecreators.com (the one with ads).
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 14th Apr 2012 13:54
@WickedX:

Quote: "It's the first snippet that was not compiling."


Sorry, I misunderstood because of the way you posted it:

Quote: "nonZero, now try using map$ as a multidimensional string array, like it’s used in the program.

For me this is giving a Subscript must be Integer or DWORD when referencing as array error. I know, you should be able to convert an integer to an integer. I think this may be another bug in DBPro. Also spacing does make the code easier to read, but it compiles for me with or without it."


It was a little ambiguous because you used the point "this" without first declaring what the pronoun value was. Therefore when I interpreted it, "this" automatically points to the memory area of the first byte of the last object mentioned (in short your code last snippet's start). I'm afraid I interpret in the most linear and most literal fashion (On one occasion I pickup up a chair and walked off with it due to being instructed "Take a seat"). Before you ask, I never stopped to think "Hey why would he post code if it crashed on his machine?" because such a simple fix would not require testing. So, logically, I assumed you came across the bug afterwards and were posting about a bug in DBP as, in theory, your code was right and therefore the bug had to lie in your version of DBP.

Quote: "Who was it that come up with that fix? Oh it was me."

I was not suggesting the solution back to you, I was utilising it as a part of a step-by-step procedure in search of bugs in DBPro. If it annoyed you I appologise. However, I do think that making unnecessary ironic, sarcastic or aggressive remarks towards other users is a little immature - especially if thos users in question misunderstood you, especially if that misunderstanding was due to ambiguity in your post.

It is not good to take a defensive or aggressive stance in life until all elements are known and all facts are straight. With a little patience, we avoid blow-ups. This is a prime example. Many other people may ave thought "Who the ***** does he think he is!? I was just tryna help. If he wants to take my words outta context, I'll just flame him!!! Hmph!! Yah!!!" and after that, aggression begets agression and before you know it, poor OP's thread's been jacked and a Mod has locked it because two other guys were fighting over something childish. The biggest irony of all is those two morons may ended up good friends if that misunderstanding hadn't happened or one of them had chosen to diffuse it. Well, I guess I'm taking up the role of "the moron who diffuses it" - I hope.

PS: I apologise if I'm the moron doing the misinterpretation but your post did come off a little confrontational.

TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 14th Apr 2012 19:11
I moved the functions to below the end line, and....now it just automatically closes itself. What's wrong now?
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 14th Apr 2012 19:59
@nonZero

I apologize; I think we both just had a misunderstanding. I haven’t been feeling well for the last few weeks. My post was a little confrontational and for that I’m sorry.

We ok?

I have the new beta, but tend to still use version 1.074. Guess I will try things out on the new version from now on before posting. Thanks.


@TheKGuy

My apologize too you as well. Now back to your problem. Could you post what you have so far.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 14th Apr 2012 20:45
@WickedX:
Quote: "We ok?"

Sure, we're cool.

@TheKGuy:
Quote: "I moved the functions to below the end line, and....now it just automatically closes itself. What's wrong now? "

Are you actually invoking them though...? Also, you need a flow control, example: if your program loops, you need DO-loops, WHILE-loops, etc.

This code below runs and repeatedly prints a result until a key is pushed:

But this next code will execute only once and then end, apearing asif nothing really happened:


TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 14th Apr 2012 23:22
@nonZero I tried placing a do/loop in random places, and it just gave me a black screen.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 15th Apr 2012 09:23
Quote: "I tried placing a do/loop in random places"

Thats the problem right there, "random places". You need to enclose you main program in a loop. Also, if you have SYNC ON, there needs to be a SYNC command at the end of your loop (just before "LOOP"). I just looked (briefly) at the code you posted as the "whole code" and there are many bugs and design flaws in.
After seperating functions with END (which you'v done):
Remove the rndomly placed loops for now and place "WAIT KEY" above "END" just to see if you see anything - this is a messy example and I can't read it properly on my phone.
Remove all SYNC-related commands until none exist (use search, it's easier than reading ). Now place "SYNC 60" just below "set dispay mode....". This'll be a start. I think I'll edit the entire code later today and post a redo on the example.

nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 15th Apr 2012 22:53
Quote: "I think I'll edit the entire code later today and post a redo on the example."


I lied. That code was just too daunting. It was messy (IMO) and it required media files and I was like "easier to rewrite". So I wrote my own example for you. It's neat and commented and covers everything that was covered in the original tutorial (except the FOG ON command - no big loss, you can look that up). I've tried to make it easy to understand and easy to play with. If there are glitches, I appologise but today's been hectic. Should run fine though. I tested it on my "weak machine" and it works on that one so it should work on anything then. Anyway, without further ado, here is your tutorial:



Don't hesitate to ask questions if you don't understand something or want to know why I did something in a certain way

TheKGuy
12
Years of Service
User Offline
Joined: 11th Apr 2012
Location:
Posted: 16th Apr 2012 02:57
Thanks, it looks awesome. The funny part is, I copied most of it from the tutorial file . Anyway, I understand most of it, but two things that I don't get are the MakeTextures() and MakeMap() functions. Also, can I study this to make my own games? This might be a useful reference if I ever make a big dungeon game.
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 16th Apr 2012 12:39
Okay, here's a broken-down version of the MakeTextures() function. You can run it and have a look at some texture theory too:



The next explains the MakeMap() function better. It will not run as it is just a breakdown:



Quote: "Also, can I study this to make my own games?"

Not sure what you mean but:
If you mean "can I use the source code for my game(s)?" then yes. Any code I post on this forum is 100% open source. Anyone can use it for anything.
If you mean "will it be practical?" then yes as well. It ties in with 2D tiling theory too and will be a good start. As you progress though, you will likely devise your own better methods - especially once you can handle more complicated data processing.

Login to post a reply

Server time is: 2024-11-23 20:44:31
Your offset time is: 2024-11-23 20:44:31