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
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 04, 2004 6:59 am   

Working on a wizard
 
I have gotten throughly fed up with people asking about multiline triggers so I started working on this wizard. Now, after a few days and rough progress on the pattern builder, I think it is time to get some input on it before I get locked in to doing things in a less than logical order. Also I am about ready to post a few feature requests for wizards and a few bug reports. The missing features I am reasonably sure I have coded around, and the main bug is in the use of the "check" type. Currently if multiple items in the same check have the same text selecting one selects both. I guess Zugg internally does checklist then converts it, works alright just going to confuse someone. Anyhow try to break it some and give me a few ideas.

------Cut to file here------
[Generic Multiline Trigger]
Author=Vijilante
Version=0.1
Date=03/27/04
Start=%exec(%literal(#ALIAS TildeIt {Temp="";#IF (%ascii(%clip)=34) {#NOOP %clip(%delete(%clip,1,1))};#WHILE (%clip) {Temp=%additem(%ascii(%clip),@Temp);#NOOP %clip(%delete(%clip,1,1))};Temp1="";#FORALL @Temp {#IF (%pos(%char(%i),"|@#$%^&*[]{}()<>?'`;:.,!")) {Temp1=%additem(126,@Temp1);Temp1=%additem(%i,@Temp1)} {#IF (%i=126) {Temp1=%additem(%i,@Temp1);Temp1=%additem(%i,@Temp1)} {#IF (%i=34) {Temp1=%additem(126,@Temp1);Temp1=%additem(%i,@Temp1)} {Temp1=%additem(%i,@Temp1)}}}};Temp1=%concat("%char(",%replace(@Temp1,"|",")%char("),")")};#ALIAS ListConv {Temp2=%replace(%expand(@Temp1,1),"%char(32)","|%char(32)|");Temp2=%replace(%expand(@Temp2,1),"%char(126)%char(124)","");Temp2=%subregex(%expand(@Temp2,1),"\%char\(126\)\%char\((\d+)\)","|%if(%pos(%char(%%1),~~"#`'?.,:;!~~"),,~~"%char(126)~~")~~~~%char(%%1)|");#DELITEM Temp2 {};Temp3=%numitems(%expand(@Temp2,1));#WHILE (@Temp3) {#IF (%isnumber(%eval(%item(%expand(@Temp2,1),@Temp3)))) {#WHILE ((%item(%expand(@Temp2,1),%eval(@Temp3-1))="%char(44)")&(%isnumber(%eval(%item(%expand(@Temp2,1),%eval(@Temp3-2)))))) {Temp2=%replaceitem(%concat(%item(%expand(@Temp2,1),%eval(@Temp3-2)),"%char(44)",%item(%expand(@Temp2,1),@Temp3)),@Temp3,%expand(@Temp2,1));#ADD Temp3 -1;#DELNITEM Temp2 @Temp3;#ADD Temp3 -1;#DELNITEM Temp2 @Temp3}};#IF ((%item(%expand(@Temp2,1),@Temp3)="%char(32)")&(%item(%expand(@Temp2,1),%eval(@Temp3-1))="%char(32)")) {Temp2=%replaceitem("2 spaces",@Temp3,%expand(@Temp2,1));#ADD Temp3 -1;#DELNITEM Temp2 @Temp3};#WHILE ((%item(%expand(@Temp2,1),%eval(@Temp3-1))="%char(32)")&(%ends(%item(%expand(@Temp2,1),@Temp3),"spaces"))) {Temp2=%replaceitem(%concat(%eval(%word(%item(%expand(@Temp2,1),@Temp3),1)+1)," spaces"),@Temp3,%expand(@Temp2,1));#ADD Temp3 -1;#DELNITEM Temp2 @Temp3};#ADD Temp3 -1};Temp2=%replace(%expand(@Temp2,1),"|%char(32)|","%char(32)|")};#FUNCTION LookAhead {%if(%eval(%1+1)>%numitems(%expand(@{Answer%2.Pass@{Temp3}},1)),%if(%eval(@Temp3+1)<=@{Answer%2.Passes},%ismember("1",@{Answer%2.Ans%eval(@Temp3+1)}),1),%ismember(%eval(%1+1),@{Answer%2.Ans@{Temp3}}))};#ALIAS Patternize {Temp3=1;Temp4=0;Temp5="^";#WHILE (@Temp3<=@{Answer%1.Passes}) {#LOOP %numitems(%expand(@{Answer%1.Pass@{Temp3}},1)) {#IF (%ismember("%i",@{Answer%1.Ans@{Temp3}})) {#IF (%match(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%d spaces")=1) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%s");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i));#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}}} {#IF ((%ends(%expand(@Temp5,1),"*")=0)&(%ends(%expand(@Temp5,1),"%x")=0)) {#IF ((@LookAhead(%i,%1))|(%if(%2,@LookAhead(%i,%2),0))|(@Temp4=1)) {Temp2="";#IF (%match(%eval(%replace(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(126)",""),"%char(32","")),"(%p)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(126)",""),"%char(32)",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%p");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""};#IF (@Temp2="") {#IF (%match(%eval(%replace(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(126)",""),"%char(32)","")),"(?)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(126)",""),"%char(32",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"?");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""}};#IF (@Temp2="") {#IF (%match(%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)","")),"(%d)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%d");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""}};#IF (@Temp2="") {#IF (%match(%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)","")),"(%n)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)",""),"%char(44)",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%n");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""}};#IF (@Temp2="") {#IF (%match(%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)","")),"(%w)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%w");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""}};#IF (@Temp2="") {#IF (%match(%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)","")),"(%a)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%a");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""}};#IF (@Temp2="") {#IF (%match(%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)","")),"(%x)",Temp2)=1) {#IF (@Temp2=%eval(%replace(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)",""))) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%x");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {Temp2=""}} {Temp2=""}};#IF (@Temp2="") {#IF (%match(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"(%d spaces)",Temp2)=1) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%s");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}}};#IF (@Temp2="") {Temp5=%concat(%expand(@Temp5,1),"MATCHING ERROR:",%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i))};#IF (%ends(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)")) {Temp5=%concat(%expand(@Temp5,1)," ")}} {#NOOP LookAhead not selected;#IF (%ends(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)")=0) {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"%x");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}} {#IF (%2) {#IF ((@Temp4=0)&(%ismember("%i",@{Answer%2.Ans@{Temp3}}))) {Temp4=1;Temp5=%concat(%expand(@Temp5,1),"(")}};Temp5=%concat(%expand(@Temp5,1),"*");#IF (%2) {#IF ((@Temp4=1)&!(@LookAhead(%i,%2))) {Temp4=0;Temp5=%concat(%expand(@Temp5,1),")")}}}}} {#NOOP Current not selected;#IF ((%ends(%item(%expand(@{Answer%1.Pass@{Temp3}},1),%i),"%char(32)"))&(%ends(%expand(@Temp5,1),"%x"))) {Temp5=%concat(%expand(@Temp5,1)," ")}}}};#ADD Temp3 1};Temp5=%concat(%expand(@Temp5,1),%char(36))};#ALIAS CheckBuild {#VAR {Answer%1} "";#ADDKEY {Answer%1} Passes 1;Temp3=0;Temp5="";#FORALL %expand(@Temp2,1) {Temp5=%additem("%i",%expand(@Temp5,1));#ADD Temp3 1;#IF (@Temp3=31) {#ADDKEY {Answer%1} {Pass@{Answer%1.Passes}} {%expand(@Temp5,1)};#ADDKEY {Answer%1} {Val@{Answer%1.Passes}} {0};Temp5="";Temp3=0;#ADDKEY {Answer%1} Passes {%eval(@{Answer%1.Passes}+1)}}};#IF (@Temp3) {#ADDKEY {Answer%1} {Pass@{Answer%1.Passes}} {%expand(@Temp5,1)};#ADDKEY {Answer%1} {Val@{Answer%1.Passes}} {0};Temp5="";Temp3=0} {#ADDKEY {Answer%1} Passes {%eval(@{Answer%1.Passes}-1)}};#ADDKEY {Answer%1} Current 0};#ALIAS CheckStep {#IF (@PatLoopDir) {#ADDKEY {Answer%1} Current {%eval(@{Answer%1.Current}-1)}} {#ADDKEY {Answer%1} Current {%eval(@{Answer%1.Current}+1)}}};#ALIAS CheckRecord {Temp5="";#ADDKEY {Answer%1} {Val@{Answer%1.Current}} {%2};#IF (%2) {Temp6=%2;#LOOP 32 {#IF (%mod(@Temp6,2)) {#ADDITEM Temp5 {%i}};Temp6=%eval(@Temp6/2)}};#ADDKEY {Answer%1} Ans@{Answer%1.Current} {@Temp5};#IF (@{Answer%1.Passes}>@{Answer%1.Current}) {%1} {Temp4=0;Temp3=1;#WHILE (@Temp3<=@{Answer%1.Passes}) {#IF (@{Answer%1.Ans@{Temp3}}) {#ADD Temp4 1};#ADD Temp3 1};#IF (@Temp4) {%if(%3,%3,0)} {99};PatLoopDir=1;#ADDKEY {Answer%1} Current {%eval(@{Answer%1.Current}+1)}}};Temp="";Temp1="";Temp2="";Temp3=0;Temp4=0;Temp5="";Temp6=0;PatLoopDir=0;VarFirstFull=0;VarFirstPart=0;SubFirst=0;CapFirst=0))

Param1=Please give me an example line indicating the start of the capture.
Type1=string
Validate1=%clip("$1
Comment=closing quote and paranthesis left off to help with trailing tildes and other bad characters
Convert1=%exec(%literal(TildeIt;%expand(@Temp1,1);ListConv;CheckBuild 3))

Param2=What do you want to do with your first trigger line?
Type2=check:Capture to window|Capture all to variable|Capture parts to variables|Change how it is displayed
Next2=%exec(%literal(PatLoopDir=0;#ADDKEY Answer3 Current 0;#IF (%mod($2,2)) {CapFirst=1};#IF (%mod(%eval($2/2),2)) {VarFirstFull=1};#IF (%mod(%eval($2/4),2)) {VarFirstPart=1;Answer6=%expand(@Answer3,1)};#IF (%mod(%eval($2/8),2)) {SubFirst=1}))

Param3=What words in your example line are always the same? %exec(%literal(CheckStep 3))
Type3=check:%exec(%literal(@{Answer3.Pass@{Answer3.Current}};PatLoopDir=1))
Default3=@{Answer3.Val@{Answer3.Current}}
Next3=%exec(%literal(PatLoopDir=0;CheckRecord 3 $3))

Param4=What ID do you want to give your trigger? It must be unique.%exec(%literal(PatLoopDir=1))
Type4=string
Validate4=%if(%trigger("$4")!=-1,0,1)
Next4=%if(@SubFirst,0,%if(@VarFirstPart,%exec(%literal(PatLoopDir=0;#ADDKEY Answer6 Current 0;6)),%if(@CapFirst,7,%if(@VarFirstFull,8,9))))

Param5=What kind of changes do you want to make to the display of the line?
Type5=check:Color portions|Remove portions|Reorder portions|Color whole line|Don't display whole line
Validate5=%if($5>16,0,%if(%bitand($5,8),%if(%mod($5,2),0,1),1))
Next5=%if((%bitand($5,7))|(@VarFirstPart),%exec(%literal(PatLoopDir=0;#ADDKEY Answer6 Current 0;6)),%if(@CapFirst,7,%if(@VarFirstFull,8,9)))

Param6=What words in your example line are getting %if(@SubFirst,"modified")%if(@VarFirstPart,%if(@SubFirst,"/")"captured")? %exec(%literal(CheckStep 6))
Type6=check:%exec(%literal(@{Answer6.Pass@{Answer6.Current}};PatLoopDir=1))
Default6=@{Answer6.Val@{Answer6.Current}}
Next6=%exec(%literal(PatLoopDir=0;CheckRecord 6 $6 %if(@CapFirst,7,%if(@VarFirstFull,8,9))))

Param7=What window would you like to capture to?
Type7=checklist:%additem("Other window",%delitem(%window,%names))
Validate7="$7"
Convert7=%if(%ismember("Other window","$7"),%exec(%literal(Temp2="$7";Temp5="!";#WHILE (%if(@Temp5="",0,%if(%if(%match(@Temp5,"(%a)",Temp6))@Temp6!=@Temp5,1,0))) {Temp5=%prompt("","Enter new window name")};#IF (@Temp5="") {#DELITEM Temp2 {Other window}} {Temp2=%replace(@Temp2,"Other window",@Temp5)};@Temp2)),$7)
Next7=%if(@VarFirstFull,8,9)

Param8=What is the name of the variable you would like to use for the whole first line?nPath character not accepted. Must be unique.
Type8=string
Validate8=%if(%match("$8","[a-zA-Z]")!=1,0,%if(%if(%match("$8","(%a)",Temp2))@Temp2!="$8",0,%if(%defined(@Temp2),0,1)))

Param9=Generated starting pattern please make an necessary changes.n%eval(%replace("$1","%char(126)",""))
Type9=string
Default9=%exec(%literal(Patternize 3 %if((%if(@SubFirst,%bitand($5,7),0))|(@VarFirstPart),6);@Temp5))

Param99=No words selected!
Type99=message:Since you didn't select any of the words you should seekrnhelp at the zMud General Forum.
Command99=#URL {http://www.zuggsoft.com/forum/forum.asp?FORUM_ID=7}

Command=#ECHO $9
------End cut------
Now it is time to fix all my scripts that use %lastdir and actually mud a little[8D].

Oh yeah, just to be really different I have practically written this whole thing in notepad. Just infrequent changes done in the settings editor when a section was recalcitrant. Those checks got even more infrequent the more twisted the script got, the pretty printer just hates meSad
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Apr 07, 2004 11:03 pm   
 
Guess no one has any suggestions. I will just go on then. Hopefully I can get it all put together in another week.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 07, 2004 11:49 pm   
 
Sorry Vijilante, I didn't mean to ignore you, but when I read the post I said "Oh My God!" and a cold shiver went through my spine. It's just very intimidating to look at. I'm not surprised the pretty printer has issues with it (you can't edit trigger wizards with the pretty printer anyway).

My guess is that you probably just need to post it for people to download and respond to any issues that come up.

Nice to see people "pushing the edge" Smile
Reply with quote
Rainchild
Wizard


Joined: 10 Oct 2000
Posts: 1551
Location: Australia

PostPosted: Wed Apr 07, 2004 11:50 pm   
 
Dude that is just wrong ... I can't believe that first line takes up a page and a half of my screen! :)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Apr 08, 2004 4:19 am   
 
Scary part is that is just the first few steps of processing to turn any text into a workable trigger. My only concern is that I have to break up the questions that go into making the trigger because I don't have a clear hook into the user hitting the Previous button. The only way I could hook it was to provide a question that didn't care about the user selection too much. I don't wan't to resort to memos this early, as in 2 questions, but in any case most of that just defines a few aliases meant to handle the processing. I already expect to call them enough that I have worked them to be rather general.

I am using an %exec(%literal(actual script)) form almost everwhere since this allows clean use of quotes, braces, brackets, tildes and everything else exactly where they belong. So far the only major quirk of doing that part was the quad tildes in a %subregex to get 2 tildes into the alias.

In any case I am more concerned about making a logical progression to the questions than anything else. I have done multiline captures for myself in enough ways that I can do them in my sleep, and make all the decesions in any order that I want without missing a beat. However I think the goal of the wizard is more to teach people about what is possible and how to do it. If I am jumping around just to best the contraints of the wizard system then it is harder for someone else to learn from. The main constraint I have now is the lack of any function that lets the wizard know the Previous button was hit, but I am sure that can be gotten around without resorting to a memo and without throwing in a silly question. My attempts at meeting those goals are already falling into disarray. Having 4 pieces of duplicate code is 3 too many for me. I know there is a path through that meets all the goals, but I can't find it.

Heck, I haven't even checked that the forums pasted what I wrote so far correctly. No matter what I am giving a few days for my brain to play with it in the background. Work has just been a bear. I am just fishing for thoughts from every one else that answers these types of questions, from newbs that have no clue how much information is really needed. Hint, hint Lightbulb!. Glad to know my intial post just kinda hit people as a shock instead of being one of those, "Gawd, I can't even be bothered to look at this," things.

Anyway mudding some was good Cool. Maybe my brain will get back to rights and I can answer questions in the General Forum correctly, I know I have been off.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Thu Apr 08, 2004 2:15 pm   
 
Well, I for one think it looks great just the way it is. Should work like a charm!



Psych! I just reread that first post for the 10th time, and it looks *to me* like a randomly-picked drive space dump.
I'm not even sure what it is that's being asked. Wish I had the ability to help but this is way beyond me.

I'd love to use the wizard though when you get it polished and published.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 08, 2004 4:18 pm   
 
Sorry, Vijilante, I haven't even really looked at this. It got my usual reaction to posts which are too wide for my screen: a quick scan to see what it's about and move on.

I'll take a more detailed look today.

(hint: if you used leading spaces in functions most of those long lines would have somewhere to wrap)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Apr 08, 2004 7:09 pm   
 
Spaces inserted in the places I thought wouldn't affect the script. You can cut-and-paste to the original post to fix the wordwrap problem.

[Generic Multiline Trigger]
Author=Vijilante
Version=0.1
Date=03/27/04
Start=%exec( %literal( #ALIAS TildeIt {Temp = "";#IF (%ascii( %clip) = 34) {#NOOP %clip( %delete( %clip, 1, 1))};#WHILE (%clip) {Temp = %additem( %ascii( %clip), @Temp);#NOOP %clip( %delete( %clip, 1, 1))};Temp1 = "";#FORALL @Temp {#IF (%pos( %char( %i), "|@#$%^&*[]{}()<>?'`;:.,!")) {Temp1 = %additem( 126, @Temp1);Temp1 = %additem( %i, @Temp1)} {#IF (%i = 126) {Temp1 = %additem( %i, @Temp1);Temp1 = %additem( %i, @Temp1)} {#IF (%i = 34) {Temp1 = %additem( 126, @Temp1);Temp1 = %additem( %i, @Temp1)} {Temp1 = %additem( %i, @Temp1)}}}};Temp1 = %concat( "%char(", %replace( @Temp1, "|", ")%char("), ")")};#ALIAS ListConv {Temp2 = %replace( %expand( @Temp1, 1), "%char(32)", "|%char(32)|");Temp2 = %replace( %expand( @Temp2, 1), "%char( 126)%char( 124)", "");Temp2 = %subregex( %expand( @Temp2, 1), "\%char\(126\)\%char\((\d+)\)", "|%if( %pos( %char( %%1), ~~"#`'?.,:;!~~"), , ~~"%char( 126)~~")~~~~%char( %%1)|");#DELITEM Temp2 {};Temp3 = %numitems( %expand( @Temp2, 1));#WHILE ( @Temp3) {#IF (%isnumber( %eval( %item( %expand( @Temp2, 1), @Temp3)))) {#WHILE ((%item( %expand( @Temp2, 1), %eval( @Temp3 - 1)) = "%char( 44)") & (%isnumber( %eval( %item( %expand( @Temp2, 1), %eval( @Temp3 - 2)))))) {Temp2 = %replaceitem( %concat( %item( %expand( @Temp2, 1), %eval( @Temp3 - 2)), "%char( 44)", %item( %expand( @Temp2, 1), @Temp3)), @Temp3, %expand( @Temp2, 1));#ADD Temp3 -1;#DELNITEM Temp2 @Temp3;#ADD Temp3 -1;#DELNITEM Temp2 @Temp3}};#IF ((%item( %expand( @Temp2, 1), @Temp3) = "%char( 32)") & (%item( %expand( @Temp2, 1), %eval( @Temp3 - 1)) = "%char( 32)")) {Temp2 = %replaceitem( "2 spaces", @Temp3, %expand( @Temp2, 1));#ADD Temp3 -1;#DELNITEM Temp2 @Temp3};#WHILE ((%item( %expand( @Temp2, 1), %eval( @Temp3 - 1)) = "%char( 32)") & (%ends( %item( %expand( @Temp2, 1), @Temp3), "spaces"))) {Temp2 = %replaceitem( %concat( %eval( %word( %item( %expand( @Temp2, 1), @Temp3), 1) + 1), " spaces"), @Temp3, %expand( @Temp2, 1));#ADD Temp3 -1;#DELNITEM Temp2 @Temp3};#ADD Temp3 -1};Temp2 = %replace( %expand( @Temp2, 1), "|%char( 32)|", "%char( 32)|")};#FUNCTION LookAhead {%if( %eval( %1 + 1) > %numitems( %expand( @{Answer%2.Pass@{Temp3}}, 1)), %if( %eval( @Temp3 + 1) <= @{Answer%2.Passes}, %ismember("1", @{Answer%2.Ans%eval( @Temp3 + 1)}), 1), %ismember( %eval( %1 + 1), @{Answer%2.Ans@{Temp3}}))};#ALIAS Patternize {Temp3 = 1;Temp4 = 0;Temp5 = "^";#WHILE (@Temp3 <= @{Answer%1.Passes}) {#LOOP %numitems( %expand(@{Answer%1.Pass@{Temp3}}, 1)) {#IF (%ismember( "%i", @{Answer%1.Ans@{Temp3}})) {#IF (%match( %item( %expand(@{Answer%1.Pass@{Temp3}}, 1), %i), "%d spaces") = 1) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand(@Temp5,1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%s");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i));#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}}} {#IF ((%ends( %expand( @Temp5, 1), "*") = 0) & (%ends( %expand( @Temp5, 1), "%x") = 0)) {#IF ((@LookAhead(%i,%1))|(%if( %2, @LookAhead(%i,%2), 0))|(@Temp4 = 1)) {Temp2 = "";#IF (%match( %eval( %replace( %replace( %item( %expand(@{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 126)", ""), "%char( 32", "")), "(%p)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 126)", ""), "%char( 32)", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%p");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""};#IF (@Temp2 = "") {#IF (%match( %eval( %replace( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 126)", ""), "%char( 32)", "")), "(?)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %replace( %item( %expand(@{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 126)", ""), "%char( 32", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "?");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""}};#IF (@Temp2 = "") {#IF (%match( %eval( %replace( %item( %expand(@{Answer%1.Pass@{Temp3}}, 1), %i), "%char(32)", "")), "(%d)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char(32)", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand(@Temp5, 1), "%d");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""}};#IF (@Temp2 = "") {#IF (%match( %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", "")), "(%n)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char(32)", ""), "%char( 44)", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%n");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""}};#IF (@Temp2 = "") {#IF (%match( %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", "")), "(%w)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%w");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""}};#IF (@Temp2 = "") {#IF (%match( %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", "")), "(%a)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%a");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""}};#IF (@Temp2 = "") {#IF (%match( %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", "")), "(%x)", Temp2) = 1) {#IF (@Temp2 = %eval( %replace( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)", ""))) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%x");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {Temp2 = ""}} {Temp2 = ""}};#IF (@Temp2 = "") {#IF (%match( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "(%d spaces)", Temp2) = 1) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand ( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%s");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}}};#IF (@Temp2 = "") {Temp5 = %concat( %expand( @Temp5, 1), "MATCHING ERROR:", %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i))};#IF (%ends( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)")) {Temp5 = %concat( %expand( @Temp5, 1), " ")}} {#NOOP LookAhead not selected;#IF (%ends( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char( 32)") = 0) {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand( @Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "%x");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}} {#IF (%2) {#IF ((@Temp4 = 0) & (%ismember( "%i", @{Answer%2.Ans@{Temp3}}))) {Temp4 = 1;Temp5 = %concat( %expand(@Temp5, 1), "(")}};Temp5 = %concat( %expand( @Temp5, 1), "*");#IF (%2) {#IF ((@Temp4 = 1) & !(@LookAhead(%i,%2))) {Temp4 = 0;Temp5 = %concat( %expand( @Temp5, 1), ")")}}}}} {#NOOP Current not selected;#IF ((%ends( %item( %expand( @{Answer%1.Pass@{Temp3}}, 1), %i), "%char(32)")) & (%ends( %expand( @Temp5, 1),"%x"))) {Temp5 = %concat( %expand( @Temp5, 1), " ")}}}};#ADD Temp3 1};Temp5 = %concat( %expand( @Temp5, 1), %char( 36))};#ALIAS CheckBuild {#VAR {Answer%1} "";#ADDKEY {Answer%1} Passes 1;Temp3 = 0;Temp5 = "";#FORALL %expand( @Temp2, 1) {Temp5 = %additem( "%i", %expand( @Temp5, 1));#ADD Temp3 1;#IF (@Temp3 = 31) {#ADDKEY {Answer%1} {Pass@{Answer%1.Passes}} {%expand( @Temp5, 1)};#ADDKEY {Answer%1} {Val@{Answer%1.Passes}} {0};Temp5 = "";Temp3 = 0;#ADDKEY {Answer%1} Passes {%eval( @{Answer%1.Passes}+1)}}};#IF (@Temp3) {#ADDKEY {Answer%1} {Pass@{Answer%1.Passes}} {%expand( @Temp5, 1)};#ADDKEY {Answer%1} {Val@{Answer%1.Passes}} {0};Temp5 = "";Temp3 = 0} {#ADDKEY {Answer%1} Passes {%eval( @{Answer%1.Passes} - 1)}};#ADDKEY {Answer%1} Current 0};#ALIAS CheckStep {#IF (@PatLoopDir) {#ADDKEY {Answer%1} Current {%eval( @{Answer%1.Current} - 1)}} {#ADDKEY {Answer%1} Current {%eval( @{Answer%1.Current} + 1)}}};#ALIAS CheckRecord {Temp5 = "";#ADDKEY {Answer%1} {Val@{Answer%1.Current}} {%2};#IF (%2) {Temp6 = %2;#LOOP 32 {#IF (%mod( @Temp6, 2)) {#ADDITEM Temp5 {%i}};Temp6 = %eval( @Temp6/2)}};#ADDKEY {Answer%1} Ans@{Answer%1.Current} {@Temp5};#IF (@{Answer%1.Passes} > @{Answer%1.Current}) {%1} {Temp4 = 0;Temp3 = 1;#WHILE (@Temp3 <= @{Answer%1.Passes}) {#IF (@{Answer%1.Ans@{Temp3}}) {#ADD Temp4 1};#ADD Temp3 1};#IF (@Temp4) {%if( %3, %3, 0)} {99};PatLoopDir = 1;#ADDKEY {Answer%1} Current {%eval( @{Answer%1.Current} + 1)}}};Temp = "";Temp1 = "";Temp2 = "";Temp3 = 0;Temp4 = 0;Temp5 = "";Temp6 = 0;PatLoopDir = 0;VarFirstFull = 0;VarFirstPart = 0;SubFirst = 0;CapFirst = 0))

Param1=Please give me an example line indicating the start of the capture.
Type1=string
Validate1=%clip( "$1
Comment=closing quote and paranthesis left off to help with trailing tildes and other bad characters
Convert1=%exec( %literal( TildeIt;%expand( @Temp1, 1);ListConv;CheckBuild 3))

Param2=What do you want to do with your first trigger line?
Type2=check:Capture to window|Capture all to variable|Capture parts to variables|Change how it is displayed
Next2=%exec( %literal( PatLoopDir = 0;#ADDKEY Answer3 Current 0;#IF (%mod( $2, 2)) {CapFirst = 1};#IF (%mod( %eval( $2/2), 2)) {VarFirstFull = 1};#IF (%mod( %eval( $2/4), 2)) {VarFirstPart = 1;Answer6 = %expand( @Answer3, 1)};#IF (%mod( %eval( $2/8), 2)) {SubFirst = 1}))

Param3=What words in your example line are always the same? %exec( %literal( CheckStep 3))
Type3=check:%exec( %literal( @{Answer3.Pass@{Answer3.Current}};PatLoopDir = 1))
Default3=@{Answer3.Val@{Answer3.Current}}
Next3=%exec( %literal( PatLoopDir = 0;CheckRecord 3 $3))

Param4=What ID do you want to give your trigger? It must be unique.%exec( %literal( PatLoopDir = 1))
Type4=string
Validate4=%if( %trigger( "$4") != -1, 0, 1)
Next4=%if( @SubFirst, 0, %if( @VarFirstPart, %exec( %literal( PatLoopDir = 0;#ADDKEY Answer6 Current 0;6)), %if( @CapFirst, 7, %if( @VarFirstFull, 8, 9))))

Param5=What kind of changes do you want to make to the display of the line?
Type5=check:Color portions|Remove portions|Reorder portions|Color whole line|Don't display whole line
Validate5=%if( $5 > 16, 0, %if( %bitand( $5, 8), %if( %mod( $5, 2), 0, 1), 1))
Next5=%if(( %bitand( $5, 7))|(@VarFirstPart), %exec( %literal( PatLoopDir = 0;#ADDKEY Answer6 Current 0;6)), %if( @CapFirst, 7, %if( @VarFirstFull, 8, 9)))

Param6=What words in your example line are getting %if( @SubFirst, "modified")%if( @VarFirstPart, %if( @SubFirst, "/")"captured")? %exec( %literal( CheckStep 6))
Type6=check:%exec( %literal( @{Answer6.Pass@{Answer6.Current}};PatLoopDir = 1))
Default6=@{Answer6.Val@{Answer6.Current}}
Next6=%exec( %literal( PatLoopDir = 0;CheckRecord 6 $6 %if( @CapFirst, 7, %if( @VarFirstFull, 8, 9))))

Param7=What window would you like to capture to?
Type7=checklist:%additem( "Other window", %delitem( %window, %names))
Validate7="$7"
Convert7=%if( %ismember( "Other window", "$7"), %exec( %literal(Temp2 = "$7";Temp5 = "!";#WHILE (%if( @Temp5 = "", 0, %if( %if( %match( @Temp5, "(%a)", Temp6))@Temp6 != @Temp5, 1, 0))) {Temp5 = %prompt( "", "Enter new window name")};#IF (@Temp5 = "") {#DELITEM Temp2 {Other window}} {Temp2 = %replace( @Temp2, "Other window", @Temp5)};@Temp2)), $7)
Next7=%if( @VarFirstFull, 8, 9)

Param8=What is the name of the variable you would like to use for the whole first line?nPath character not accepted. Must be unique.
Type8=string
Validate8=%if( %match( "$8", "[a-zA-Z]") != 1, 0, %if( %if( %match( "$8", "(%a)", Temp2))@Temp2 != "$8", 0, %if( %defined( @Temp2), 0, 1)))

Param9=Generated starting pattern please make an necessary changes.n%eval( %replace( "$1", "%char( 126)", ""))
Type9=string
Default9=%exec( %literal( Patternize 3 %if( (%if( @SubFirst, %bitand( $5, 7), 0))|(@VarFirstPart), 6);@Temp5))

Param99=No words selected!
Type99=message:Since you didn't select any of the words you should seekrnhelp at the zMud General Forum.
Command99=#URL {http://www.zuggsoft.com/forum/forum.asp?FORUM_ID=7}

Command=#ECHO $9
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