Array Database (need advanced users help :P)

For questions about using Classic.

Post » Thu Nov 03, 2011 7:37 am

[QUOTE=pangqiuqiu25] The next time I start everything is loaded correctly as it was when exiting. ...


___________________
Diablo 3 Items[/QUOTE]

try to do it with colorblock1 colorblock2 and stoneblock ._.
B
37
S
15
G
6
Posts: 238
Reputation: 7,735

Post » Fri Nov 04, 2011 1:35 pm

An index is a number used to enumerate things. By nature this has to be a progressive integer.
An array also uses integers.

Something like '3,1' is not a number to Construct, so it interprets it as a string.

For you to not lose overview, use the array 'database' as a simple 1-dimensional array to store the names of the objects:
stick stone apple colorblock1 colorblock2 stoneblock

Now you may reference the object by its index (stick = 1, stone =2, ..., stoneblock = 6)
When filling the inventory, put in this index, e.g. if the second slot of the inventory should contain an apple, then inventory(2) = 3
To look up the name, you use database(inventory(2)), which resolves into database(3), which is "apple", because the third item of database is "apple"
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Nov 04, 2011 2:28 pm

[QUOTE=tulamide] An index is a number used to enumerate things. By nature this has to be a progressive integer.
An array also uses integers.

Something like '3,1' is not a number to Construct, so it interprets it as a string.

For you to not lose overview, use the array 'database' as a simple 1-dimensional array to store the names of the objects:
stick stone apple colorblock1 colorblock2 stoneblock

Now you may reference the object by its index (stick = 1, stone =2, ..., stoneblock = 6)
When filling the inventory, put in this index, e.g. if the second slot of the inventory should contain an apple, then inventory(2) = 3
To look up the name, you use database(inventory(2)), which resolves into database(3), which is "apple", because the third item of database is "apple"[/QUOTE]

Sorry, but i'm don't understand this:

[QUOTE]When filling the inventory, put in this index, e.g. if the second slot of the inventory should contain an apple, then inventory(2) = 3
To look up the name, you use database(inventory(2)), which resolves into database(3), which is "apple", because the third item of database is "apple"[/QUOTE]

Can you show me? :3
B
37
S
15
G
6
Posts: 238
Reputation: 7,735

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests