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

Achaea composer

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
titeuf



Joined: 29 Jul 2006
Posts: 84

PostPosted: Sat Jan 26, 2008 7:51 am    Post subject: Achaea composer Reply with quote

This is very mud specific (tested on achaea, but I think it should work with other IRE muds too).
Whenever you get in the composer it captures all the text and opens it in vim, which is a lot nicer than the builtin composer.

Code:

#ACT {^ -*-  Composer  -*-                  (*help for help)^} {
   #SYSTEM {rm tmpfile};
   
   #ACT {^Type *more to display more...^} {
      #NOP This trigger makes sure we capture the full text and not only the first part;
      #SEND *more;
      #GAGLINE;
   };
   
   #ACT {^There is no more.^} {
      #NOP We captured the whole text, let's delete our temporary triggers...;
      #UNACT {^Type *more to display more...^};
      #UNACT {^There is no more.^};
      #UNACT {~\e[33m%%%1>\e[37m\e[32m %%%2};
      #UNACT {~\e[33m%%%1>\e[37m\e[32m^};
      
      #NOP ...and launch vim;
      #SYSTEM {vim tmpfile};
      
      #NOP let's tell the mud to clear the whole text in the composer and reread it from our tmpfile;
      #SEND *clear;
      #SEND yes;
      #TEXTIN tmpfile;
      #SEND *save;
      
      #GAGLINE;
      
      #NOP and fix the mess that vim made out of our terminal;
      #DELAY 0 {
         #SHOWME {\e=\e[?1h};
         #NOP use whatever split you use here;
         #SPLIT 7 1;
         #NOP I use this to redraw my prompt, you probably don't need this;
         #SHOWME {$prompt} {1};
      };
   };

   #NOP those two triggers actually captures the text, one for empty lines and another for normal lines;   
   #ACT {~\e[33m%%1>\e[37m\e[32m^} {
      #LOGLINE tmpfile { };
      #GAGLINE;
   } {0};
   
   #ACT {~\e[33m%%1>\e[37m\e[32m %%2} {
      #LOGLINE tmpfile {%%2};
      #GAGLINE;
   } {1};
   
   #SEND *more;
}


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


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Jan 27, 2008 10:54 am    Post subject: Re: Achaea composer Reply with quote

It might be possible to handle this a bit nicer using classes:

Also, it might help to use '#buffer end' after the #split to restore the last page of text as well.

Code:

#if {"$composing" == "?composing"} {#var composing 0}

#ACT {^ -*-  Composer  -*-                  (*help for help)^}
{
   #SYSTEM {rm tmpfile};

   #var composing 1;
   #read composer.tin;
   #var composing 0;

   #SEND *more
}

#class composer open

#ACT {^Type *more to display more...^}
{
   #GAGLINE;
}

#ACT {^There is no more.^}
{
   #class composer kill;

   #SYSTEM {vim tmpfile};

   #SEND *clear;
   #SEND yes;
   #TEXTIN tmpfile;
   #SEND *save;

   #GAGLINE;

   #DELAY {0}
   {
      #SHOWME {\e=\e[?1h};
      #NOP use whatever split you use here;
      #SPLIT 7 1;
      #NOP I use this to redraw my prompt, you probably don't need this;
      #SHOWME {$prompt} {1};
   }
}

#ACT {~\e[33m%1>\e[37m\e[32m^}
{
   #LOGLINE tmpfile { };
   #GAGLINE;
}
{0}

#ACT {~\e[33m%1>\e[37m\e[32m %2}
{
   #LOGLINE tmpfile {%2};
   #GAGLINE;
}
{1}

#class composer close

#if {$composing == 0}
{
   #class composer kill
}
Back to top
View user's profile Send private message Send e-mail
wgoodwin



Joined: 12 Jan 2013
Posts: 6

PostPosted: Mon Feb 25, 2013 4:11 pm    Post subject: Reply with quote

Sorry for resurrecting a dead thread, but since this got me started with using my own
way of composing, I thought I'd post the code I have in case anyone else is using composer.

The advantage to this one is it doesn't use any #action/#unactions and just exists based on IRE's GMCP capabilities.

Essentially, this calls a client window of the emacs daemon and once I'm done, it outputs everything and saves it. It should be easily adaptable to the editor of your choice.

Note: The GMCP documentation for IRE MUDs has an IRE.Composer.SetBuffer command, but I found outputing directly to the composer via #TEXTIN to be somewhat cleaner. Just my two cents.

Code:

#EVENT {IAC SB GMCP IRE.Composer.Edit IAC SE} {
       #VAR GMCP[COMPOSER] {%0};
       
       #SYSTEM {echo "$GMCP[COMPOSER][text]" > tmpfile};
       #SEND {*clear};
       #SEND {y};
       #SYSTEM {emacsclient -c tmpfile};
       
       #TEXTIN {tmpfile};
       #SEND {*save};
       #SYSTEM {rm tmpfile}
}
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 -> Finished Scripts 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