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: Sun Jan 20, 2008 12:08 pm   

help making complex settings
 
the point of the quest.
if you press a good key it gives "As you play the key, the organ emits a pure joyous note encouraging you on."
but, if you click a wrong key you have to start over with pressing the good key, then guessing the next one.
you have 6 keys in total and every press takes balance (+2 seconds)
I have no idea how to make it so that it finds the SECOND key, after pressing the first one.
then it has to find the THIRD key, after press the first one and then the second one.
then it has to find the FOURTH key, after press 1, 2 and 3
that continues up to SIXTH.

Code:
#CLASS {organ}
#ALIAS op {
  press %1
  %1=organpress
  organpress=%1
  }
#ALIAS cleankey {
  #var keypress1 -
  #var keypress2 -
  #var keypress3 -
  #var keypress4 -
  #var keypress5 -
  #var keypress6 -
  }
#VAR organpress {a}
#VAR organsharppress {}
#VAR organflatpress {}
#VAR keypress1 {-}
#VAR keypress2 {-}
#VAR keypress3 {-}
#VAR keypress4 {-}
#VAR keypress5 {-}
#VAR keypress6 {-}
#TRIGGER {The pipes give out a harsh hiss as if scolding your efforts.} {
  #if {@organpress=a} {#alarm {+2} {op d}}
  #if {@organpress=b} {#alarm {+2} {op e}}
  #if {@organpress=c} {#alarm {+2} {op f}}
  #if {@organpress=d} {#alarm {+2} {op g}}
  #if {@organpress=e} {#alarm {+2} {op a}}
  #if {@organpress=f} {#alarm {+2} {op b}}
  #if {@organpress=g} {#alarm {+2} {op c}}
  }
#TRIGGER {} {}
#TRIGGER {The organ grumbles to your touch. Slightly out of tune perhaps?} {
  #if {@organpress=a} {#alarm {+2} {op b}}
  #if {@organpress=b} {#alarm {+2} {op c}}
  #if {@organpress=c} {#alarm {+2} {op d}}
  #if {@organpress=d} {#alarm {+2} {op e}}
  #if {@organpress=e} {#alarm {+2} {op f}}
  #if {@organpress=f} {#alarm {+2} {op g}}
  #if {@organpress=g} {#alarm {+2} {op a}}
  }
#TRIGGER {The key clunks down but no sound comes from the pipes.} {
  #if {@organpress=a} {#alarm {+2} {op f}}
  #if {@organpress=b} {#alarm {+2} {op g}}
  #if {@organpress=c} {#alarm {+2} {op a}}
  #if {@organpress=d} {#alarm {+2} {op b}}
  #if {@organpress=e} {#alarm {+2} {op c}}
  #if {@organpress=f} {#alarm {+2} {op d}}
  #if {@organpress=g} {#alarm {+2} {op e}}
  }
#TRIGGER {A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?} {
  #if {@organpress=a} {
    #alarm {+2} {
      press a sharp
      #var organsharppress a
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      press b sharp
      #var organsharppress b
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      press c sharp
      #var organsharppress c
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      press d sharp
      #var organsharppress d
      }
    }
  #if {@organpress=e} {
    #alarm {+2} {
      press e sharp
      #var organsharppress e
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      press f sharp
      #var organsharppress f
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      press g sharp
      #var organsharppress g
      }
    }
  }
#TRIGGER {You grope around for the impossible note but soon give up the search.} {
  #if {@organsharppress=a} {
    #alarm {+2} {
      press a flat
      #var organflatpress a
      }
    }
  #if {@organsharppress=b} {
    #alarm {+2} {
      press b flat
      #var organflatpress b
      }
    }
  #if {@organsharppress=c} {
    #alarm {+2} {
      press c flat
      #var organflatpress c
      press c
      }
    }
  #if {@organsharppress=d} {
    #alarm {+2} {
      press d flat
      #var organflatpress d
      }
    }
  #if {@organsharppress=e} {
    #alarm {+2} {
      press e flat
      #var organflatpress e
      }
    }
  #if {@organsharppress=f} {
    #alarm {+2} {
      press f flat
      #var organflatpress f
      }
    }
  #if {@organsharppress=g} {
    #alarm {+2} {
      press g flat
      #var organflatpress g
      }
    }
  }
