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 / Function not working -- 7007 Error

Author
Message
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 21:06


Any ideas why this doesn't work ? It gives me a 7007 error saying it already exists.. But I have not called the msphere() function before I actually click the blue square. So I'm confused about it.

Any ideas ?

"If you can sing that high, you must have been kicked in the crotch a little too hard."
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 21:15
I think the problem is the mouse is double clicking. But I am only clicking it once. But for some reason I think the mouse holds that button to 1 and will not change. So the msphere() function is being created more then once. The problem is, I'm not sure how to solve this.

"If you can sing that high, you must have been kicked in the crotch a little too hard."
Ranietz
AGK Gold Backer
21
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 25th Jul 2011 21:35
Try something like this:


Also, I didn't try your code so I'm not sure what it's supposed to do but shouldn't you increase the ObjectNumber variable somewhere?
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 21:42 Edited at: 25th Jul 2011 21:42
Quote: "
Also, I didn't try your code so I'm not sure what it's supposed to do but shouldn't you increase the ObjectNumber variable somewhere?"


By looking at your code, I would be back in the same position since there is no stopping the mouse from resetting the mouseOK back to 1.

However, I think I solved it. Here is my code.



Ok now.. I fixed it so that once its been called once, it wont call it again ever. I can now add the code so that ObjectNumber can be more dynamic and I can make more then one sphere.

But now, if you run my code, the color takes over when I added the backdrop. so now I'm trying to solve that problem.

"If you can sing that high, you must have been kicked in the crotch a little too hard."
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 25th Jul 2011 21:44
If it isn't a problem to freeze the program you can use this:
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 21:48
Yea, again, with that, because the mouse is tricky on its timing, it can actually run that command more then once within the VERY short time your holding down the mouse. But as I mentioned up in my post above, I solved it with adding an extra variable that gets set only once .. once the sphere was created that is.

However, now In the code above, the purple is taking over. The sphere barely shows up for just a split second and the purple takes over in the background. Any ideas there ?

Oh and by the way, THANK YOU, THANK YOU, THANK YOU for the helps guys.. much appreciated.

"If you can sing that high, you must have been kicked in the crotch a little too hard."
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 25th Jul 2011 21:49 Edited at: 25th Jul 2011 21:51
Quote: "if you run my code, the color takes over when I added the backdrop"


I am not sure what you mean, but I will explain some things that might be the problem

Quote: "color backdrop rgb(200,100,200)"

Here you are coloring the backdrop, but it will stay black since there are no objects created. When you create the sphere, you will see the backdrop.

Quote: "if makethesphere = 1 and clickthemouse = 1 then position object ObjectNumber,10,50,50"

You are positioning the sphere outside of the camera view.

edit
just read your previous post, I'm pretty sure the problem is one of the things above
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 21:52 Edited at: 25th Jul 2011 21:53
yea, I figured out the 3d "objects vs backdrop" problem right as you typed it.

But as for the position, its not outside, because if I do not ADD the backdrop color the sphere is in front of the camera.

the problem is the purple covering the whole screen except the blue square is the problem. It wont show the sphere.

I think its actually coloring the sphere the same color as the backdrop. but as I try to color the sphere, there is no change.

"If you can sing that high, you must have been kicked in the crotch a little too hard."
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 25th Jul 2011 21:54


if you mean you have the backdrop off, then the sphere is still outside the camera view. But since the backdrop is not refreshing you will still see an image of the sphere from when it was created.
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 25th Jul 2011 21:56
try replacing
with

and you will see the sphere.
Try changing the backdrop on/off, if it is off you will notice a large sphere in the backdrop from when it was created.
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 22:07
I tried your code and it doesn't work for me.

Ok.. sorry if I seem a little dense here. But my code works as long as I have "backdrop off" command set and I use a black background color. But I need a background color. The sphere is showing up with my code, UNTIL I use the background color.

Also it IS refreshing .. hence the sync command.

I uploaded a picture of my working sphere in front of my camera with my code. What I cannot get to work is the Background color to work with this and NOT change the color of the sphere.

Unless your saying that the sphere moves from my original position ONCE I set the background color to on ?

"If you can sing that high, you must have been kicked in the crotch a little too hard."
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 25th Jul 2011 22:15 Edited at: 25th Jul 2011 22:18
Everything is working fine here with this code:


For the refreshing part:
Your screen is refreshing, but the backdrop isn't.
so when you move an object, it will leave a trail (see attachement).

edit
and btw, your sphere waits with moving for 1 loop. That's why you can see it now
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 22:25


If you noticed I added one more thing to your code above..

make object sphere 1000,0,0,0

It made the backdrop work as planed. Thanks for your help on this. Now I need to write it in such a way that the sphere doesn't bounce when you click the blue square. What its doing is turning the camera toward the sphere. I can just rewrite that part so that it doesn't do that. But now its working at least. Thanks again man. Good show.

"If you can sing that high, you must have been kicked in the crotch a little too hard."
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 25th Jul 2011 22:29
Quote: "Now I need to write it in such a way that the sphere doesn't bounce when you click the blue square"

Don't know whats bouncing, but acoarding to this
Quote: "What its doing is turning the camera toward the sphere"

it is the autocam. You can use autocam off so the camera won't point to the newly created object.
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 25th Jul 2011 22:32
AHHHHHHHHHHH .. Autocam off. Thats what I was looking for !! thanks again man.. This fixed it.

"If you can sing that high, you must have been kicked in the crotch a little too hard."

Login to post a reply

Server time is: 2026-07-10 17:19:35
Your offset time is: 2026-07-10 17:19:35