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


Joined: 28 Oct 2001
Posts: 10
Location: Canada

PostPosted: Thu Feb 28, 2002 1:19 am   

trigger/variable question
 
Hello all,

This is probably gonna seem like child's play to most here, but I'm not great when it comes to programming and dealing with variables.

I play Empire (wraith.aplus.net:4000) and they use a multiple coin system. I can make simple triggers, (you are hunrgy, eat food, etc). But what I want to do is drop a certain amount of coins that I pick up.

The mud output is set up like this:

There were 181 platinum, 5 gold, 6 silver and 28 copper coins.

What I'd like to do(if possible) is have 1 trigger to filter out all these coin combinations and only drop the copper coins(least valuable and heavy to carry). I can make my character(s) drop the copper coins (using *, %d and %1 variables). Right now I have one trigger for each combination of coins(16 combinations if I calcluate right). Now I'm sure there is a more efficicent quicker way to do this.

Could some one kindly guide me as to how to do this easier?

Thanks for any and all suggestions.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Feb 28, 2002 1:54 am   
 
Sure, you don't need to create a trigger for every possible combination, just create one pattern that matches all. Example:
#TRIGGER {There were * and (%d) copper coins.} {drop %1 copper}

If you don't get any copper coins, the trigger pattern won't match and nothing will happen. if you do get some copper coins, no matter what combination of the others you get, there will always be the "and # copper coins." text and the trigger will fire.

Kjata
Reply with quote
jeeperv6
Beginner


Joined: 28 Oct 2001
Posts: 10
Location: Canada

PostPosted: Thu Feb 28, 2002 2:08 am   
 
Ok. That's how I'm basically set up right now. But the thing is sometimes it's multiple combinations of coins.

Ex:

I kill a wild hippogriff. Empire says: There were 2 gold and 2300 copper coins.

I kill a wood elf. Empire says:
There were 5 gold, 3 silver and 96 copper coins.


I'm set up now with like 16 different triggers. * gold, and (%d) copper. * platinum, * silver and (%d) copper. Depending on the combination I get, Zmud has to sift through all these triggers and sometimes it doesn't catch the combinations correctly or I haven't covered every combination.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Feb 28, 2002 1:05 pm   
 
But the trigger I posted should match both of your cases and other combinations of gold (present/not present), silver (present/not present), etc. Actually, I only suggest removing one word from what I posted:
#TRIGGER {There were*(%d) copper coins.} {drop %1 copper}

This works because it doesn't care what comes after "There were" and before "# copper coins." it just cares that both of these strings are there. Then it looks at the number right before "copper coins." and drops that much copper coins.

Kjata
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