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

TinTin++ 1.99.8

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    The TinTin++ message board Forum Index -> Announcements
View previous topic :: View next topic  
Author Message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Oct 17, 2009 3:51 pm    Post subject: TinTin++ 1.99.8 Reply with quote

Code:

math.c         Added check to bypass inf and nan in tintoi.

update.c       Fixed a potential memory overflow in the input parser.

misc.c         Fixed displaying bug with semi-colons in echos.

nest.c         Added support for $variable[regex] to return lists. For
               example $variable[%*]

tinexp.c       No longer required to escape literal ^ and $ signs.
               So #regex {A ^ B} {A ^ B} returns true now instead of false.

net.c          Instead of exiting, tintin tries for 1 second to write data
               to a session before closing the session.                   

tinexp.c       $$<string> only gets converted to $<string> if $<string> makes
               a valid variable. Same for &&<string>.                       

tokenize.c     Added support for using ; in #foreach.

misc.c         Added support for using ; in #forall.

mapper.c       Updated the map grid to allocate memory for a future
               #map dump 99x99 <file> command.                     
Back to top
View user's profile Send private message Send e-mail
reality3k



Joined: 11 Feb 2009
Posts: 48

PostPosted: Tue Oct 27, 2009 1:49 pm    Post subject: Reply with quote

I'm noticing that in this latest version, #forall no longer steps through a list because of the indexes.

Code:
#list create test a b c d

#VARIABLE {test}={{1}{a}{2}{b}{3}{c}{4}{d}}

#forall {$test} {#echo $test[&0]}
a
0
b
0
c
0
d
0


Also, any suggestions for making something this work without creating a loop? I want each of these letters to be added as separate indexes.

Code:
#var test a b c d
#list test2 create $test

#VARIABLE {test2}={{1}{a b c d}}
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Oct 27, 2009 3:53 pm    Post subject: Reply with quote

You can use:

Code:

#var test {a;b;c;d}

#forall {$test} {#showme $test}


Alternatively:

Code:

#list test create a b c d

#loop {1} {&test[]} {cnt} {#showme $test[$cnt]}


Or as of 1.99.8

Code:

#list test create a b c d
#forall {$test[%*]} {#showme &0}


Also:

Code:

#list test create a b c d
#forall {$test[]} {#showme $test[&0]}


I've fixed the issue with #list test2 create $test for the next release, I've also updated the beta with this fix: http://tintin.sf.net/download/tintin-beta.tar.gz
Back to top
View user's profile Send private message Send e-mail
reality3k



Joined: 11 Feb 2009
Posts: 48

PostPosted: Tue Oct 27, 2009 7:48 pm    Post subject: Reply with quote

Thanks much! You gave me some ideas for rewriting my script for the newer version.

Something else I noticed is the roomexits command seems to be creating lists incorrectly
Code:
#map get roomexits mapexits
#showme $mapexits
{e}{1}
#showme $mapexits[1]
0
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Oct 27, 2009 9:58 pm    Post subject: Reply with quote

That's meant to be an associative array rather than an array.

So to get all the roomexits use: $mapexits[]

To check if an exit is valid:

#if {$roomexits[e]} {do something}

or ideally:

#if {&roomexits[e]} {do something}

To pick a random exit:

#list randomexit create $roomexits[];
#send {$randomexit[+1d&randomexit[]]}

The following currently doesn't work:

#list roomexits create $roomexits[];

I updated the beta with a fix so the above will work.


I guess I could have get roomexits return: {e}{e}{w}{w} so the random exit part works without having to convert anything. Not sure what else people would use the option for.
Back to top
View user's profile Send private message Send e-mail
reality3k



Joined: 11 Feb 2009
Posts: 48

PostPosted: Tue Oct 27, 2009 10:31 pm    Post subject: Reply with quote

Hehe, I just mean, I'd expect it to return this instead.

Code:
#showme $mapexits
{1} {e}


Since that's how the list is set up for everything else.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    The TinTin++ message board Forum Index -> Announcements 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