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

List and action combined.

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
evil.r2d2



Joined: 24 Sep 2011
Posts: 6

PostPosted: Thu Jun 26, 2014 6:13 pm    Post subject: List and action combined. Reply with quote

Hello. Quick question:

I have a list of names that I want to use to trigger an action:

#list {enemy}{create}{adam}
#list {enemy}{add}{peter}
#list {enemy}{add}{john}

What I want to achieve is to get all the names from the list and make one #action statement like this:

#action {{adam|peter|john}} { ... }

The problem is, I have no idea how to do that ;) Can someone help me?

Thanks!
Back to top
View user's profile Send private message Visit poster's website
PowerGod



Joined: 04 Aug 2014
Posts: 346

PostPosted: Tue Dec 02, 2014 11:23 am    Post subject: Reply with quote

I suppose the only way is to make a generic ACTION and search for the match after it is triggered...

Something like this:
Code:
#list enemy create {adam} {peter} {john}
#action {%+}
{
#list enemy find {%1} {result};
#if {$result>0} {#echo {%1 found in list}}
}


#showme adam
adam found in list
adam

#showme alexander
alexander

#showme john
john found in list
john

Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Tue Dec 02, 2014 9:39 pm    Post subject: Reply with quote

Could try:

Code:

#var result {}

#foreach {$enemy[%*]} {tmp} {#var result $result|$tmp}

#replace result {^|}

#action {{$result}} { ... }
Back to top
View user's profile Send private message Send e-mail
ixle



Joined: 15 Sep 2011
Posts: 158
Location: United States

PostPosted: Wed Dec 03, 2014 12:03 am    Post subject: Reply with quote

Scandum wrote:
Could try:

Code:

#var result {}

#foreach {$enemy[%*]} {tmp} {#var result $result|$tmp}

#replace result {^|}

#action {{$result}} { ... }


That's some straight up ninja foo right there.
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 346

PostPosted: Wed Dec 03, 2014 7:34 am    Post subject: Reply with quote

O_O

seems like I need to update some of my scripts !!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help 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