#CLASS 0
#CLASS {organ|firstkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var keypress1 %lastcom
  #alarm {+2} {
    #t+ secondkey
    #t- firstkey
    }
  }
#CLASS 0
#CLASS {organ|secondkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var keypress2 %lastcom
  #alarm {+2} {
    #t+ thirdkey
    #t- secondkey
    }
  }
#CLASS 0
#CLASS {organ|thirdkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var keypress3 %lastcom
  #alarm {+2} {
    #t+ fourthkey
    #t- thirdkey
    }
  }
#CLASS 0
#CLASS {organ|fourthkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var keypress4 %lastcom
  #alarm {+2} {
    #t+ fifthkey
    #t- fourthkey
    }
  }
#CLASS 0
#CLASS {organ|fifthkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var keypress5 %lastcom
  #alarm {+2} {
    #t+ sixthkey
    #t- fifthkey
    }
  }
#CLASS 0
#CLASS {organ|sixthkey}
#TRIGGER {As you play the key, the organ emits a pure joyous note encouraging you on.} {
  #var keypress6 %lastcom
  #alarm {+2} {
    #t+ firstkey
    #t- sixthkey
    }
  }
#CLASS 0
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Jan 20, 2008 12:43 pm   
 
It'd help if you'd explain fully what the different messages mean. Your script is interpreting "The organ grumbles to your touch. Slightly out of tune perhaps?" "The pipes give out a harsh hiss as if scolding your efforts." and "The key clunks down but no sound comes from the pipes." as meaning "wrong note, try again" - which seems reasonable - but it's interpreting "A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?" as meaning "right note, but make it sharp" and "You grope around for the impossible note but soon give up the search." as meaning "right note, but make it flat".

It seems like the latter means "You've tried to press a key that doesn't exist" - for example, there's no b sharp or c flat (see wikipedia for a picture of a normal keyboard - although technically c flat is b, I can see why they wouldn't want to program it that way), and that the "slightest of mistakes" message means that it's the right note but could be either sharp or flat from that note. That means that your script will take a very long way round or perhaps even end up looping - where the script tries to press the sharp of a note, but the actual answer was the flat, it'll fail and begin again.

Is the difference between "slightest of mistakes" and "out of tune" one of degree? So a mistake of a semitone (ie, sharp-flat) will give you the "slightly" message, whereas a mistake of a tone or more will give you the "out of tune" message? That'll affect the way you detect an error when you press the sharp of a note, because it'll give the "out of tune" error should you press the sharp when the answer was the flat. And also, does the system properly understand that b and c and e and f are a semitone apart, so if you press c and the solution is b, it'll give the "slightest of mistakes" error rather than the "out of tune" one? I ask because if the system doesn't understand that pressing c flat is the same as pressing b, you'll need to script around that circumstance.

In addition, it'd be much better to use the "you can press another key" message rather than a two second alarm, to account for lag. What message does the server give for that?

My first thought is that the simplest way to solve this problem, assuming that the "out of tune" message means an error of a tone or more and that it properly understands that c flat = b, is with a simple brute-force method where you have a string list of all the possible keys:

#var Keys {c|c sharp|d|d sharp|e|f|f sharp|g|g sharp|a|a sharp|b}

Then you have a variable, @TryingKey, which is a number, beginning at 1. You decide which key to press like so:

press %item(@Keys,@TryingKey)

and then if you get the "slightest of errors" message, you know that the answer is TryingKey+1, which you then try, and if it's the answer, put in another string list:

#var CurrentTune %additem(@CurrentTune,@TryingKey+1)

If you get the "out of tune" message, you can add 2 to @TryingKey and try again.

When you want to replay the tune up to the current point, you have something like this:

#var NoteNumber 1
#alias ReplayTune {#var NoteNumber 1;#t+ Replay;press %item(@Keys,%item(@CurrentTune,1))}

#trig "Replay" {You can press another note} {#if (@NoteNumber=<%numitems(@CurrentTune)) {press %item(@Keys,%item(@CurrentTune,@NoteNumber));#add NoteNumber 1} {#t- Replay;RepeatAboveLogic}}

Where RepeatAboveLogic is an alias that repeats the guessing logic I have above, starting from TryingKey=1
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Jan 20, 2008 3:25 pm   
 
thanks for the help, but c flat is not the same as b, the system does not get that.
and it's Right hand ready. instead of you can press another note.

i'll try to work it in.
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Jan 20, 2008 4:11 pm   
 
