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

Can you break out of a loop

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



Joined: 22 Nov 2006
Posts: 55

PostPosted: Tue Nov 28, 2006 6:36 pm    Post subject: Can you break out of a loop Reply with quote

Basically I'd like to use a loop to step through a list, and do a test on each entry in the list. Upon a successful condition, I'd like to stop walking through the list, but haven't found a way to do this. Alternately, something in the way of a #while statement would do the trick too.

Code:
#VARIABLE {autoheal_list}
{
        {aff_prone}
        {aff_stupidity}
        {aff_whatever}
        #NOP Add more stuff here...
};

#ALIAS {autoheal_cure_aff}
{
        #NOP Do something useful here
}

#ALIAS {autoheal}
{
        #LIST {autoheal_list} {LEN} {autoheal_loop_len}

        #LOOP {1 $autoheal_loop_len}
        {
                #LIST {autoheal_list} {GET} {$loop} {autoheal_aff}
                #IF {${$autoheal_aff} == "1"}
                {
                        autoheal_cure_aff $autoheal_aff;
#NOP
#NOP                    Right here I'd like to break out of the loop.
#NOP
                }
        }
}
Back to top
View user's profile Send private message Visit poster's website
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Nov 29, 2006 6:54 am    Post subject: Reply with quote

Can't break out of the loop because tintin scripts aren't tokenized.

In this case you can however get rid of the loop and use:

#LIST {autoheal_list} {fnd} {1} {autoheal_cure_aff}
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