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 / texturing multiple objects

Author
Message
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 19th Jul 2008 02:29
well i have tried to use the search button and again I couldn't find the answer so I fiquired I would ask one of you good people.
here is my code so far


For x = 1 to 75
Make object cube x,100
Position object x,Rnd(500),rnd(500),Rnd(500)
Next x

hide object x

basically I'm trying to effect more than one object at a time without having to actually right it all out. I'm trying to use variable for the number. bu0t I still get an error.

wind
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 19th Jul 2008 07:46
wind27382,

The problem is the hide object x command you have written. In the for loop you create 75 items, which works perfectly. However, the next x increases the x variable yet one more time after the last object is created. Therefore, you are actually trying to hide object number 76, which is not created in this for loop...which casts an error because the object does not exist.

If you are wanting to hide the last object created in this for loop using the method you have chosen, then change hide object x to hide object x-1. I hope I have helped you understand this problem a bit better. Happy coding!
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 19th Jul 2008 18:11
ok thanks for the help I will try that. but what i'm trying to do is hide all 75 objects at once. I will try to code you gave me and see what happens.

wind
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 19th Jul 2008 21:55 Edited at: 19th Jul 2008 21:56
To hide all the objects, you just need to put the 'hide object x' inside the for-next loop. But I'm probably misunderstanding, because that seems too obvious
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 19th Jul 2008 22:46
yea I know that I could place it in the for next loop. but the problem I was having was that i wanted to be able to unhide them all at the same time. such as if a person pressed the one key.

wind
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 19th Jul 2008 23:26
Just put something like this in your main loop:

Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 20th Jul 2008 18:04
wind27382,

You might want to work on communicating from the start your problem a bit better. We could have helped you in one reply if we fully understood that you wanted to hide all objects at once, and show them all at once at the press of a key(which you didn't even mention until later). Just a thought.
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 28th Jul 2008 04:01
sorry about that nano brain will remember that for future reference

wind
Nano brain
16
Years of Service
User Offline
Joined: 7th May 2008
Location:
Posted: 28th Jul 2008 20:50
wind27382,

No problem. It's just easier to get to the point as fast as is possible.

Login to post a reply

Server time is: 2024-11-25 19:57:34
Your offset time is: 2024-11-25 19:57:34