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


Joined: 11 Jun 2009
Posts: 16

PostPosted: Mon Jul 27, 2009 10:10 pm   

Trigger problems. Maybe I need to use regex?
 
Ok, so I'll start off by showing an example of text from the mud:

A watchman is one west, a door northeast of one east and one southeast, a jovial priestess, a prayerful woman, a troll bodyguard and a grasping trader are one east and one southeast, the limit of your vision is one east and one southeast from here, a dirty pigeon and a short troll are two west and the limit of your vision is two west from here.

What I want to do is have it grab all npc names and echo them with their respective directions. I have:

#TRIGGER {({@npcs}){s|es|} {and*|}{is|are} ({@numbers}) ({@directions}), {^@numbers}} {#ECHO <color red>%1: @numbers.%2 %3.</color>}
#TRIGGER {({@npcs}){s|es|} {and*|}{is|are} ({@numbers}) ({@directions}) and ({@numbers}) ({@directions}){,| and the limit of your vision}} {#ECHO <color red>%1: @numbers.%2 %3, @numbers.%4 %5.</color>}
#TRIGGER {({@npcs}){s|es|} {and*|}{is|are} ({@numbers}) ({@directions}), ({@numbers}) ({@directions}) and ({@numbers}) ({@directions}){,| and the limit of your vision}} {#ECHO <color red>%1: @numbers.%2 %3, @numbers.%4 %5, @numbers.%6 %7.</color>}
#TRIGGER {({@npcs}){s|es|} {is|are} ({@numbers}) ({@directions}) and the limit of your vision} {#ECHO <color red>%1: @numbers.%2 %3.</color>}

I have three variables

#VAR directions {north|west|east|south|northeast|southeast|southwest|northwest}
#VAR numbers {two=2|one=1|three=3|four=4|five=5} A database here just to make it echo 1 instead of one, 2 instead of 2 etc.
Last is a string list of all the npcs I would need, called @npcs.

This works fairly well for me. The problem is that there are so many different possibilities:

Npc1 is one east,
Npc1 is one east, one southeast,
Npc1 is one east, one southeast, one east,
Npc1 and Npc2 are one east, etc..
Npc1, Npc2 and Npc3 are one east, etc..
And so on.

It seems like there would be a way to display ALL the npcs, even when they're in the same room, where at the moment it only displays the last one for me.
Another thing to note is someone else tried this and it does things slightly differently. For example:

A bodyguard and a trader are one east

For me this would echo trader: 1 east. For the other person it echos bodyguard: 1 east. Not sure why. I have 3.08 and she has 2.36 though, maybe they're processing it differently.

I would really appreciate any help on this. I can't really think of any way to improve it without making separate triggers for every possible scenario, though it seems like that might cause more problems than it would fix.

Thanks in advance!
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