Proper Use of %pos to track eqbal from prompt in Zmud?

TheophorusTheophorus Member Posts: 4
edited December 2012 in Tech Talk
Damn these questions are a useful means of getting basic scripting info for nubs like me.


currentmana= %2
currentendurance= %3
currentwillpower= %4
blood= %5
#IF %pos( 'e', %6) {equilibrium = 1} {equilibrium = 0}
#IF %pos( 'b', %6) {balance = 1} {balance = 0}

The patterns return the values fine from prompt but the %pos is not updating pre-existing equilibrium/balance variables.  This leads me to believe that syntactically there is something wrong with my eq and bal checking #if lines, probably related to my unfamiliarity with the %pos command.  What did I do wrong?
Post edited by Theophorus on

Best Answer


  • EdhainEdhain Member Posts: 81 ✭✭✭
    It's been a long time since I used zMUD, I recall it being a lot less finicky than CMUD but now that I use CMUD I tend to side with denigrating everything very exactly because she is a very finicky lady. First, I dunno if the apostrophes actually work as quotes, it doesn't seem as though they do in CMUD. Second, the qualifier can be entirely distinguished with parenthesis. Third, if I was using CMUD I would be super exact with changing my variables instead of just using the equal sign (#var equilibrium 1 rather than equilibrium=1), but I don't remember that mattering in zMUD at all.

    So, maybe try: #if (%pos( "e", %6)) {equilibrium=1} {equilibrium=0}

    I hope that works, and good luck with it if it doesn't. Coding can be funky and teaching it to yourself can be awkward. I've been in the same position.

    Also for future reference, coding questions likely belong in Tech Talk.

  • TheophorusTheophorus Member Posts: 4
    edited December 2012
    Thanks, will try that. 

    Also, thought this was tech-talk.  I had that section open when I 'asked a question'.  Still getting used to this forum interface.  Maybe a mod can move it?

    And for the record, adding brackets and changing the single quote to double-quote marks didn't really work.  Pattern is still firing, variables aren't being updated when I use secrets to knock myself off EQ.

    Lines now look like:

    #IF (%pos( "e", %6)) {equilibrium=1} {equilibrium=0}
    #IF (%pos( "b", %6)) {balance = 1} {balance = 0}
  • TheophorusTheophorus Member Posts: 4
    Aye, it was the prompt.
    Final solution to script problem as identified by Edhain:

    #TRIGGER {^H:(%d)%sM:(%d)%sE:(%d)~%%sW:(%d)~%%sB:(%d)~%%s~[*~]} {currenthealth=%1;currentmana= %2;currentendurance= %3;currentwillpower= %4;blood= %5;#if (%pos( e, %6)) {equilibrium=1} {equilibrium=0};#if (%pos( b, %6)) {balance=1} {balance=0}} "" {nocr|prompt}

  • ArbreArbre Arbrelina Jolie Member, Guildmaster Posts: 2,066 mod
    #IF %pos( d, %6) {#VAR deaf 1} {#VAR deaf 0}

    That's mine.
  • IstoIsto Member Posts: 47 ✭✭✭
    edited December 2012
    also. Use (%x) instead of (%*) or (%w).

    (%x) matches any character that isn't a space, so it'll match [eq] as well as [-q] and [--].

    Every once in a while (%*) seems to mess up, if I recall from using zmud, matching weird stuff when you don't think it should.

    Also, I found not enclosing %s in brackets for triggers can be a pain in the keister in zmud.
  • ArbreArbre Arbrelina Jolie Member, Guildmaster Posts: 2,066 mod
    I always used (*) not (%*)
Sign In or Register to comment.