Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
kewlkidbrent
Beginner


Joined: 21 Mar 2009
Posts: 12

PostPosted: Mon Mar 26, 2012 3:35 am   

Multiline capture
 
There is no way to change screen width to 0 in this mudd. I can't seem to get the triggers to work without capturing everything in the game or just one line from the tells.


(*) tells you, "It's still not working for you?"
3920/3920h 445/490m 93xp >


You tell (*), "Not really"
3920/3920h 445/490m 93xp >

Those are the two things I am trying to capture and that prompt always follows. Is there a possible way I can make it capture everything to that prompt and then not capture afterwards?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Mar 26, 2012 4:19 am   
 
give us an example of a multiline tell.
_________________
EDIT: I didn't like my old signature
Reply with quote
kewlkidbrent
Beginner


Joined: 21 Mar 2009
Posts: 12

PostPosted: Mon Mar 26, 2012 6:22 am   
 
(*) tells you, "Usually saying something like that to a guy when they
really arent pay attention will work"
3920/3920h 445/490m 93xp >

Like this one?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Mar 26, 2012 9:05 pm   
 
You can use a multistate trigger. Multistate triggers are essentially multiple triggers combined into one setting that CMud internally controls the order of (this means the trigger will never mess up unless something did not match at all).

Code:
#trigger "tTellsToMe" {^(*) tells you, "(*)$} {
  Teller = %1
  TellMsg = %2
}
#condition {^(*)$} {
  #if (%match(%1,"your prompt pattern goes here")) {
    //this is the prompt that comes after the tell
   //stuff to do with said tell will go here
  #state tTellsToMe 0
  } {
    //this line is still part of the tell
    TellMsg = @TellMsg" "%1
    #if (%ends(@TellMsg,~")) {TellMsg = %leftback(@TellMsg,1)}
  }
} {manual}
_________________
EDIT: I didn't like my old signature
Reply with quote
kewlkidbrent
Beginner


Joined: 21 Mar 2009
Posts: 12

PostPosted: Wed Mar 28, 2012 3:11 am   
 
So this is what I have so far, Everything seems to work beautiful expect when it captures it only captures my prompt. While @TellMsg captures the whole tell correctly. Just not in the Tells window. I am sorry if I am just doing it incorrectly

Code:
#trigger "tTellsToMe" {^(*) tells you, "(*)$} {
  Teller = %1
  TellMsg = %2
}
#condition {^(*)$} {
  #if (%match(%1,"(%d)/(%d)h (%d)/(%d)m (%d)xp")) {
    #CAP Tells
    #Beep
  #state tTellsToMe 0
  } {
    TellMsg = @TellMsg" "%1
    #if (%ends(@TellMsg,~")) {TellMsg = %leftback(@TellMsg,1)}
  }
} {manual}
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Wed Mar 28, 2012 3:52 am   
 
Change the #CAP Tells line to #WINDOW Tells @TellMsg.
Reply with quote
kewlkidbrent
Beginner


Joined: 21 Mar 2009
Posts: 12

PostPosted: Wed Mar 28, 2012 4:54 am   
 
That Actually delays the message I receive, till the command prompt pops again. And it also doesn't display the name or in the correct font or color sadly.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4672
Location: Pensacola, FL, USA

PostPosted: Wed Mar 28, 2012 5:06 pm   
 
Code:
<trigger priority="230" id="23">
  <pattern>tells you, "</pattern>
  <value>#CAP IC-Channels
#GAG</value>
  <trigger type="Within Lines" param="1">
    <pattern>^(%w)</pattern>
    <value>#IF (%1=%lower(%1)) {
:IC-Channels:#SAYADD { %trim(%line)}
#GAG
#STATE 1
}</value>
  </trigger>
</trigger>

try that
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Mar 28, 2012 5:20 pm   
 
To get the name and capture colors, make it:
Code:

#trigger "tTellsToMe" {^((*) tells you, "(*))$} {
  TellLine = %1
  Teller = %2
  TellMsg = %3
}
#condition {^(*)$} {
  #if (%match(%1,"(%d)/(%d)h (%d)/(%d)m (%d)xp")) {
    #window Tells @TellLine
    #Beep
    #state tTellsToMe 0
  } {
    TellMsg = %concat(@TellMsg," ",%1)
    #if (%ends(@TellMsg,~")) {TellMsg = %leftback(@TellMsg,1)}
  }
} manual color

I also cleaned up a couple other bits in there. If there are particular ANSI codes in the line that are consistent every time, you could put those codes into the trigger pattern. An easy way of seeing the ANSI codes is to highlight and CTRL-C the line from the mud, use the Package Editor to create a new trigger, set the new trigger to ANSI, then paste the line into the pattern box. It should show the ANSI codes present in whatever you copied.

Could you clarify your last post? Are you saying that, using the #WINDOW command, it does not post to the Tells window until _two_ prompts show up?
Reply with quote
kewlkidbrent
Beginner


Joined: 21 Mar 2009
Posts: 12

PostPosted: Fri Mar 30, 2012 3:37 am   
 
To clarify the font and color of the tells received is different in the #window Tells than it is in the game. Not a major problem but the two major issues with it is, it doesn't multiline capture.

(*) tells you, "Happy, happy, happy, i'm so happy. City is doing well, can
actually help out with the city."

That tell became
Aurina tells you, "Happy, happy, happy, i'm so happy. City is doing well, can

Also the prompt with my health, needs to pop another time after the one following the tell for it to go to the window. As if it's delayed.


Also @shalimar your trigger actually gives me a ton of errors one about GAG being incorrect characters the incorrect paraphrases.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Mar 30, 2012 4:19 am   
 
Whoops, set the trigger options for the second state of the trigger to Trigger on Prompt (or perhaps both Trigger on Newline and Trigger on Prompt). Triggers are created with only the Trigger on Newline option set by default, and what this means is that the trigger will suspend execution until the next newline character is received. Most lines sent from the game have this character at the end of their lines so triggers matching on them execute immediately; prompt lines usually don't, and usually incorporate the newline sent with the user command.

Your trigger may also be stuck on this second state, so before testing it out you will want to use the #STATE command from the command line to set this trigger to state 0.
_________________
EDIT: I didn't like my old signature
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net