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
Shylmysten
Wanderer


Joined: 18 Sep 2001
Posts: 93
Location: USA

PostPosted: Fri Dec 14, 2001 10:52 pm   

Here's a good one for the Guru's
 
I have need of a trigger that will fire on anywords that are Capitolized.
I've spent a couple of hours now, trying to sort out exactly how to do this.
I tried using <%char(65)> and <%char(90)> as well as %ends and %begins to try to test the first and last character of words, but Im not quites ure how to do this, because either way, Im still going to have to take all text from the mud, and STRIP them down until I run into an Uppercase, if it begins in an uppercase, then test if the word ENDS in an uppercase and I have my trigger......erm...I think anyways, but Im not quite sure the code on this......

Alpha= {A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z}

#if %begins(@caps, @alpha ) AND %ends(@caps, @alpha))) {#say true} {#say false}

This obviously will not work, so Im thinking, how do I just STRIP the FIRST character of the word, and run an %ismember( @stripped_character, @alpha)
then follow it by stripping the LAST Character

or maybe a trigger on expression using.....

#trigger (@alpha(%w)@alpha}

Im lost on this......Any of you gurus up to the challenge?

Again, what Im wanting to do is setup a trigger that will fire anytime it receive a capitalized word........

Thanks
-Shyl-
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sat Dec 15, 2001 12:25 am   
 
quote:
Again, what Im wanting to do is setup a trigger that will fire anytime it receive a capitalized word........


That would mean that anytime a line begins with "A" (as a lot of lines will do, e.g. "A deer stands here") your trigger will fire.

Anyways that aside, I think you can do something like:

#TRIGGER {[A-Z]} {}

Be sure to mark the case sensitive on the options page too.

Another way to process a captured line:

#IF (%char(%left("%1",1)) > x AND %char(%right("%1",1)) > x) {}

Where "x" is the number of the character code where the capitals start, which I don't know, but couldn't be too hard to find out.

Acaila
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Dec 15, 2001 4:19 am   
 
Capitals Start at 65. In fact A=65, however a=96. So you should use a slightly different test if such is your aim:
#IF (%upper(%left("%1",1)) = %left("%1",1)) {}
Of course if you want to test the whole word it is even easier.
Reply with quote
Shylmysten
Wanderer


Joined: 18 Sep 2001
Posts: 93
Location: USA

PostPosted: Sat Dec 15, 2001 4:48 am   
 
Okay this is what I got for a test, and it will replace all spaces
Only one problem........it only checks the first 2 characters of the sentance
it doesnt go and check the end, middle or anything else, any one else got Ideas



#trigger {(%*)} {
#if ((%char(90) >=
%char(%left(%replace(@caps, " ",), 1))) AND (%char(%left(%replace(@caps, " ",),
1)) >= %char(65)) AND (%char(90) >= %char(%right(%replace(@caps, " ",), 1)))
AND (%char(%right(%replace(@caps, " ",), 1)) >= %char(65)))) {#If
(%char(%left(%replace(@caps, " ",), 1)) = %char(65) AND
%char(%right(%replace(@caps, " ",), 1)) = %char(65)) {Do nothing cause it is an
A by itself} {execute commands}} {#say false}}



-shyl-
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Sat Dec 15, 2001 6:35 am   
 
Try this:

#TRIGGER {(*)} {#T- blah;#VARIABLE temp %replace(%replace(%replace("%1", ",", ""), ".", ""), " ", "|");#FORALL @temp {#VARIABLE counter 1;#VARIABLE foundcap 1;#IF (%len(%i)>1) {#WHILE (@counter<=%len(%i)) {#VARIABLE temp2 %rightback(%left(%i, @counter), 1);#IF (@temp2>="A" and @temp2<="Z") {} {#VARIABLE foundcap 0;#ABORT};#ADD counter 1};#IF (@foundcap) {#ECHO %i}}};#T+ blah} "blah"

Change the part in red to whatever it is you wanted to do w/the all caps words.

Iljhar
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