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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Sun Oct 16, 2005 8:10 pm   

double trigger capture
 
Trying to make a trigger that will catch how many spells I have mastered from my spell list...I tried making the trigger reparse, but for some reason it makes zMUD crash....this is my current spell list and a rough idea of what it looks like and all. I can make it catch it once, but there are two spells, generally, on each line and it won't catch the second one so the number is off....any ideas?

Code:
Innate    - detect magic        (mastered)    faerie fire         (mastered)   
            faerie fog          (mastered)   
Amateur   - armor               (mastered)    change sex          (good)       
            detect buried       (mastered)    magic missile       (fair)       
            ventriloquate       (very good)   
Novice    - color spray         (superb)      continual light     (very good)   
            detect hidden       (mastered)    detect invis        (mastered)   
            fly                 (mastered)    invis               (mastered)   
Initiate  - enlarge             (superb)      giant strength      (fair)       
            identify            (mastered)    infravision         (superb)     
            shrink              (superb)      sleep               (good)       
Apprentice- acid blast          (mastered)    cancellation        (mastered)   
            mirror image        (mastered)    shield              (mastered)   
            teleport            (superb)      understand          (superb)     
Journeyman- airy water          (mastered)    charm person        (superb)     
            dispel magic        (mastered)    etherealform        (mastered)   
            haste               (average)     tongues             (superb)     
Veteran   - locate object       (good)        mass invis          (very good)   
            polymorph           (mastered)    summon              (superb)     
Expert    - detect aura         (not learned) enchant armor       (superb)     
            enchant weapon      (superb)      recharge            (good)       
Mentor    - depetrification     (not learned) gate                (superb)     
            petrification       (not learned) spell ward          (superb)     
Master    - final strike        (not learned)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Oct 16, 2005 10:40 pm   
 
I never really like playing with reparse states. Everything can be done with a single parsing state. Of course to start the whole we really need some text before the list, and something after that tells us the end has been reached. Provide those 2 things and it becomes a very simple matter.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Oct 17, 2005 12:22 am   
 
Should be fairly simple even without the boundary triggers. You will need three triggers:

1)Mentor - depetrification (not learned) gate (superb)

#trigger {({@SpellCategory})%s- ([%w%s])~(({@SpellMastery})~)([%w%s])~(({@SpellMastery})~)} {}

2) petrification (not learned) spell ward (superb)

#trigger {^%s([%w%s])~(({@SpellMastery})~)([%w%s])~(({@SpellMastery})~)} {}

3) faerie fog (mastered)

#trigger {^%s([%w%s])~(({@SpellMastery})~)%s$} {}

The boundary triggers just allow us to enable and disable this triggerset so we don't have to worry about mismatches or unnecessary trigger processing. The trick for the last two triggers is to prevent any overlap.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Mon Oct 17, 2005 2:21 pm   
 
unless i misunderstood the question, all he wants is to know how many spells he has mastered...
#alias command_to_show_that_list {#t+ mastered_count_trigger_on;#t+ mastered_count_trigger_off;#var mastered_count 0
#trigger "mastered_count_trigger_on" {~(mastered~)} {#add mastered_count 1}
#trigger "mastered_count_trigger_on" {whatever is displayed at the end of the thing} {#show I have mastered @mastered_count spells/skills;#t- mastered_count_trigger_on;#t- mastered_count_trigger_off}
_________________
http://www.Aardwolf.com
Reply with quote
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Mon Oct 17, 2005 11:04 pm   
 
Vitae, That won't work, because of the double mastered spells per line. I made something similar to that but it only caught the first so the number was off... Thanks anyway for your efforts. It is appreciated.
Reply with quote
alaric
Novice


Joined: 13 Aug 2005
Posts: 32
Location: Cherry Point, NC

PostPosted: Mon Oct 17, 2005 11:06 pm   
 
Vijilante, Couldn't you just use the Innate - for the first set of text? And then just use a blank line for the ending. I am going to attempt to plug in the script Matt made and see if it will work though. Here's hoping. :)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Oct 18, 2005 12:55 am   
 
@Alaric there is always a previous line to trigger on but here is something to try

Very rough example with limited code


#TRIGGER "master" {^Innate -} {masteredlist=0;#TEMP "endline" {^&} {#STATE master 0}}
#COND {^(*)$} {
#IF (%pos("(mastered)",%copy("%1",1,45))) {#ADD masteredlist 1}
#IF (%pos("(mastered)",%copy("%1",46,32))) {#ADD masteredlist 1}
} {reparse}
#COND {^(*)$} {
#IF (%pos("(mastered)",%copy("%1",1,45))) {#ADD masteredlist 1}
#IF (%pos("(mastered)",%copy("%1",46,32))) {#ADD masteredlist 1}
} {manual}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Tue Oct 18, 2005 3:21 pm   
 
Bleh, sorry Alaric.
for some reason i thought it would count the entire line, not just the 1st instance of it...makes sense that it WOULD count the entire line tho...*mutter*
tried a few variations as well with * and (%*), but none worked..Prolly best off with Nexela's version
_________________
http://www.Aardwolf.com
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Wed Oct 19, 2005 12:53 pm   
 
#VAR MCount 0
#VAR templist ""
#ALIAS spellsmc {templist=""; MCount=0;#T+ MasterCounter;spell list command}
#TR "MasterCounter" {(*)} {#VAR templist {%replace( %replace( %replace( %1, "(", ""), ")", ""), " ", "|"))};#FORALL @templist {#IF (%i="mastered") {#ADD MCount 1}}} "" {disable}
#TR {^$} {#T- MasterCounter;#SH %ansi(white)You have mastered @MCount spells!}

Syntax Colourizer
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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