forums

TNT Basic Forums > Feedback
Multi dimensioned arrays
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-26-2003 14:32

Posted by:
-wyvern

Location:
Bedroom

Find more posts by -wyvern

Wow, I seem to be having a lot of ideas recently. I should be being more content with the awesomenss that is TNT, but this just occured to me. In my RPG, characters have a variety of special moves, six per character, that are used when a guage is high enough. I would like to be able to store these in an array like this, with 15 different characters and six moves each, so an array with [15,6] elements for each aspect of the move. As far as I am aware, the only way to simulate this is to use a 90 element array and then multiply the character id I wanted by six, and then subtract the number of the attack from that. This is a bit unwieldy and difficult for absent minded people like me to understand. How about it? Multi dimension arrays could also be used in randomly generated maps, dungeons, or word games etc.

-wyvern

10-26-2003 19:59

Posted by:
matteo

Location:
Venice, ITALY!

Click Here to Email matteo   Find more posts by matteo

Luckily there are already ;-)

int x[5,5]

although it is not written in the docs,
makes a 5*5 array

I love multiarrays ;-)

10-27-2003 00:01

Posted by:
-wyvern

Location:
Bedroom

Find more posts by -wyvern

I wonder why i didn't think of that...

Oh! <:-0

Thanks for pointing out my ridiculous absent-mindedness. Now I just have to cut all those ludicrous multidimensional subroutines out of my game...

10-27-2003 00:30

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

quote:
I wonder why i didn't think of that...


...probably because it doesn't seem to be in the documentation anywhere... whoops...

Mark

10-27-2003 01:26

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

Great...

So now you tell me this, after I have an almost completed game full of
"mousemx - (sx[sselected]/45 - (soffsetx[((turn - 1)*4) + stypeselected]/45))" and such.....

10-27-2003 11:13

Posted by:
Miles

Location:
Australia

Click Here to Email Miles   Find more posts by Miles

My God!

That is very useful. Now I can cut out about 200 lines of needless code... In fact, I think I'll revise my entire game code. At the moment, almost all of my variables are numbered (like text1[10], text2[10], text3[10] etc) ... I've got one particular line of variables which goes from 0 to 37!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.