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.

DarkBASIC Professional Discussion / Object already exists...and yet it's the first time I create it??

Author
Message
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 10:09 Edited at: 17th Jun 2003 10:18
Whoops...sorry . Double post.

...and it seems the forum deleted the wrong post. (sigh) Oh well, I'll repost.

I'm sorry for all who had to suffer through my endless griping about bullets, and I thank those who helped me with code. However, I'm now doing the right thing: Trying my own code. I finally got it to a state where I thought it would work correctly, but unfortunately it doesn't. I keep getting an object already exists error. It's very annoying, because it happens the first time I click the mouse. The bullet is not cloned until I click the mouse, and the basebullet is previously loaded. Anyone have any ideas on the problem here?

By the way, I'm not sure if the code was cut off when I accidentally double posted. I'll have to check again.
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 10:20
Yes, the code was cut off. The following lines of code are where I set up my array and variables, and where I load the base bullet.

Soyuz
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location:
Posted: 17th Jun 2003 12:15
and you're saying this is where it gives the "object already exists" error?

This isn't in a sub-routine that is called more than once?
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 12:29
The code in the second post is just to make the code in the first post a little more readable. I'm having the object already exists error at the line saying "clone object basebullet,numofbullets", which is in the first post's code.

The first post's code is in a subroutine that is called every loop. The second post's code is before the main loop. It just sets stuff up for the gun control subroutine.
Vulcan Omega
23
Years of Service
User Offline
Joined: 17th Dec 2002
Location: United Kingdom
Posted: 17th Jun 2003 12:38
Hi there, I think your problem may lie with this:



From the code you have supplied, you haven't made a object o. That maybe one reason for object doesn't exist.

For the Object already exists, I think it lies with


I'm not 100% sure but I don't think that command works very well. By looking at the command help file for clone object that line should read:



What I use to make my bullets is



I hope that helps you.

Vulcan Omega is closer than you think !
http://www.vulcan-omega.co.uk/
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 12:47
Hmm...I'll have a try at switching the parameters for clone object. It would make sense.

Object o is made elsewhere in the program, during my level loading sequence. I have objects 27-84 as level objects, and hence I want to be able to shoot them.

I would make my bullets like you do, but I already have 57 objects occupying the level. Another 99 or so wouldn't be helpful to the framerate. However, if all else fails, I'll try that.

Thanks for the help, Vulcan.
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Jun 2003 13:55
There may be another problem as well, see following thread:

http://www.darkbasicpro.com/apollo/view.php?t=9809&b=1

something about a bug P4 (and possibly 4.1) where object number can not got over 50!!!

Gronda, Gronda
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 17th Jun 2003 15:53
What? Don't be daft - this code for example works fine in P4.1:



Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_103.zip
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 17th Jun 2003 15:56
Rob K: I know objects can be anything but the clone command can not cope with creating new objects above 50.

Can't test as I'm at work.

Gronda, Gronda
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 17th Jun 2003 18:48
Clone Object always gives me an Object Already Exist/Object Dosen't Exist error no matter how I use it....

--Mouse

Famous Fighting Furball
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 20:09
Well...it figures. I figured something was broken about it, because there was no way the object already existed.

I guess I'm going to have to rewrite my bullet code...again.
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 17th Jun 2003 20:35
Well, at least I have it now to where it won't crash.

Now, however, whenever I try to fire a bullet, it resets me at the original camera position! I have no command in the _guncontrol subroutine that even mentions positioning the camera. So why is it repositioning me where I first started every time I try to shoot?

I have included my new guncontrol subroutine and the place in the code before the main loop where I load the bullets. Actually, though, I believe I have it now to where I don't need to load the bullets beforehand. But I figure I may as well leave it until it's stable enough to test it without that command.
MasterInsan0
23
Years of Service
User Offline
Joined: 14th May 2003
Location: United States
Posted: 18th Jun 2003 00:17
Hmm. I never set the autocam on, but apparently turning it off was the key.
Ian T
23
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 18th Jun 2003 01:39
It's automatically on. That's why the camera centers on a sphere in things like Your First 3d Program.

--Mouse

Famous Fighting Furball

Login to post a reply

Server time is: 2026-07-11 14:56:06
Your offset time is: 2026-07-11 14:56:06