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 / Resizing (not scaling) an object using Delete then Make Object

Author
Message
Schnide
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 29th Jul 2011 03:24
So having looked through the provided command set, there doesn't seem to be a command to allow the resizing of an object, rather than just rescaling.

So I tried to write code which would take the current size of an object, store it in a variable, increase it, then delete the object and remake it using the variable.

This doesn't work:



..however when you change:



to:



..it works! What is going on with that? Why can't it increase the size of the box by a value of 1, but it can using 2?

Thanks as always in advance,

schnide
Indicium
16
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 29th Jul 2011 03:52
Both ways work fine for me mate, although I don't understand why you can't just use scale object.

Schnide
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 29th Jul 2011 11:37
Really? Okay, well that's really odd then. When b=1, the box kept being remade exactly the same size. It only grew when b=2.

I tried this approach as scale object didn't seem to work for me either - it visually seemed to change the size of the object, but when I tried to return the size of it to a variable, using:



..the values printed stayed the same. Based on that, my understanding was that the actual values held for the size of the object do still stay the same and you only visually see a rescaled version of it. Is that not the case? Does rescaling change the held dimensions of the object too?
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Jul 2011 12:50 Edited at: 29th Jul 2011 12:51
Quote: "well that's really odd then. When b=1, the box kept being remade exactly the same size. It only grew when b=2."



You are using integer "b = 1 " . Try floats:

b# = 1
nx# = object size x (1)+b#


Cheers.

I'm not a grumpy grandpa
Schnide
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 29th Jul 2011 13:20
I'll give that a go, thanks.

I was deliberately using integers for both the sizing and positioning as I wanted to have a clean, 'snap to grid' arrangement rather than variables with decimals all over the place.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Jul 2011 13:55
Oh... I understand. Have a look to this code....it scale the object 100 units every time you press spacekey...like snap to grid



Cheers.

I'm not a grumpy grandpa
Schnide
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 29th Jul 2011 20:05 Edited at: 29th Jul 2011 21:28
Almost perfect.. however I have one last problem!

I replace the line about pressing space with the below, and..



..and the same value is still returned throughout. That's what I was trying to say in my second post.

This is not the end of the world, except I want to take the sizes as the object itself is seen on screen, place them in an array, save it to file, and use it to rebuild the world next time.

If the Y size really isn't changing as far as DBPro is concerned, would I store Y size + tam as the new size to rebuild from next time? Alternatively, that's why I thought it'd be best to store the values, delete and rebuild then take the values as they exist in real terms, rather than something just scaled.

Thank you for this.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Jul 2011 00:57
I think if we store data y size+tam , we can rebuild it again, as we save values.

Add this line to the code and try again....the value change every time we press spacekey.




Cheers.

I'm not a grumpy grandpa
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Jul 2011 01:46
@Schnide
I made some test...and when we create a new object with the stored data is a mess....you were right ....I will keep making some more test

Cheers.

I'm not a grumpy grandpa
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 30th Jul 2011 02:28

should be


All of the object size (x/y/z) commands have an optional parameter that allows scaling to be taken into account.

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Jul 2011 02:49
Quote: "All of the object size (x/y/z) commands have an optional parameter that allows scaling to be taken into account."



It really works !! thanks so much Dar13

Cheers.

I'm not a grumpy grandpa
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 30th Jul 2011 03:28
Quote: "It really works !! thanks so much Dar13"


No problem chafari, glad I could be of some help.

Schnide
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 30th Jul 2011 20:32
How this forum got a reputation of being unhelpful I don't know.

Thank you, and both of you have a great weekend.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Jul 2011 21:50
Quote: "How this forum got a reputation of being unhelpful I don't know"


Only those who came here asking..." I want you to make me an example for this and an example for this "....they don't want to learn . They just want you to make his work...only those people say that

cheers.

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2024-11-24 03:09:47
Your offset time is: 2024-11-24 03:09:47