and
Quote:
It'd help if you'd explain fully what the different messages mean. Your script is interpreting "The organ grumbles to your touch. Slightly out of tune perhaps?" "The pipes give out a harsh hiss as if scolding your efforts." and "The key clunks down but no sound comes from the pipes." as meaning "wrong note, try again" - which seems reasonable - but it's interpreting "A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?" as meaning "right note, but make it sharp" and "You grope around for the impossible note but soon give up the search." as meaning "right note, but make it flat".

The organ grumbles to your touch. Slightly out of tune perhaps? means you're one key away if at b-> a or c
The pipes give out a harsh hiss as if scolding your efforts. means you're two(three?) keys away if at b-> e
The key clunks down but no sound comes from the pipes. means you're four or five keys away if at b-> f
A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes? means you're on the right letter, but it has to be sharp OR flat
You grope around for the impossible note but soon give up the search. means it's not the wrong extra. (sharp)

the last two can be solved with a script:
Code:
#class {misskey}
#TRIGGER {A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?} {
  #if {@organpress=a} {
    #alarm {+2} {
      press a sharp
      #var organsharppress a;#alarm {+1} {T- misskey;T+misskey2}
      }
    }
#class {0}
#class {misskey2}
#TRIGGER {A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?} {
  #if {@organpress=a} {
    #alarm {+2} {
      press a flat
      #var organsharppress a;#alarm {+1} {T- misskey2;T+misskey}
      }
    }
 

i wrote this code in the quick reply.

edit: the unavailable keys are b sharp|c flat|e sharp|f flat
edit2: #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}
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Jan 20, 2008 4:35 pm   
 
i have an example how it is done manually.
Code:
 270h, 270m e- press d

A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press a

The pipes give out a harsh hiss as if scolding your efforts.
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e

A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?
270h, 270m ey-
press d sharp
Right hand ready.
270h, 270m e-
As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e flat

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press a

The key clunks down but no sound comes from the pipes.
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e flat

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press d

The organ grumbles to your touch. Slightly out of tune perhaps?
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
press e flat
Right hand ready.
270h, 270m e-
As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e

The key clunks down but no sound comes from the pipes.
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey- press e flat

You are unbalanced.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e flat

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press c

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
press a
Right hand ready.
270h, 270m e-
The organ grumbles to your touch. Slightly out of tune perhaps?
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e flat

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press c

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press b

The key clunks down but no sound comes from the pipes.
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
press e flat
Right hand ready.
270h, 270m e-
As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press c

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press g

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press a

The organ grumbles to your touch. Slightly out of tune perhaps?
270h, 270m ey-
Right hand ready.
270h, 270m e- press d shar

A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?
270h, 270m ey-
Right hand ready.
270h, 270m e- press d sharp

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
270h, 270m e- press e flat

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 270m ey-
Right hand ready.
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Sun Jan 20, 2008 5:20 pm   
 
this is what i have now
Code:
 #CLASS {organ}
#ALIAS op {
  press %1
  organpress=%1
  }
#ALIAS cleankey {
  #var keypress1 -
  #var keypress2 -
  #var keypress3 -
  #var keypress4 -
  #var keypress5 -
  #var keypress6 -
  #t- secondkey
  #t- thirdkey
  #t- fourthkey
  #t- fifthkey
  #t- sixthkey
  #t+ firstkey
  #t- misskey2
  #t+ misskey
  #var tryingkey 1
  }
#ALIAS ReplayTune {
  #var NoteNumber 1
  #t+ Replay
  press %item( @Keys, %item( @CurrentTune, 1))
  }
#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 {}
#VAR 2 {}
#VAR 3 {}
#VAR 4 {}
#VAR 5 {}
#VAR 6 {}
#TRIGGER {The pipes give out a harsh hiss as if scolding your efforts.} {
  #if {@tryingkey=1} {
    #wait 2000
    press @1
    }
  #if {@tryingkey=2} {
    #wait 2000
;press @1
    #wait 2000
    press @2
    }
  #if {@tryingkey=3} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    }
  #if {@tryingkey=4} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    }
  #if {@tryingkey=5} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    press @5
    }
  #alarm {+2}
  #if {@organpress=a} {#alarm {+2} {op d}}
  #if {@organpress=b} {#alarm {+2} {op e}}
  #if {@organpress=c} {#alarm {+2} {op f}}
  #if {@organpress=d} {#alarm {+2} {op g}}
  #if {@organpress=e} {#alarm {+2} {op a}}
  #if {@organpress=f} {#alarm {+2} {op b}}
  #if {@organpress=g} {#alarm {+2} {op c}}
  }
