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

Input subs

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



Joined: 21 Jul 2013
Posts: 5

PostPosted: Thu Jan 22, 2015 3:11 am    Post subject: Input subs Reply with quote

So I have been trying to determine a way to substitute input mid-string. For instance:

say Hello my name is X.

The type of sub i am looking for would be replacing the s with es or ss...a manner of portraying an accent. Anyone got any ideas?
Back to top
View user's profile Send private message
sathram



Joined: 21 Jul 2013
Posts: 5

PostPosted: Thu Jan 22, 2015 3:15 am    Post subject: Reply with quote

Additional information: The replacement would be seen on the output of the say by all parties that could see it, not just on my client side, so the sub command won't work.
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 352

PostPosted: Thu Jan 22, 2015 5:14 am    Post subject: Reply with quote

First of all you should define an ALIAS called "say", so tintin will have preference over the mud command, and you can elaborate the final string before sending it to the mud.

If it's just a single character substitution this should work:
Code:

#ALIAS say {#var result {};#PARSE {%0} {char} {#IF {"$char" == "s"} {#var result {${result}SS}} {#var result {${result}$char}}};#SEND {say $result}}


typed command:
say Hello my name is X. I'm pleased to meet your Majesty.

command sent to the mud:
say Hello my name iSS X. I'm pleaSSed to meet your MajeSSty.
Back to top
View user's profile Send private message
sathram



Joined: 21 Jul 2013
Posts: 5

PostPosted: Thu Jan 22, 2015 8:37 am    Post subject: Reply with quote

Way beyond the sciprts i've ever written. Thanks though. I intend to do it with a few characters such as s, r, th, etc. Would this same command work with th or something similar to that?
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 352

PostPosted: Thu Jan 22, 2015 2:58 pm    Post subject: Reply with quote

Well actually, that script was more complex than it should Laughing

This is more simple and doesn't even have the limits of the other one:
Code:

#ALIAS say
{
#VAR result {%0};
#REPLACE {result} {s} {SS};
#SEND {say $result}
}


The result of this script is exactly the same of the previous code.

But you can also use {th} to {ze}, or {bark} to {woof}, etc...

If you need more than one substitution on the same phrase, you can add another #REPLACE after the first one
Code:

#ALIAS say
{
#VAR result {%0};
#REPLACE {result} {s} {SS};
#REPLACE {result} {th} {ze};
#REPLACE {result} {bark} {woof};
#SEND {say $result}
}


example:
say My dog barked on the street

sent to the mud:
say My dog woofed on zee SStreet
Back to top
View user's profile Send private message
sathram



Joined: 21 Jul 2013
Posts: 5

PostPosted: Thu Jan 22, 2015 5:40 pm    Post subject: Reply with quote

That one worked like a charm! Thanks a lot!
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