TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

some sort of data structure

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
svakanda



Joined: 25 Jan 2008
Posts: 18
Location: Missoula, MT

PostPosted: Fri Feb 01, 2008 6:41 pm    Post subject: some sort of data structure Reply with quote

hey Scandum, I trying to find some sort of complex data structure I can make work with tt++. Do you know of any way I could link up a couple of lists to make it multi-dimensional?

Or any other thoughts / paths i should explore? I know it could be done via #script, but that feels like it will take a lot more framework and I'm hesitant to start on something so large.

Thanks in advance !
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
titeuf



Joined: 29 Jul 2006
Posts: 84

PostPosted: Fri Feb 01, 2008 7:43 pm    Post subject: Reply with quote

You can make multidimensional arrays with lists, here's an example:
Code:

#list array clr;

#list array ins {-1} {{1} {2} {3}}
#list array ins {-1} {{4} {5} {6}}
#list array ins {-1} {{7} {8} {9}}

#function getitem {
   #list {&0} get &1 tmp;
   #list {tmp} get &2 tmp;
   #var result $tmp;
};

#showme @getitem{array 2 3}

Here we have a 3x3 array. The getitem function is used to retrieve an item from it


Last edited by titeuf on Wed Dec 17, 2008 9:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Fri Feb 01, 2008 7:44 pm    Post subject: Reply with quote

You can make a 2 dimensional list with nesting:
Code:

#var {bla} {{a b c} {d e f} {g h i}}

#function {bla}
{
    #var result $bla[%1];
    #var result $result[%2]
}

#showme @bla{1 1} - @bla{1 2} - @bla{1 3}
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> General Discussion All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group