#TRIGGER {The organ grumbles to your touch. Slightly out of tune perhaps?} {
  #if {@tryingkey=1} {
    #wait 2000
    press @1
    }
  #if {tryingkey=2} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    }
  #if {@tryingkey=3} {
    #wait 2000
;press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    }
  #if {@tryingkey=4} {
    #wait 2000
;press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    }
  #if {@tryingkey=5} {
    #wait 2000
;press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    press @5
    }
  #alarm {+2}
  #if {@organpress=a} {#alarm {+2} {op b}}
  #if {@organpress=b} {#alarm {+2} {op c}}
  #if {@organpress=c} {#alarm {+2} {op d}}
  #if {@organpress=d} {#alarm {+2} {op e}}
  #if {@organpress=e} {#alarm {+2} {op f}}
  #if {@organpress=f} {#alarm {+2} {op g}}
  #if {@organpress=g} {#alarm {+2} {op a}}
  }
#TRIGGER {The key clunks down but no sound comes from the pipes.} {
  #if {tryingkey=1} {
    #wait 2000
    press @1
    }
  #if {tryingkey=2} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    }
  #if {@tryingkey=3} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    }
  #if {@tryingkey=4} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    }
  #if {@tryingkey=5} {
    #wait 2000
    press @1
    #wait 2000
    press @2
    #wait 2000
    press @3
    #wait 2000
    press @4
    press @5
    }
  #alarm {+2}
  #if {@organpress=a} {#alarm {+2} {op f}}
  #if {@organpress=b} {#alarm {+2} {op g}}
  #if {@organpress=c} {#alarm {+2} {op a}}
  #if {@organpress=d} {#alarm {+2} {op b}}
  #if {@organpress=e} {#alarm {+2} {op c}}
  #if {@organpress=f} {#alarm {+2} {op d}}
  #if {@organpress=g} {#alarm {+2} {op e}}
  }
#TRIGGER {You grope around for the impossible note but soon give up the search.} {
  #if {@organspress=b sharp} {
    #alarm {+2} {
      press b flat
      #var organflatpress b
      }
    }
  #if {@organpress=c flat} {
    #alarm {+2} {
      press c sharp
      #var organpress c sharp
      }
    }
  #if {@organpress=e sharp} {
    #alarm {+2} {
      press e flat
      #var organpress e flat
      }
    }
  #if {@organsharppress=f flat} {
    #alarm {+2} {
      press f sharp
      #var organpress f 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} {
    op a
    #t+ secondkey
    #t- firstkey
    #var tryingkey 2
    }
  }
#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} {
    op a
    #t+ thirdkey
    #t- secondkey
    #var tryingkey 3
    }
  }
#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} {
    op a
    #t+ fourthkey
    #t- thirdkey
    #var tryingkey 4
    }
  }
#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} {
    op a
    #t+ fifthkey
    #t- fourthkey
    #var tryingkey 5
    }
  }
#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} {
    op a
    #t+ sixthkey
    #t- fifthkey
    #var tryingkey 6
    }
  }
#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} {
    op a
    #t+ firstkey
    #t- sixthkey
    #var tryingkey 1
    }
  }
#CLASS 0
#CLASS {organ|misskey2}
#TRIGGER {A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?} {
  #if {@organpress=a} {
    #alarm {+2} {
      press a flt
      #var organsharppress a
      #t- misskey2
      #t+ misskey
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      press b flat
      #var organsharppress b
      #t- misskey2
      #t+ misskey
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      press c flat
      #var organsharppress c
      #t- misskey2
      #t+ misskey
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      press d flat
      #var organsharppress d
      #t- misskey2
      #t+ misskey
      }
    }
  #if {@organpress=e} {
    #alarm {+2} {
      press e flat
      #var organsharppress e
      #t- misskey2
      #t+ misskey
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      press f sharp
      #var organsharppress f
      #t- misskey2
      #t+ misskey
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      press g sharp
      #var organsharppress g
      #t- misskey2
      #t+ misskey
      }
    }
  }
