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

Allow one received line to trigger multiple actions

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
Helden



Joined: 02 Jan 2015
Posts: 13

PostPosted: Thu Feb 12, 2015 4:32 am    Post subject: Allow one received line to trigger multiple actions Reply with quote

I think that can be helpful that one received line can trigger multiple actions

Example:
Code:
#action {aaa} {#showme {RECEIVED AAA}}
#action {bbb} {#showme {RECEIVED BBB}}


Code:
#echo {zzzzz aaa}

triggers correctly

Code:
#echo {zzzzz bbb}

triggers correctly

but
Code:
#echo {zzzzz aaa zzzzz bbb zzzz}

It triggers only one action.
I would like it triggers both.

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


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Thu Feb 12, 2015 6:39 pm    Post subject: Reply with quote

Would

Code:

#echo {zzzzz aaa zzzzz bbb zzzz aaa}

trigger 3 times?

If you really need this behavior you could use a substitution and have it trigger a function.

Code:

#sub {aaa} {aaa@echo{RECEIVED AAA}}

#function echo {#showme {%0};#return}


I can't change the behavior as it would break too many scripts, and I can't add a config option for it as that would make scripts incompatible.
Back to top
View user's profile Send private message Send e-mail
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Fri Feb 13, 2015 5:30 am    Post subject: Reply with quote

Scandum wrote:

I can't change the behavior as it would break too many scripts, and I can't add a config option for it as that would make scripts incompatible.


Speaking with total ignorance about the actual code, but maybe an added function (like #NEXTACTIONS) can preserve compatibility

Code:


#action {blah}
{
#echo {blah};
#NEXTACTIONS;
} {1}

#action {blah blah}
{
#echo {blah blah}
} {2}



If you use it in an action then the parsing will continue from there, until the actions are finished or an action without #NEXTACTIONS is triggered, as it always did.

edit: corrected the echo in the code
Back to top
View user's profile Send private message
Helden



Joined: 02 Jan 2015
Posts: 13

PostPosted: Fri Feb 13, 2015 1:09 pm    Post subject: Reply with quote

Scandum wrote:
Would

Code:

#echo {zzzzz aaa zzzzz bbb zzzz aaa}

trigger 3 times?

This is not my actual case but could be.
Quote:

If you really need this behavior you could use a substitution and have it trigger a function.

Code:

#sub {aaa} {aaa@echo{RECEIVED AAA}}

#function echo {#showme {%0};#return}


I can't change the behavior as it would break too many scripts, and I can't add a config option for it as that would make scripts incompatible.

I lost you in this. Can you explain me better your idea and/or your code?
Then just one clarification:
In my example I put #echo to simulate a line received by the MUD.
Actually I need to trigger 2 actions over the same line received by the MUD.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Feb 14, 2015 11:49 am    Post subject: Reply with quote

Multiple substitutions can trigger per line, and substitutions can call functions (see #help function) which in turn behave kind of like an alias.
Back to top
View user's profile Send private message Send e-mail
Helden



Joined: 02 Jan 2015
Posts: 13

PostPosted: Thu Feb 19, 2015 1:51 am    Post subject: Reply with quote

Ok. Clear.
Definitely must try this!

Thanks
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 -> Feature Requests 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