| View previous topic :: View next topic |
| Author |
Message |
titeuf
Joined: 29 Jul 2006 Posts: 84
|
Posted: Sat Jan 26, 2008 7:51 am Post subject: Achaea composer |
|
|
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  |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3281
|
Posted: Sun Jan 27, 2008 10:54 am Post subject: Re: Achaea composer |
|
|
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 |
|
 |
wgoodwin
Joined: 12 Jan 2013 Posts: 6
|
Posted: Mon Feb 25, 2013 4:11 pm Post subject: |
|
|
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 |
|
 |
|