#CLASS 0
#CLASS {organ|misskey}
#TRIGGER {A note awry spoils your melody - perhaps a missed key, or the slightest of mistakes?} {
  #if {@organpress=a} {
    #alarm {+2} {
      press a sharp
      #var organsharppress a
      #t- misskey
      #t+ misskey2
      }
    }
  #if {@organpress=b} {
    #alarm {+2} {
      press b sharp
      #var organsharppress b
      #t- misskey
      #t+ misskey2
      }
    }
  #if {@organpress=c} {
    #alarm {+2} {
      press c sharp
      #var organsharppress c
      #t- misskey
      #t+ misskey2
      }
    }
  #if {@organpress=d} {
    #alarm {+2} {
      press d sharp
      #var organsharppress d
      #t- misskey
      #t+ misskey2
      }
    }
  #if {@organpress=e} {
    #alarm {+2} {
      press e sharp
      #var organsharppress e
      #t- misskey
      #t+ misskey2
      }
    }
  #if {@organpress=f} {
    #alarm {+2} {
      press f sharp
      #var organsharppress f
      #t- misskey
      #t+ misskey2
      }
    }
  #if {@organpress=g} {
    #alarm {+2} {
      press g sharp
      #var organsharppress g
      #t- misskey
      #t+ misskey2
      }
    }
  }
#CLASS 0
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sun Jan 20, 2008 6:10 pm   
 
Really, you needn't make any changes to the note-guessing logic if you don't want to; it just made sense in my mind to couple the note-guessing logic with the tune-replaying logic. But you don't need to.

Since the puzzle doesn't work as I assumed, the brute-force method I described isn't the best way to do it. Your original method was probably better.

To store your current tune, though, the simplest way is to use a string list rather than individual variables (your variables 1-6). That allows you to use a single trigger for the "As you play the key, the organ emits a pure joyous note encouraging you on." line.

#trig "CorrectAnswer" {As you play the key, the organ emits a pure joyous note encouraging you on.} {#additem CurrentTune @organpress;#temp {Right hand ready.} {op a}}.

Then, to replay the current tune:

#var CurrentNote 1
#alias ReplayCurrentTune {#var CurrentNote 1;press %item(@CurrentTune,1);#t+ Replay}
#trig "Replay" {Right hand ready.} {#add CurrentNote 1;#if (%item(@CurrentTune,@CurrentNote) {press %item(@CurrentTune,@CurrentNote)} {#t- Replay;op a}} "" {disable}

You should never ever use #wait in a trigger.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Tue Jan 22, 2008 5:41 pm   
 
ok, it seems to work pretty good!
except some minor mistakes, I think they are on my side, i'll try to fix them
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Tue Jan 22, 2008 5:43 pm   
 
it goes like that
Code:
 press a

The pipes give out a harsh hiss as if scolding your efforts.
270h, 225m ey-
Right hand ready.
270h, 225m e- press b

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 225m ey-
Right hand ready.
press a
270h, 225m e- press d

The pipes give out a harsh hiss as if scolding your efforts.
270h, 225m ey-
You are unbalanced.
270h, 225m ey-
Right hand ready.
270h, 225m e- press b

As you play the key, the organ emits a pure joyous note encouraging you on.
270h, 225m ey-
Right hand ready.
press a
270h, 225m e-
The pipes give out a harsh hiss as if scolding your efforts.
270h, 225m ey- press g

You are unbalanced.
270h, 225m ey-
Right hand ready.
270h, 225m e- press b

As you play the key, the organ emits a pure joyous note encouraging you on.Triggers off

270h, 225m ey-
Right hand ready.
270h, 225m e- press c

The key clunks down but no sound comes from the pipes.
270h, 225m ey-
Right hand ready.
270h, 225m e-

it presses A then the next button, lemme try
EDIT: ok, it worked up to two notes, then it stopped after successnote 2
edit2:that was because i remove press A from the line.
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Tue Jan 22, 2008 5:55 pm   
 
hmm, i'm really stuck now, my triggers clash with yours, and I know yours are right,

when I do a misskey, it directly sends a message to the mud to press it, then @organpress changes, and if the next key is a successkey, it makes the currentnote a misskey, or a successkey.

when I do a misskey, it ignores the currentnotes and does not try to replay them, but gives the right value.
EDIt: since the currentnote replace waits for balance, it makes it slower than the #alarm or #wait values.
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