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


Joined: 20 Aug 2004
Posts: 37
Location: Illinois

PostPosted: Wed Sep 08, 2004 12:15 am   

One Final Trigger Question
 
Alright, this one may actually be a toughie, as my last few seemed (thankfully) quickly resolved and I thank you all for helping.

The MUD sends a string that can be triggered with this pattern (followed with example):

Code:
^%s%d.%d%s%d$

ie:       123499.9  0


Always 7 spaces, then any number of digits, decimal place, digit, always 2 spaces, 1 digit.

The first grouping of digits (1234) is the amount of gold I am carrying.
The second grouping of digits (99.9) is the percent of experience towards my next level.
The final digit is my off-balance time (already taken care of thanks to LightBulb's help)

Herein lies the problem: If my experience only stays in the ones place, the format changes

Code:
       123459.9  0

or

       123450.5  0


for having 9.9% and 0.5% respectively--> it drops the tens to send out less data (albeit not much). Is it possible to set up a trigger to monitor this and its changes (gold and experience)...if it's not possible, I can understand, as I can easily see how it would be hard to make a patter/split the digits. The only command I have available to me to view the experience would be SCORE and it's about a page worth of data that I don't want to trigger against and gag, because it would kill the bandwidth as well as the speed of zMUD I believe.

Thanks all in advance!
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Wed Sep 08, 2004 1:20 am   
 
How do you know that in the first example, you don't have 12349 gold and 9.9% experience? Or in the second example, how can you be sure that you don't have 1234 gold and 59.9% or 50.5% experience? I suppose this is the point of your difficulty.

If there's really no way to tell, I'd try something like this untested:
Quote:
#TR { (%d).(%d) %d} {checkgold = %left(%1,%eval(%len(%1)-1))
#IF (@checkgold>%eval(@gold+reasonable max gold gain)) {gold=%left(%1,%eval(%len(%1)-2));exp=%concat(%right(%1,2),.,%2)} {gold=%left(%1,%eval(%len(%1)-1));exp=%concat(%right(%1,1),.,%2)}
_________________
.geniusclown
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 08, 2004 6:48 pm   
 
The best I can think of is to provide both possibilities and let you figure out which is correct.
Code:
#TR {       (%d).(%d)  (%d)} {#VAR gold1 {%leftback( %1, 1)};#VAR gold2 {%leftback( %1, 2)};#VAR exp1 {%rightback( %1, 1).%2};#VAR exp2 {%rightback( %1, 2).%2}}
#ST {gold:@gold1 exp:@exp1 OR gold:@gold2 exp:@exp2}
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Thu Sep 09, 2004 2:54 am   
 
Ooo... I forgot about the %rightback and %leftback functions.
_________________
.geniusclown
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