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


Joined: 22 Sep 2005
Posts: 9

PostPosted: Thu Sep 22, 2005 6:52 pm   

trigger needs to match to a list...please help
 
Hi guys,

I want to walk into a room, and have triggers set some variables if elements of a list match what is in the room. Then I need an IF/ELSE statement that does something like

if(@friend) {
say hi}
else if(@enemy) {
kick @enemy}
{otherwise neither friend nor enemy are present, so I will leave}

This is what I have:

Triggers:

*({@friendList})*
#var friend {%1} {_nodef} {matchFriend}

*({@enemyList})*
#var enemy {%1} {_nodef} {matchEnemy}
:

friendList is human|elf|dwarf
enemyList is dog|cat|horse

possible mud outputs:

A curious balcony (east, west, north)|
John the human knight
a dog

So i need to first check if "human" is in the room, and if he's not to check if "dog" is in the room...

Please help me out
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Thu Sep 22, 2005 7:30 pm   
 
Humm.... Well this could be a trigger, but I think your desired IF sequence is going to complcate things if it's going to work in all cases.

Code:
#VAR FriendList {human|elf|dwarf}
#TRIGGER {(%w) the @FriendList} {#EXEC Say Hi}


Is there any useful order on which these mobs appear? Do friends happen to always be first (wishful thinking)? Do you have a prompt or other reliably mark after this block of Mobs? Is there any sort of maximum number of mobs that can be in the room?

I'm thinking you may have to end up just grabbing all the relevant mob names from the start of the block up to the prompt storing all these values in variables and making a decision at the prompt itself to truly get the result you want here.

And do be careful, this is awful close to botting.
Reply with quote
brys0005
Newbie


Joined: 22 Sep 2005
Posts: 9

PostPosted: Thu Sep 22, 2005 7:34 pm   
 
Well, there is always a prompt, and there is no limit on the number of mobs that will appear in a room, though usually it's only a few. The only problem with your trigger, is that I need it store the element of the list (human or elf or dwarf) as a variable so I can reference it for other purposes....

As it stands right now, it appears that every time my trigger fires, it creates a _new_ variable, so I have a very long list of variables with the same name....

also, how can I clear the variables or set them to null so if(null_variable) will always be false?
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