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


Joined: 09 Dec 2007
Posts: 58

PostPosted: Wed Feb 27, 2008 4:53 pm   

two line variables
 
ok, still having problems with my old script.
I expanded it a lot, but it still bugs.

The problem is: when I have #var organpress %1 %2 it won't trigger the #if's on #if organpress=a, because it's actually "a ",
but if I trigger it on #var organpress %1 %2, it won't detect #var organpress= a flat, any suggestions, please?

if you scroll down a bit, you'll find that 2=b, but it should be B flat, which it is not.
Code:
#CLASS {organ}
#ALIAS op {
  press %1 %2
  #var organpress "%1 %2"
  }
#ALIAS repeatlogic {
  #t- firstkey
  #t- secondkey
  #t- thirdkey
  #t- fourthkey
  #t- fifthkey
  #t- sixthkey
  #if {@tryingkey=1} {
    #echo made by illyism
    #t+ firstkey
    }
  #if {@tryingkey=2} {
    press @1
    #wait 2000
    #t+ secondkey
    }
  #if {@tryingkey=3} {
    press @1
    #wait 2000
    press @2
    #wait 2000
    #t+ thirdkey
    }
  #if {@tryingkey=4} {
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    #t+ fourthkey
    }
  #if {@tryingkey=5} {
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    #wait 2000
    #t+ fifthkey
    }
  #if {@tryingkey=6} {
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    #wait 2000
    press @5
    #wait 2000
    #t+ sixthkey
    }
  }
#ALIAS cleankey {
  #t+ firstkey
  #t- secondkey
  #t- thirdkey
  #t- fourthkey
  #t- fifthkey
  #t- sixthkey
  #var tryingkey 1
  #t+ misskey
  #t- misskey2
  }
#VAR organpress {a}
#VAR tryingkey {1}
#VAR Keys {a|a sharp|a flat|b|b flat|c|c sharp|d|d sharp|d flat|e|e flat|f|f sharp|g|g flat|g sharp}
#VAR 1 {f}
#VAR 2 {b}
#VAR 3 {g}
#VAR 4 {a}
#VAR 5 {f }
#VAR 6 {d}
#VAR trykey {flat}
#TRIGGER {The pipes give out a harsh hiss as if scolding your efforts.} {
  #alarm {+2}
  #if {@organpress=a} {
    #alarm {+2} {
      repeatlogic
      op d
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      repeatlogic
      op e
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      repeatlogic
      op f
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      repeatlogic
      op g
      }
    }
  #if {@organpress=e} {
    #alarm {+2} {
      repeatlogic
      op a
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      repeatlogic
      op b
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      repeatlogic
      op c
      }
    }
  }
#TRIGGER {The organ grumbles to your touch. Slightly out of tune perhaps?} {
  #alarm {+2}
  #if {@organpress=a} {
    #alarm {+2} {
      repeatlogic
      op b
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      repeatlogic
      op c
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      repeatlogic
      op d
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      repeatlogic
      op e
      }
    }
  #if {@organpress=e} {
    #alarm {+2} {
      repeatlogic
      op f
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      repeatlogic
      op g
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      repeatlogic
      op a
      }
    }
  }
#TRIGGER {The key clunks down but no sound comes from the pipes.} {
  #alarm {+2}
  #if {@organpress=a} {
    #alarm {+2} {
      repeatlogic
      op f
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      repeatlogic
      op g
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      repeatlogic
      op a
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      repeatlogic
      op b
      }
    }
  #if {@organpress=e} {
    #alarm {+2} {
      repeatlogic
      op c
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      repeatlogic
      op d
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      repeatlogic
      op e
      }
    }
  }
#TRIGGER {You grope around for the impossible note but soon give up the search.} {
  #t- misskey2
  #t+ misskey
  #if {@organpress=b} {#alarm {+2} {op b flat}}
  #if {@organpress=c} {#alarm {+2} {op c sharp}}
  #if {@organpress=e} {#alarm {+2} {op e flat}}
  #if {@organpress=f} {#alarm {+2} {op f sharp}}
  }
#TRIGGER {There is a swift, resonant inhalation of air nearby} {
  play organ
  cleankey
  op a
  }
#TRIGGER {flatkey} {
  #if {@organpress=a} {
    #alarm {+2} {
      repeatlogic
      press a flat
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      repeatlogic
      press b flat
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      repeatlogic
      press c flat
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      repeatlogic
      press d flat
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      repeatlogic
      press f flat
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      repeatlogic
      press g flat
      }
    }
  }
#TRIGGER {A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?} {#if {@trykey=flat} {#echo flatkey} {#echo sharpkey}}
#TRIGGER {sharpkey} {
  a|a sharp|a flat|b|b flat|c|c sharp|d|d sharp|d flat|e|e flat|f|f sharp|g|g flat|g sharp
  #if {@organpress=a} {
    #alarm {+2} {
      repeatlogic
      press a sharp
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      repeatlogic
      press b sharp
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      repeatlogic
      press c sharp
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      repeatlogic
      press d sharp
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      repeatlogic
      press f sharp
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      repeatlogic
      press g sharp
      }
    }
  }
#CLASS 0
#CLASS {organ|firstkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var 1 @organpress
  #alarm {+2} {
    #t+ secondkey
    #t- firstkey
    #var tryingkey 2
    op a
    }
  }
#CLASS 0
#CLASS {organ|secondkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var 2 @organpress
  #alarm {+2} {
    #t+ thirdkey
    #t- secondkey
    #var tryingkey 3
    op a
    }
  }
#CLASS 0
#CLASS {organ|thirdkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var 3 @organpress
  #alarm {+2} {
    #t+ fourthkey
    #t- thirdkey
    #var tryingkey 4
    op a
    }
  }
#CLASS 0
#CLASS {organ|fourthkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var 4 @organpress
  #alarm {+2} {
    #t+ fifthkey
    #t- fourthkey
    #var tryingkey 5
    op a
    }
  }
#CLASS 0
#CLASS {organ|fifthkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var 5 @organpress
  #alarm {+2} {
    #t+ sixthkey
    #t- fifthkey
    #var tryingkey 6
    op a
    }
  }
#CLASS 0
#CLASS {organ|sixthkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var 6 @organpress
  #alarm {+2} {
    #t+ firstkey
    #t- sixthkey
    #var tryingkey 1
    }
  }
#CLASS 0


edit: I tried #var organpress "%1 %2" and organpress (%1 %2)
but they won't work, since it gives %2 as a default value, and then it won't find the "a" ones, seperating the lines will be a bit unfamiliar.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Feb 27, 2008 5:20 pm   
 
First try %-1 instead of "%1 %2" and see if that works.
If that doesn't help then try %concat("%1", " ", "%2")

Also you should be using #if () instead of #if {}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Wed Feb 27, 2008 6:37 pm   
 
that won't work, it will detect %1 as "a " not as "a" and so most of my triggers stop working.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Wed Feb 27, 2008 6:47 pm   
 
I'm sorry I hadn't looked at your code close enough and misunderstood your issue.

Two suggestions.

1. Use %begins(@organpress,"a") instead of @organpress=a
or
2. Use two variables instead of one or even a string list variable. The first one to hold the key and the second one to hold the modifier.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Wed Feb 27, 2008 9:39 pm   
 
got a small problem again.

@organpress = a, @organppress = sharp, at the next line @organpress changes, but @organppress stays, which interferes with the selection.
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Wed Feb 27, 2008 10:34 pm   
 
Everything works 100% now, thanks a million for everyone's help, for your patience and kindness.
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