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 with storing and retrieving array data

Author
Message
Richard Franklin
1
Years of Service
User Offline
Joined: 10th Mar 2016
Location:
Posted: 9th Apr 2016 08:18
High using dbpro.
making a simple text bases editor to make it easier to set up a map

I don't know how to use an array but im pretty sure that's what i need for this.

need to be able to store texture data or texture name
and the new object name assigned or just the object num i guess

basic example

if mousex()<10 and mousey >1000 and mouseclick()=1
print "rename object"+str$(pick object mouse()x,mousey(),1,400)
input= newobjname$
when enter is presses i need it to throw the new object name into a array and other object data object name$+texturenum+objnum
so next time i click on an object i can pull out the name of it and the texture ect
WickedX
8
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 9th Apr 2016 16:29 Edited at: 9th Apr 2016 16:32
What you need is a user defined type array. First declare the user defined type.

+ Code Snippet

Since this is for a 3D Editor, you may want to be able to add and delete objects. For this the array will need to be dynamic. Next dimension an empty array of your user defined type. DBPro has a whole set of functions to add and delete array elements.

+ Code Snippet

The down side to this is you will need to write functions to access the array index to the values needed. This function will return the necessary index using the object number.

+ Code Snippet

If you need any more help, don’t hesitate to ask.

Login to post a reply

Server time is: 2017-08-17 14:40:26
Your offset time is: 2017-08-17 14:40:26