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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Thu Aug 27, 2009 7:22 am   

[3.10a] Text being received during loop.
 
-Update- This seems to be an issue with #show and #mxp and not related to the loop itself.

-Update- I believe the issue to be resolved. Adding a %cr at the beginning of #send or #mxp seems to have been the answer.

I have a script that runs at the end of a list of players. It's supposed to add some info about player locations before the prompt. The issue is that the next line is being received and displayed after the loop in my trigger executes once before it finishes entirely. This is the only trigger firing, I made sure with the script debugger. I'll try to duplicate this with a more simple trigger.

Here's an excerpt from the mud. Everything above "----------Groups----------" is output from the mud, in addition to the prompt "<445/418h 418/418m 1990e 1990w <eb> <bd>> ".
Code:


        Valkar - A primal, fire-lit chamb           - (unknown)
       Viticus - Well-lit study tables       (8452) - City of Stavenn.
     Zachariah - A large, domed bedroom             - (unknown)
        Zeldia - A narrowing tunnel         (3 rms) - (multiple areas matched)
-------------------------------------------------------------------------------
There are 54 players on this plane and 7 players on other planes.
----------Groups----------
"<send 'm p 8373'>A dusty library</send>" has 2 people. (Ermesc, Makani).
<445/418h 418/418m 1990e 1990w <eb> <bd>> "<send 'm p 999'>Throneroom of the Goblin</send>" has 3 people. (Enalie, Mantlus, Morgaine).
"<send 'm p  domed bedroom'>A large</send>" has 2 people. (Ishtar, Zachariah).
"<send 'r fi A willow of soothing oas'>A willow of soothing oas</send>" has 2 people. (Mishka, Ruga).
"<send 'm p 14065'>Within an ancient librar</send>" has 2 people. (Aunalysa, Khendon).
"<send 'm p 10033'>A grim-covered bunker</send>" has 2 people. (Azyel, Kagai).
"<send 'm p 3515'>The Red Vixen Tavern</send>" has 2 people. (Raini, Scarlette).
"<send 'm p 2841'>Small road off the Shuk</send>" has 3 people. (Diaktoros, Elfrado, Serruntiss).
"<send 'm p 271'>Entering the gates of St</send>" has 2 people. (Groo, Lixan).


Here's the specific trigger
Code:
<trigger priority="26380" regex="true" id="17204">
  <pattern>^There are \d+ players on this plane.*\.$</pattern>
  <value><![CDATA[#T- {Who Sort|Who List}
#SAY ----------Groups----------
#LOOPDB @who_list {#IF (%numitems( %val) > 1)
{
$room = %item(%replace(%key,",","|"), 1)
$vnum = %item(%replace(%key,",","|"), 2)
#show {%ansi( gray)~"%ansi( yellow)<send '%if(!%null($vnum),"m p "$vnum,"r fi "$room)'>$room</send>%ansi( gray)~" has %ansi( red)%numitems( %val)%ansi( gray) people. (%ansi( purple)%replace( %val, "|", ", ")%ansi( gray)).}}
}]]></value>
</trigger>


And here's the entire class.
Code:
<class name="Who Sort" id="17201">
  <class name="Who List" initdisable="true" enabled="false" id="17202">
    <trigger priority="26360" regex="true" id="17203">
      <pattern>^\s+([A-Z][a-z]+) - (.+\w)\s+(\(\d+\))? - .+$</pattern>
      <value>#addkey who_list {%if(!%null(%3),%concat(%2,",",%3),%2)} %additem( %1, %db( @who_list, %if(!%null(%3),%concat(%2,",",%3),%2)) )</value>
    </trigger>
    <trigger priority="26380" regex="true" id="17204">
      <pattern>^There are \d+ players on this plane.*\.$</pattern>
      <value><![CDATA[#T- {Who Sort|Who List}
#SAY ----------Groups----------
#LOOPDB @who_list {#IF (%numitems( %val) > 1)
{
$room = %item(%replace(%key,",","|"), 1)
$vnum = %item(%replace(%key,",","|"), 2)
#show {%ansi( gray)~"%ansi( yellow)<send '%if(!%null($vnum),"m p "$vnum,"r fi "$room)'>$room</send>%ansi( gray)~" has %ansi( red)%numitems( %val)%ansi( gray) people. (%ansi( purple)%replace( %val, "|", ", ")%ansi( gray)).}}
}]]></value>
    </trigger>
  </class>
  <alias name="whog" id="17205">
    <value>~who %-1
