Working With Tables

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
User avatar
YunO
001 Fanatic
 
Joined: Thu Dec 27, 2007 8:38 pm
Location: (un)fortunately Brazil!

Working With Tables

Postby YunO » Fri Oct 30, 2015 2:37 pm

Ok, so I'm trying to make some really advanced stuff and I got myself dealing with tables. Unendingly.
The main issue is that unfortunately, 001's wiki is not really fully complete (about tables, at least).

So here is the thing. I'm making a crafting system, so I've got a 2x5x2 (x,y,z) table. The x1y1z1 row has the items names. Their columns (x1y#z1, for the first item, and x2, x3 and so on) have the items needed for crafting, and the z2 depth has the amount needed of each item to craft. Check my screenshots below for better understanding:
2015-10-30 16_28_02-Início.png
z1
2015-10-30 16_28_02-Início.png (3.08 KiB) Viewed 367 times

2015-10-30 16_28_57-Início.png
z2
2015-10-30 16_28_57-Início.png (2.58 KiB) Viewed 367 times


Also I have a collection with the items names (the first row) to know which ones the player knows how to make.

Ok, so when I want a list of all the ones the player knows, just loop through the collection, fine. But when I want the items needed for making those items things get really messy.
I have the item name, so I put a Variable Operation with a Find in Table, looking for the text. This way, I got the X position, which is good. But how do I get the Y position, so I can check it on z2?
Huge project coming soon...

User avatar
RamchuK_Ntertainment
Ultimate 001 Member
 
Joined: Tue Sep 29, 2009 10:50 pm
Location: Seattle, Washington

Re: Working With Tables

Postby RamchuK_Ntertainment » Sun Nov 01, 2015 1:10 am

You will very likely need to do an Axis Loop (Y-axis) for the item row (start at Y=2, since Y=1 is the item name, and until table Y size). Within the loop, the variable you select will return the element value in the column (items needed for crafting the item at Y=1) and you will then be able to do another search using the Find In Table use value for the variable, but on axis = 2 (Y-axis). All you need to do is make sure that the search starts at the X-axis of the item, that way it will be much faster. You should then have both the X and Y coordinates to work with at any Z layer.

TIP: 'Find In Table' will look for the value specified from the specified starting coordinates in a given Table and will retrieve the axis address for the axis selected. (e.g; search on the Z axis [3] will retrieve the Z coordinate).
Travesty: 3D Survival - WIP >>> Forum Topic
University of Washington (BABA)
-REGT- Ramchuk Entertainment Games Team
Strategy/Action/Adventure
Copyrighted©2008-2017

User avatar
YunO
001 Fanatic
 
Joined: Thu Dec 27, 2007 8:38 pm
Location: (un)fortunately Brazil!

Re: Working With Tables

Postby YunO » Sun Nov 01, 2015 7:49 pm

It worked perfectly. Thank you a lot!
Huge project coming soon...


Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron