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


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Thu Jun 17, 2004 5:45 pm   

More Achaea Trigger problems
 
Achaea in true normally painful fashion is once again causing hassles, why Bloody Matt cant just put in clean %cr and such is absolutely beyond me but anyways.
Here is the things Im talking about:

With a final tug, you finish reeling in the line and land a walleye weighing 19
pounds and 7 ounces!

With a final tug, you finish reeling in the line and land a walleye weighing 19 pounds and 7 ounces!

7200h, 6721m ex- With a final tug, you finish reeling in the line and land a walleye weighing 19 pounds and 7 ounces!

What I have been trying to do is capture the two numbers. The first as you can see is pounds and the second ounces.
The middle one is easy and just captured by:

#tr {(%d) pounds and (%d) ounces} {#math ozconvert (%1/16);#math ozweight (@ozcovert+%2}}

The problem is the first and last ones which can move 1-5 words either up or down onto the second line depending on the fish name. If pounds gets on the first line and ounces on the second I cant catch the info. Obviously there is a way, I am just not experienced enough with Zmud to do it.

Any help would be G R E A T L Y appreciated!

Amylon
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Jun 17, 2004 8:06 pm   
 
Yeah pester Achaea into allowing users to set wordwrap prefs :P But your best bet would be to use 2 triggers Also you can clean up your math a little bit :p Also you will need to clean up the fish alias to make it use your muds commands etc. other stuff should be obvious as well

#CLASS fish
#TR {(%d) pounds} {pounds=%1}
#TR {(%d) ounces} {OzWeight=%eval(@pounds/16+%1));pounds=0;#T- fish}
#TR {You fail to catch anything} {#t- fish}
#CLASS 0
#ALIAS fish {#t+ Fish;~fish}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jun 17, 2004 9:34 pm   
 
I hate to nitpick, but...
#TR {(%d) pound} {#VAR pounds %1}
#TR {(%d) ounce) {#MATH ounces ((@pounds * 16) + %1);#VAR pounds 0}

1 pound equals 16 ounces, not the other way around.
Reply with quote
Amylon
Novice


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Fri Jun 18, 2004 12:12 pm   
 
Yep Nexela that would work a treat except silly Achaea can wrap with the number on one line and the word on the next. Oh well I will just create an alias to manually add the numbers to the variables. Thanks anyways :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jun 18, 2004 3:34 pm   
 
Given what you know about these lines, you can probably manage this using a set of triggers to match each possible line-break.

#TR {land * weighing (%d) poun[ds] and (%d) ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}
#TR {land*$*weighing (%d) poun[ds] and (%d) ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}
#TR {land * weighing$(%d) poun[ds] and (%d) ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}
#TR {land * weighing (%d)$poun[ds] and (%d) ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}
#TR {land * weighing (%d) poun[ds]$and (%d) ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}
#TR {land * weighing (%d) poun[ds] and$(%d) ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}
#TR {land * weighing (%d) poun[ds] and (%d)$ounc[es]!} {#VAR pounds %1;#MATH ounces ((16 * %1) + %2)}

NOTES:
1. I used [ds] and [es] so that the pattern will match either "pound" or "pounds" and either "ounce" or "ounces".
2. I assumed that any space which occured at a line-break would be dropped. If this is wrong, you'll have to adjust the patterns accordingly.
3. If you are interested in the type of fish, you can put parentheses around the *'s. Don't forget to change the formulae to %2 and %3. In one case there are two *'s for the fish, with a lne-break between them, so you would need to change the formula to %3 and %4.
4. One possibility you haven't mentioned is that you might catch a fish which weighs less than one pound. If you did, would it weigh "0 pounds and 11 ounces" or just "11 ounces"? Similarly, if you happen to catch a fish which weighs an exact number of pounds will it weigh "3 pounds and 0 ounces" or just "3 pounds"? If "0" pounds or ounces isn't shown, you'll need additional triggers.

All in all, an alias is a lot simpler.
Reply with quote
Amylon
Novice


Joined: 31 Jan 2003
Posts: 49
Location: Australia

PostPosted: Fri Jun 18, 2004 8:18 pm   
 
I did it like this if anyone is interested, the final lines at catching are:

You reel in the last bit of line and your struggle is over. You've landed a
catfish weighing 11 pounds and 4 ounces.
So I did this

#tr {You reel in the last bit of line} {#T+ FISHCAP;#wait 3000;#T- FISHCAP}
#CLASS FISHCAP
#tr {(%d) pounds} {pounds=%1}
#tr {weighing (%d)} {pounds=%1}
#tr {(%d) ounces} {#MATH ounces ((16 * @pounds) + %1);#add fweight @ounces;#MATH kgs ((@ounces*28)/1000);#ADD kilos @kgs}
#tr {and (%d)} {#MATH ounces ((16 * @pounds) + %1);#add fweight @ounces;#MATH kgs ((@ounces*28)/1000);#ADD kilos @kgs}
#class 0
Reply with quote
remus
Wanderer


Joined: 06 Jul 2002
Posts: 53
Location: Australia

PostPosted: Tue Aug 09, 2005 3:43 pm   
 
Ok I have it all working but I want it to be more accurate.
How do I convert it so it will show decimal places in kilos?

This is what I have but it doesnt work.
Code:

#TR {(%d) pounds} {Fishing/pounds=%1;#MATH Fishing/kgs (%format( 2, @Fishing/pounds)*454/%format( 2, 1000))}
[/code]
_________________
Once the Known was unknown now its Known...
Do you know it???
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