#var who_list %null
#t+ {Who Sort|Who List}</value>
  </alias>
  <var name="who_list" type="Record" id="17206">A dusty library,(8373)="Ermesc|Makani"|The dusty plains,(2983)=Spidol|A small, sawdust-covered,(142)=Crlasian|The Hall of Cards,(952)=Genviere|Within the Kinsarmar Gat,(100)=Andun|Throneroom of the Goblin,(999)="Enalie|Mantlus|Morgaine"|A large, domed bedroom="Ishtar|Zachariah"|Kinsarmar's elemental me=Javon|Antioch Shuk,(605)=Alora|A gambling parlour,(601)=Airamaya|A willow of soothing oas="Mishka|Ruga"|Nearing the end of a lig,(14025)=Cyleese|East Circle, between Gho,(124)=Insinyan|Butchery,(597)=Keyakku|A quaint loft=Nyles|A primal, fire-lit chamb=Valkar|Well-lit study tables,(8452)=Viticus|Within an ancient librar,(14065)="Aunalysa|Khendon"|Entering Monarch Square,(3514)=Desari|A grim-covered bunker,(10033)="Azyel|Kagai"|The Red Vixen Tavern,(3515)="Raini|Scarlette"|Small road off the Shuk,(2841)="Diaktoros|Elfrado|Serruntiss"|Entering the gates of St,(271)="Groo|Lixan"|A bustling foundry,(10607)=Razfir|The entrance to a wide t,(11582)=Iselie</var>
  <alias name="groups" id="17207">
    <value><![CDATA[#SAY ----------Groups----------
#LOOPDB @who_list {#IF (%numitems( %val) > 1)
{
$room = %item(%replace(%key,",","|"), 1)
$vnum = %item(%replace(%key,",","|"), 2)
#mxp {%ansi( gray)~"%ansi( yellow)<send '%if(!%null($vnum),"m p "$vnum,"r fi "$room)'>$room</send>%ansi( gray)~" has %ansi( red)%numitems( %val)%ansi( gray) people. (%ansi( purple)%replace( %val, "|", ", ")%ansi( gray)).}}}]]></value>
  </alias>
  <alias name="find" id="17208">
    <value>#CR
#SAY -----------Find-----------
#LOOPDB @who_list {#IF (%ismember( %1, %val))
{#SAY {%ansi( gray)~"%ansi( yellow)%key%ansi( gray)~"%repeat( " ", 25-%len( %key)) has %ansi( red)%numitems( %val)%ansi( gray) people. (%ansi( purple)%replace( %val, "|", ", ")%ansi( gray)).}}}</value>
  </alias>
</class>


Last edited by GeneralStonewall on Thu Aug 27, 2009 9:29 am; edited 8 times in total
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Thu Aug 27, 2009 7:56 am   
 
-Deleted-


Last edited by GeneralStonewall on Thu Aug 27, 2009 8:42 am; edited 2 times in total
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Aug 27, 2009 8:36 am   
 
Well, depending on what #MXP elements you're using, you can use some #MXP with it. Otherwise, as you seem to have found out, #MXP outputs the information to the MUD just like #SAY will.

Your #SAY could have easily been done with:

#SAY "<color gray>""</color><color yellow>"%key"</color><color gray>"""%repeat ... etc

Though that is a more convoluted way of doing things. :P

However, you couldn't do:

#SAY "<send 'say hi!'>Hi!</send>" to do the same thing, so you'd have to do:

#MXP {<send 'say hi!>Hi!</send>} instead.

Charneus
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Thu Aug 27, 2009 8:49 am   
 
charneus wrote:
[...]

However, you couldn't do:

#SAY "<send 'say hi!'>Hi!</send>" to do the same thing, so you'd have to do:

#MXP {<send 'say hi!>Hi!</send>} instead.

Charneus


This is exactly what I'm trying to do. I've tested further and it appears the issue I'm having only happens when I use #mxp or #show, but not #say. According to the documentation: "The difference between #SAY and #SHOW is that #SHOW processes the text just as if it was received from the MUD." and that #mxp works similar to #show. Shouldn't this mean that when using either of these commands that cmud should output the text, check if any triggers match it, then return and finish the script before outputting any further text from the mud? The issue is that the next line is being received and displayed midway through the script. On top of that, there doesn't seem to be a version of #mxp that works like #say.

This is easily duplicatable; Here's an example. Note how the next line from the mud is displayed after the first iteration of the loop.

Code:

<trigger priority="174530" id="17453">
  <pattern>Ishtar</pattern>
  <value>#loop 5 {#show {%i}}</value>
</trigger>



Code:

         Gilot - Within dim, subterranean  (51 rms) - Warrens of Khandava.
        Iselie - Crossroads of The Imperi     (285) - City of Stavenn.
        Ishtar - A large, domed bedroom             - (unknown)
1
        Jarrhn - Within the great Library      (42) - ruins of Caanae.
2
3
4
5
       Khendon - Within an ancient librar   (14065) - City of Stavenn.
      Kurayami - The Redwood Path           (3 rms) - Khandava Council.
         Lepet - Antioch Shuk                 (605) - City of Antioch.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Thu Aug 27, 2009 9:27 am   
 
It appears starting with a %cr fixed the issue entirely. I'm still not entirely sure if this is intended or not.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Aug 27, 2009 3:16 pm   
 
GeneralStonewall wrote:

This is exactly what I'm trying to do. I've tested further and it appears the issue I'm having only happens when I use #mxp or #show, but not #say. According to the documentation: "The difference between #SAY and #SHOW is that #SHOW processes the text just as if it was received from the MUD." and that #mxp works similar to #show. Shouldn't this mean that when using either of these commands that cmud should output the text, check if any triggers match it, then return and finish the script before outputting any further text from the mud? The issue is that the next line is being received and displayed midway through the script. On top of that, there doesn't seem to be a version of #mxp that works like #say.


Ah, yes. And sadly, the documentation is misleading, as #SAY and #SHOW are pretty much alike, and if you wanted to display text without firing triggers, you'd need to use #PRINT. **I know that wasn't what you were getting at, but just some fyi.

Anyway, glad you were able to figure a workaround, though it's weird how it was acting. Hmm. When I get a chance, I may play around with it a little to see if something better can come out of it. :)

Charneus
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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