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
leonardofaoro
Novice


Joined: 07 Feb 2008
Posts: 40
Location: Italy

PostPosted: Sat Feb 20, 2010 3:21 pm   

Spell List Check
 
My affection list looks like that:

SPL: (15 min) martial arts sets MARTIAL-ARTS
SPL: ( innate ) bless +35 to Move-regen
SPL: ( innate ) bless +5 to Hitroll
SPL: ( innate ) infravision sets INFRA
SPL: ( innate ) detect invisibility sets DET-INVIS
SPL: ( innate ) dodge sets DODGE
SPL: ( innate ) phase sets PHASE

I want to add all my affected spells into a var like this:
#tr {SPL: ~(*~) (%w*)} {#var spells %additem(%1,@spells)}

Then I want to check the @spells var if a spell is missing with an alias:
example: #IF %contains(@spells,infravision) {true, do nothing} {false, cast 'infravision}

If the previous command is possible the alias would look like this:
#ALIAS check {aff;#IF %contains(@spells,infravision) {} {cast 'infravision};#IF %contains(@spells,martial arts) {} {martial};etc...}

Is this possible to achieve?
There is a %contains function named differently?
Do you have a better idea to do this?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Feb 20, 2010 5:25 pm   
 
Use a datarecord variable where each key field is the name of a spell and the value of each key is the result. You could then #addkey/#delkey each spell by name.
_________________
EDIT: I didn't like my old signature
Reply with quote
leonardofaoro
Novice


Joined: 07 Feb 2008
Posts: 40
Location: Italy

PostPosted: Sat Feb 20, 2010 5:30 pm   
 
Good, I understood nothing but I'm fine :)
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Feb 21, 2010 3:16 am   
 
Ah ha! Here we go. What is the line immediately following that list? Do each of those spells use some sort of balance to perform?

Also how do you know the spell is missing? What does that stuff mean? To simply add to a string list use #additem.

Example:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="checkSpells" priority="30" regex="true" copy="yes">
    <pattern>^SPL: \((?:\d+ min| innate )\) (martial arts|bless|infravision|detect invisibility|dodge|phase)</pattern>
    <value>#additem spells %1</value>
  </trigger>
</cmud>


My question however would be what does the first part mean? Do the minutes mean the spell is already cast and innate mean it is missing? If so, it would be ^SPL: \( innate \) (martial arts|bless|infravision|detect invisibility|dodge|phase) instead.
Reply with quote
leonardofaoro
Novice


Joined: 07 Feb 2008
Posts: 40
Location: Italy

PostPosted: Sun Feb 21, 2010 9:43 am   
 
Innate means the spell doesn't wear off until I die or logout. 15 min is the time I have left before the spell wears off.
Out of all this info I'll mark what I need:

SPL: (15 min) martial arts sets MARTIAL-ARTS
SPL: ( innate ) bless +35 to Move-regen
SPL: ( innate ) detect invisibility sets DET-INVIS

I'm pasting the XML code of how I did achieve all this since I don't know how to export triggers in zScript format.

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger name="tspell" priority="290">
    <pattern>
      SPL: ~(*~)(%s)(&amp;spl) (%s)</pattern>
    <value>
      #var spl %replace(@spl,"  ")
      #var spells %additem(@spl,@spells)</value>
  </trigger>
  <alias name="check">
    <value>
      #T+ tspell
      #unvar spells
      affects
      #wait 2000
#if (%ismember("dodge",@spells)) {} {dodge}
#if (%ismember("martial arts ",@spells)) {} {martial}
#if (%ismember("bladedance",@spells)) {} {bladedance}
#if (%ismember("phase",@spells)) {} {phase}
#if (%ismember("sneak",@spells)) {} {sneak}
#CR
#echo "Missing SPELLS:"
#if (%ismember("sanctuary",@spells)) {} {#echo SANCTUARY}
#if (%ismember("shield ",@spells)) {} {#echo SHIELD}
#CR
#T- tspell
</value>
  </alias>
</cmud>
Reply with quote
leonardofaoro
Novice


Joined: 07 Feb 2008
Posts: 40
Location: Italy

PostPosted: Sun Feb 21, 2010 1:27 pm   
 
By the way, why do you use REGEX? Faster/better processing?
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