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
desait
Newbie


Joined: 26 Feb 2012
Posts: 3

PostPosted: Sun Feb 26, 2012 12:58 am   

Trigger:? Find whats missing
 
When i type look self or look X player I can get to see their equipped weapons and armors .

I need to create a trigger of some sort, that will read their equipped slots and tell me if a slot is empty
For example I have to know if they are not wearing anything around their legs, fast, so i can aim there.

Code:
You are using:
<worn on finger>     an obsidian ring (brand new)
<worn on finger>     a golden ring with a large moonstone (brand new)
<worn around neck>   a leather strap with cyan beads (superb)
<worn around neck>   a twisted blue root, curled into a necklace (superb)
<worn as symbol>     a fiery red sword
<worn on body>       a diamond cuirass engraved with a rose (brand new)
<worn on head>       a tanso-steel armet engraved with golden flames (superb)
<worn on legs>       a series of hinged greaves enveloped in white silk (brand new)
<worn on feet>       some tall black boots clasped with white iron (brand new)
<worn on hands>      the chieftain's beaded handwraps (brand new)
<worn on arms>       the chieftain's beaded sleeves (brand new)
<worn about body>    rock-studded cape emblazoned with boulders (superb)
<worn about waist>   a thick plate fauld wrapped in white silk (brand new)
<worn around wrist>  (Glowing) a steel studded leather wrist brace (superb)
<worn around wrist>  a steel studded leather wrist brace (superb)
<right hand>         a gleaming steel shield (brand new)
<left hand>          a small razor-edged wheel of engraved bone (brand new)


and when I type look X I get
Code:

X is using:
<worn on finger>     (Glowing) a signet ring made of gold (brand new)
<worn around neck>   the Shroud of Mithril Darkness (brand new)
<worn around neck>   a fiery ruby pendant (brand new)
<worn as symbol>     an hourglass of flowing sands
<worn on body>       a pale bodice embroidered with scrollwork (brand new)
<worn on legs>       a long skirt of gossamer silk slitted to the waist (brand new)
<worn on feet>       a pair of magenta satin slippers (brand new)
<worn on hands>      arm-length, silky purple gloves (brand new)
<worn about body>    a long cloak of carmine wool with a deep hood (very good)
<worn about waist>   a dark gold-beaded hip scarf (brand new)
<worn around wrist>  a charcoal amber-studded bracelet (superb)
<worn around wrist>  a silvery bracelet, engraved with zig-zag runes (brand new)
<right hand>         (Glowing) (Humming) a round, chained hoplite shield (very good)
<left hand>          a wand of spinning vortices



For example it could be like

<worn on legs> NOTHING
Reply with quote
N86eAL
Novice


Joined: 13 Jan 2008
Posts: 33
Location: Sweden

PostPosted: Sun Feb 26, 2012 1:56 am   
 
I guess one could do like this.
Code:

#TRIG {^<worn (*)>*NOTHING} {#ECHO Worn %1 is empty}

and
Code:

#TRIG {<(%w) hand>*NOTHING} {#ECHO %1 hand is empty}


Then just change how you want to be informed of what is empty etc.
Reply with quote
desait
Newbie


Joined: 26 Feb 2012
Posts: 3

PostPosted: Sun Feb 26, 2012 12:41 pm   
 
I am completely newbie with this.
Alright I am sorry, probably I wasn't clear.

When you wear something on the head for example and you look at it, you get the
Code:

<worn on body>       some moon-crested plate mail (brand new)
<worn on head>       a tanso-steel armet engraved with golden flames (superb)
<worn on legs>       a series of hinged greaves enveloped in white silk (superb)


If you dont, then

Code:
<worn on body>       some moon-crested plate mail (brand new)
<worn on legs>       a series of hinged greaves enveloped in white silk (brand new)


The line just dissapears.
What we want to do is that it keeps the <worn on head> , and just get a message right next to it, that there is nothing there, to substitute for the non-existant slot.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Feb 26, 2012 5:49 pm   
 
First, create a datarecord variable of all the wear-location strings where the keys are the the text between <> and the values are going to be the items found there. You can do this via the Package Editor window.

Second, create the trigger to match on the X is using line. This trigger's main function is to reset the datarecord values to "nothing" so that any wear locations not seen will be already filled in.

Code:
#trigger {^({You|%w}) %w using:$} {
  #loopdb @WornEQ {
    #addkey WornEQ %key "nothing"
  }
}


Third, create the trigger to match and fill in the eq lines.

Code:
#trigger {^<([%w%s])>%s(*)$} {
  #addkey WornEQ %1 %2
  #gagspace
}


Finally, you need the first line that the mud is always going to send you after the eq list is finished (you didn't show what it was, so I'll assume it's a blank line).

Code:
#trigger {^$} {
  #gagspace
  #forall "stringlist|of|slots|in|a|particular|order" {
    #print %format("<&s>&s&s",%i,%repeat(" ",(15 - %len(%i))),@WornEQ.%i)
  }
}
_________________
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