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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Sep 28, 2004 2:05 am   

#PSUB bug?
 
Ok Trying to understand #PSUB and if Im understanding the helpfile correctly

#PSUB {Subbed} %x1 %x6
should replace everything starting from %1 and ending at %6 with Subbed right?

#TR {test (%w) (%w) (%w)} {
#PSUB {Subbed} %x1 %x2
}
#SHOW test one two three

outputs:
test one two three
when the expected output should be
test subbed three
am I correct?

And when using it with just Xstart
#TR {test (%w) (%w) (%w)} {
#PSUB {Subbed} %x1
}
#SHOW test one two three

outputs:
test subbed two three
when the expected output should be
test subbed

And going from the example in the help file
#TRIGGER {(%w) tells you} {#PSUB "[%1]" %x1}
which works like the example says but Shouldnt that just sub the whole tell line with [value of %1] because Xend is ommited and the end of the line is supposed to be used?

Am I correct in assuming that XEnd doesn't work and needs to be bug reported or am I using it wrong?

I am trying to change the format of my prompt by subbing out unnecs things but not subbing the whole line as it would lose colors depending on level of the numbers.

shortend example
#TR {HP:(%d)/(%d) (%d)~% MV:(%d)/(%d) (%d)~% GP:(%d) Pos:(%x)} {
#PSUB {%2/@hpchange} %x2 %x3
#PSUB {%5/@mvchange} %x5 %x7
} "" {prompt|nocr}

My expected output should be this
HP:123/123/0 % MV:123/123/0 Pos:Standing
but the actual output is unchanged however if I remove the XEnd this is the output
HP:123/123/0 100% MV:123/123/0 100% GP:100 Pos:Standing
It added in what I wanted but didn't remove what I *thought* the XEnd would.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Sep 28, 2004 5:44 am   
 
XEnd works.
You are wrong in your understanding of %x1. This system variable consists of two numbers separated by a space. The first number is the starting location of %1 and the second number is the ending location. Thus, %x1 already provides both XStart and XEnd. To clearly see this, try this trigger:
Code:
#TR {testing (%w) (%w) (%w)} {
#SHOW {~%x1 is %x1}
}
#SAY testing one two three


In your trigger:
Code:
#TR {test (%w) (%w) (%w)} {
#PSUB {Subbed} %x1 %x2
}

%x1 provides XStart and XEnd so %x2 is used for YStart and YEnd. If you have enough lines on your screen, you can go up about 9 lines and find where Subbed was inserted.
_________________
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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Sep 28, 2004 1:02 pm   
 
LightBulb your my hero I did misunderstand this line in the help file
The %x1..%x99 variables can be used for "XStart XEnd" to give position of patterns matched in a trigger.
I was assuming XStart AND XEnd giving the syntax at the top of the help.
but from using your example I have found a way I can overcome my problem by using just the first number of %xStart and the last number of %xEnd...

#TR {test (%w) (%w) (%w)} {
#PSUB {Subbed} %word("%x1",1) %word("%x2",2)
}
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 29, 2004 12:35 am   
 
I don't know why everyone forgets this. Everything enclosed in a set of parenthesis, in the pattern, is considered a single pararmeter.

#TR {test (%w %w) (%w)} {#PSUB {Subbed} %x1}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 29, 2004 1:00 am   
 
Vijilante-
Mainly because the actual trigger is an extremly complex prompt with 17ish values:P and three #PSUBS
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 29, 2004 3:01 am   
 
Oh, it is still probably easier to enclose wider portions with parenthesis. I think since the change over to the regex engine you can actually nest them. Doing so would probably get confusing as to what goes in %7, but still might simplify the trigger for you.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 29, 2004 12:33 pm   
 
Yeah I think Im gonna have to try that route........ because occaisionally the thing goofs when subbining across multiple parts like the screen isn't refreshing correctly (It duplicates one of the lines above it and displays everything that I PSUBBED across but not the actual Subbing or the items that were not psubbed across.) The trigger is firing correctly and If I click anywhere on the screen it goes back like it should (Psubbed correctly) And no amount of changing the refresh amounts has fixed this.. Which leads me to believe that this might actually be a display bug.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 29, 2004 12:38 pm   
 
Nope I get the same problem when enclosing in whole blocks...

But I have narrowed down the problem I have wrapping turned off in my mud and have Zmud Wrap most everything for me, which wraps my prompt After turning off autowrap and setting the column to 0 it fixes the problem I also noticed that it WASNT the stuff subbed across that was messing it up but the wrapped part of my line that was showing. But it is not a feasible solution as I want things wrapped :P. I have effectivly narrowed it down to autowrapping and its reproducable and now I feel this needs to be bug reported as (at the least) an error with #PSUB handling zmud wrapped lines.


Edit: Weee Playing with the #WRAP command and even though it has drawbacks It seems to do the job fair enough. Still though time to Idea a #NOWRAP command :P
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 29, 2004 3:18 pm   
 
Isn't #WRAP 0 a nowrap command?
_________________
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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 29, 2004 7:58 pm   
 
#WRAP 0 just sets the column for autowrap to 0 but it affects ALL mud output including scrollback and incoming lines. So I am using it like this

#WRAP 0
#PSUB
#WRAP

To toggle it Off and then On.
My Idea for a #NOWRAP command is just to NOT wrap the line that triggered it Kind of like how #GAG acts.
_________________
Zmud Support Library
Zmud Knowledge Base
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