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
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Jul 10, 2010 10:02 pm   

[322B] Problem with #TEMP trigger (Again)
 
This problem has been around (on and off) since 2.14
The temporary trigger gets added to the settings and won't function as intended.
There are previous threads on this problem for different versions of CMUD. I thought the problem was fixed since it's been a long time since the problem has cropped up, but it is back. I encountered the problem in my live sessions so I decided to test it in a blank session. Here is the code:
Code:


<window name="untitled">
  <uid>{189D4896-7EAC-4B2B-A43D-3D30FD973F19}</uid>
  <packages>untitled</packages>
  <alias name="show" id="1">
    <value>#SHOW "------------------------- ---   ----  -----  -----"
#SHOW "Abomination               404     1%           137"
#SHOW "Acid wave                  83     1%           106"
#SHOW "Awakening                 426     1%           104"
#SHOW "Awareness                 501     1%            46"
#SHOW "Banshee wail              170     1%             1"
#SHOW "Blades of light           328     1%           154"
#SHOW "Blazing fury              473     1%           149"
#SHOW "Charm person               15     1%            24"
#SHOW "Chill touch                16     1%             1"
#SHOW "Condemn                   396     1%            15"
#SHOW "Cone of cold              172     1%            49"
#SHOW "Conjure elemental         149     1%            60"
#SHOW "Continual light            18     1%             1"
#SHOW "Create holy symbol        159     1%            37"
#SHOW "Cure critical              24     1%            33"
#SHOW "Cure light                 26     1%             1"
#SHOW "Damnation                 402     1%           111"
#SHOW "Detect evil                31     1%             1"
#SHOW "Detect good                32     1%             1"
#SHOW "Detect hidden              33     1%             1"
#SHOW "Detect invis               34     1%             1"
#SHOW "Detect magic               35     1%             1"
#SHOW "Exotic                    419     1%             1"
#SHOW "Fire                        1     1%            23"
#SHOW "Fire breath                84     1%            87"
#SHOW "Fireball                   45     1%            18"
#SHOW "Flame arrow               173     1%            38"
#SHOW "Glare                     394     1%             1"
#SHOW "Hand of justice           163     1%            53"
#SHOW "Holy arrow                454     1%            69"
#SHOW "Holy fury                 393     1%             1"
#SHOW "Holy strike               472     1%           121"
#SHOW "Holy word                 165     1%           131"
#SHOW "Ice cloud                  85     1%            72"
#SHOW "Infernal voice            397     1%            26"
#SHOW "Kick                      218     1%             1"
#SHOW "Knock                     411     1%           101"
#SHOW "Lay hands                 228     1%             1"
#SHOW "Lightning bolt             60     1%            32"
#SHOW "Locate corpse             240     1%            94"
#SHOW "Mace                      204     1%             1"
#SHOW "Minor creation            176     1%            12"
#SHOW "Mobshield                 456     1%             4"
#SHOW "Panic                     323     1%           117"
#SHOW "Pillar of fire            399     1%            58"
#SHOW "Poison                     66     1%             1"
#SHOW "Polearm                   205     1%             1"
#SHOW "Prismatic spray           177     1%            14"
#SHOW "Purgatory                 405     1%           143"
#SHOW "Purify                    337     1%            67"
#SHOW "Repentance                400     1%            86"
#SHOW "Globe of invulnerability  174    73%           157"
#SHOW "Aim                       338    75%            18"
#SHOW "Camp                      246    75%           121"
#SHOW "Cancellation               10    75%            20"
#SHOW "Charge                    267    75%            53"
#SHOW "Cleansing                 158    75%            27"
#SHOW "Cure poison                27    75%            17"
#SHOW "Disarm                    213    75%            21"
#SHOW "Dispel magic               38    75%            10"
#SHOW "Disrupt                   412    75%           116"
#SHOW "Enchant armor              40    75%            33"
#SHOW ""
#SHOW "You have 0 training sessions available."
#SHOW "You have 22 practice sessions available."</value>
  </alias>
  <alias name="bldpl" id="2">
    <value>llist = ""
;;
#CALL %vartype( llist, 4)
;;
#T+ gsptrig
;;
#STATE gsptrig 0
;;
show</value>
  </alias>
  <trigger name="gsptrig" priority="124750" regex="true" id="4">
    <pattern>^-{25}\s*-{3}\s*-{4}\s*-{5}\s*-{5}$</pattern>
    <value>#TEMP {^You have \d+ practice sessions left\.$} {splproc}  "" "notrig|regex"</value>
    <trigger type="Loop Lines" param="600" regex="true">
      <pattern>^(?:[^\d]+)([^\s]+)\s*([^%]+)</pattern>
      <value>$db = ""
;;
$db.Name = %1
$db.Sn   = %2
;;
#ADDITEM llist $db</value>
    </trigger>
  </trigger>
  <alias name="splproc" id="6">
    <value>#T- gsptrig</value>
  </alias>
</window>

You will notice that after you run bldpl the temporary trigger will appear in the settings as a permanent trigger. The exit script (splproc) is never invoked because the pattern for the #TEMP trigger is wrong. However, this is no reason to create the trigger as a permanent setting.
_________________
Sic itur ad astra.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jul 12, 2010 4:40 pm   
 
Temporary triggers are always displayed in the settings screen. That isn't a bug. This allows you to edit or remove a temporary trigger. The difference between a temporary trigger and a normal trigger is that a temporary trigger is not saved to your session *.pkg file.

I just confirmed that this is working fine with a simple test:

1) Run CMUD, Create a new session (call it "Test")
2) On the command line, type:
#TEMP {Hello world} {#SHOW This is a temp trigger}
3) Open the Settings Editor and verify that the trigger is shown. This is normal.
4) Close CMUD
5) Re-open CMUD and load the Test session created above
6) Open the Settings Editor to show that the temp trigger does not exist
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Jul 12, 2010 11:21 pm   
 
A few other notes.
Your second state for the gsptrig has a type of "Loop Lines", that should be a Loop Pattern.
The pattern on the second state is wrong for the sample lines you provided, a better pattern would be
Code:
^(?:(You have \d+)|(\w++(?: \w++)*)\s+(\d+))

With that changed pattern you can eliminate the #TEMP trigger instead doing '#IF (%1) {#T- gsptrig;#EXIT}'; and your captures for name and sn would be %2 and %3 respectively.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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