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
SteveThing
Beginner


Joined: 29 Aug 2010
Posts: 12

PostPosted: Mon Sep 06, 2010 4:01 am   

Having trouble with a set of triggers
 
Hello,

I'm trying to do a couple things:
1.) Create a DB of all the spells my character knows
2.) Create a list of all the spells I have memorized
3.) Pop spells from said list as I want to use them
4.) Memorize spells as a "set" (i.e. buffs or snares)

The MUD I'm on is a modified ROM mud that has some interesting changes to how spellcasting works. You get 1 spell-slot per level and must memorize a spell before you can cast it. When you memorize it, you have a chance to fail at it, so you have to try again. In order to regen your spell slots, you must sleep. So, I figured the first step would be to see what spells I have memorized are. The output of the "spell" command is as follows:

Code:

 /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~\
|            Spell Book           |    |
 \_________________________________\__/
 |                                    |
 | Permanent                          |
 | ---------                          |
 |                                    |
 | None                               |
 |                                    |
 | Memorized:                         |
 | ---------                          |
 |                                    |
 | ( 2) identify                      |
 |                                    |
 |                                    |
 /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~\
|                                 |    |
 \_________________________________\__/

You have 5 of 14 slots available for memorizing.


The "(##) Spellname" will not have "(##)" if it is the only one of those spells I have memorized. I'll sort that out once I get the below working. So I attempted to create a class of triggers:
Code:

<trigger priority="1470" id="147">
  <pattern>~|            Spell Book           ~|    ~|</pattern>
  <value>#T+ {Memorized Spells}</value>
</trigger>

<class name="Memorized Spells" enabled="false" id="146">
  <trigger priority="1310" id="131">
    <pattern>You have &amp;spellslot_avail of &amp;spellslot_total slots available for memorizing.</pattern>
    <value>#T- {Memorized Spells}</value>
  </trigger>
  <var name="memorized_spells" type="String" id="145"/>
  <trigger priority="1480" id="148">
    <pattern>^ ~| ~($number~) $spell_name ~|</pattern>
    <value>#loop $number {%push($spell_name,@memorized_spells)}
#show @memorized_spells</value>
  </trigger>
  <trigger priority="1490" id="149">
    <pattern>^ ~| None                               ~|</pattern>
    <value>#var memorized_spells {}</value>
  </trigger>
</class>


Only problem is, the trigger to push new spells to my list does not fire. I'm a bit frustrated. I've tried everything I can think of to get this working.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Sep 06, 2010 3:32 pm   
 
A few things:

1)not sure that CMud will retain and thus match multiple whitespace characters in a pattern. Use %s instead (ie, ~|%sSpell Book%s~|%s~|).

2)&amp; is probably invalid.

3)Though you can use $temporary variables in a trigger pattern, you can only do so as named parameters. You still need to provide the wildcards and stuff to match the parts of the line you want. For example, "($number:%d)"

NOTE: to capture ANY data in a trigger pattern, you must surround it in parentheses.
_________________
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