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 / Help understanding error...

Author
Message
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 10th Jun 2004 22:17
Hey! I am designing an FPS and I implemented the moving and mouse look from 3D Monster hunt for the time being and when I try to run it it says theres a syntax error saying that it's a nesting error, at line 69 but it highlights line 65 and line 69 is blank...
So what the hell is up with this?

Got anime?
I do.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Jun 2004 22:18
the line reported is usually wrong.
a nesting error is when you have not properly closed a block of code like If-EndIf, For-Next, Do-Loop etc etc


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 10th Jun 2004 22:29
Thanks! You just earned a spot in my games credits for fixing the problem.
See I had a single endif when I needed two.

Got anime?
I do.
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 10th Jun 2004 22:30
Now another question, how do I choose where to position my player, in a fps game?

Got anime?
I do.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 10th Jun 2004 23:59
thats up to you.
just make sure the player is within the bounds of the world itself. you may want to make a nice starting point at 0,0,0 in your world editor then place the player there when the game starts.

just a thought


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 11th Jun 2004 03:41
No, want I want to know is what command I need to input.

Got anime?
I do.
Kivu_Rako
20
Years of Service
User Offline
Joined: 10th May 2004
Location:
Posted: 11th Jun 2004 04:03
okay, if you have no character object, such as in most fps, then it is quite easy. Just use this command:
"position camera x,y,z"
that will put the camera which is in a first person game basically your characters face anywhere on the current matrix.
if you want it facing a certain way, after that use
"point camera x,y,z"
put x,y,z a place on the matrix relative to your character so when the camera looks at it it is looking where you want it to.
btw, usual use the same "y" for both commands so he is looking straight not up or down.

"geez, its probably a noobish mistake too!"
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 11th Jun 2004 04:48
It's still not working, but wait! should it not be in the main loop? or should it be, because I've been placing that command in the main loop.
Confuzeled

Got anime?
I do.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 11th Jun 2004 10:39
Generally speaking, both the player position (camera position) and player view (camera angle) should be set within or during any player movement code. While that may appear in your main loop or it might be a function, the function method is the more common.

If you used the function method however of changing the X, Y, or Z, of either the player's position or where they are looking at, the values MUST BE defined as GLOBAL if your camera commands are in the main loop. (Or defined as arrays in DBC, since arrays are always global.) What I mean is;

If you are doing this;
rem -- main loop --
do
player_input()
position camera x1,y1,z1
point camera x2,y2,z2
sync
loop
...
function player_input()
if leftkey()=1 then x1=x1+5 : x2=x2+5
(etc.)
endfunction

And you have NOT included a line like;
global x1, x2, y1, y2, z1, z2

Then it will NOT WORK! Why? Because the values used by functions are local, they do not change the ones in your main loop. They must be globals for it to work in DBPro, though DB Classic will allow it. (But that's another issue.)

ttfn.

Any truly great code should be indisguishable from magic.
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 11th Jun 2004 23:43
Wha??
Anyways, I'm using DBC, and it's stilln ot working, what's going on?
I'm going brain dead!

Got anime?
I do.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Jun 2004 00:05
simple example.....

rem make some scenery so we can see movement
sync on:sync rate 40
for i=1 to 200
make object cube i,1
position object i,rnd(50),0,rnd(50)
next i
rem scattered some random boxes about

rem main loop
do
if upkey() then move camera 0.1
if downkey() then move camera -0.1
if leftkey() then turn camera left 1
if rightkey() then turn camera right 1
sync
loop

will make a simple "box city" and then allow you to move the camera about (no collision in the code), check out the commands and alter the values to change the speed you turn/walk etc.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 12th Jun 2004 02:39
What's this got to do with camera positioning for FPSs Mentor??
I've got the movement down, but I keep starting out on the edge of the matrix when I set position camera to the center of the matrix, can ya answer that question???

Got anime?
I do.
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 19th Jun 2004 16:29
I still can't get it to work URRRGHHH!!!!
It's driving me insane, I aways start out on the edge of the matrix and it takes me about 5 minutes to get back onto the matrix...

I got to figure this one out...

Got anime?
I do.
bibz1st
21
Years of Service
User Offline
Joined: 2nd Jan 2003
Location:
Posted: 20th Jun 2004 17:37
How big is your matrix and is it positioned at 0,0,0?
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 20th Jun 2004 21:02
It's 5000,5000,20,20
I tried to postition at 0,0,0 and it brought me to a corner, and sometimes I wouldn't even be on the matrix...

Got anime?
I do.
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 20th Jun 2004 21:23
very simple example.....

rem make some scenery so we can see movement
sync on:sync rate 40
for i=1 to 200
make object cube i,1
position object i,rnd(50),0,rnd(50)
next i
rem scattered some random boxes about

rem REPOSITION VIEWPOINT ******************
position camera 25,0,25
rem locates viewpoint at 25,25 (middle of "city")

rem main loop
do
if upkey() then move camera 0.1
if downkey() then move camera -0.1
if leftkey() then turn camera left 1
if rightkey() then turn camera right 1
sync
loop

matrix co-ordinates work from 0,0 , so to be in the middle of one 100x100 you need to either position the camera at 50,50 OR position the matrix at -50,-50, is that any help?, I don`t get exactly what you mean, surely if you can move the camera then you know how to position it?, or am I missing the point?

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster.
Cian Rice
20
Years of Service
User Offline
Joined: 8th Jun 2004
Location:
Posted: 21st Jun 2004 23:23
Well, you see the camera ALWAYS positions itself at 0,0,0 a.k.a the corner of the matrix, that's me problem, but u should head over to my thread called positioning camera, and hey could u check my odd FPS moving too, I am experianceing problems there...

Got anime?
I do.

Login to post a reply

Server time is: 2024-11-26 22:24:41
Your offset time is: 2024-11-26 22:24:41