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
Ranger_Aja
Beginner


Joined: 22 Apr 2001
Posts: 15
Location: USA

PostPosted: Mon Dec 17, 2001 11:23 pm   

String list extraction help-6.16
 
Here's the set-up:

My mud prompt looks like this with no defences up:
1120h, 1120m e-

With full defences up it would look like this:
1120h, 1120m abcdefhilopxyz[({-})]
(although this many defs at once is rare, it could be any number in any combination at any given time)

If I dont have equilibrium the letter "e" in the prompt DISAPPEARS until eq is recovered. If I dont have balance the letters "y" and/or "z" will APPEAR until balance is recovered. Also note that it is possible to not have eq while maintaining balance and vice versa. It is also possible to be off-balance to the right or left (just "y" or "z" alone.

My goal is to have variables for eq and balance that will cue other commands once eq and/or balance is recovered. I have tried using #wait commands, but running multiple #waits simultaneously keeps some other things from working properly, and lag issues also present a problem.


Under the "less is more" heading, I tried this:

#trigger {%dh, %dm [a-z]%p}
#IF (%?? = y) {
@ballence = notgot
#SHOW NO BALANCE
}
#IF (%?? = z) {
@ballence = notgot
#SHOW NO BALANCE
}
#IF (%?? <> e) {
@eqcheck = notgot
#SHOW NO EQ
}
(the #show command is just for me while testing. The ?? is what I cant figure out)

Under the "think smaller" header, i tried breaking it down into smaller bits:

#trigger {%dh, %dm [a-d]e[f-x]%p}
#variable eqcheck got
#trigger {%dh, %dm [a-d][f-x]%p}
#variable eqcheck notgot
(this doesnt work if I dont have any defences up)

#trigger {%dh, %dm [a-x]%p}
#variable ballence got
#trigger {%dh, %dm*[^yz]%p}
#variable ballence notgot
(the "notgot" part works but not the "got" part)

Can someone suggest a solution? Its probably very simple, but Im not a programmer so in this case its over my head

Thanks,
Aja of Avalon
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Dec 18, 2001 4:26 am   
 
Two things: 1. To capture the data to the parameter holder you must enclose the parameter matching symbols in parentheses. 2. I would recommend using the %pos function to check if any particular letter is in the captured string.



#TRIGGER {%dh, %dm ([a-z])%p} {
#IF %pos(e, %1) {#VAR equilibrate 1} {#VAR equilibrate 0}
#IF !(%pos(y, %1) OR %pos(z, %1)) {#VAR balanced 1} {#VAR balanced 0}
}


Troubadour
Reply with quote
Ranger_Aja
Beginner


Joined: 22 Apr 2001
Posts: 15
Location: USA

PostPosted: Tue Dec 18, 2001 5:42 pm   
 


#TRIGGER {%dh, %dm ([a-z])%p} {
#IF %pos(e, %1) {#VAR equilibrate 1} {#VAR equilibrate 0}
#IF !(%pos(y, %1) OR %pos(z, %1)) {#VAR balanced 1} {#VAR balanced 0}
}


Troubadour, you're my hero! This works perfectly. Thank you.

Aja of Avalon
Reply with quote
sepe
Novice


Joined: 09 Feb 2002
Posts: 39
Location: USA

PostPosted: Sun Apr 09, 2006 10:37 pm   
 
Heya, I tried to use this script, but am having probs. When I go off bal, and thus get the "y" in that position, it works fine. But if I just move around normal, and the next prompt comes up, it changes the balanced to 1 again. Thus, if I get the "y" it fires like it should, and it also fires the first time afterwards when balance is regained. But any movement afterr that, that DOES NOT require balance, thus no "y" it still fires as if there was a "y". Thanks
_________________
Dazed glazed and having fun
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