PDA

View Full Version : A fun little piano script.



Gleeok
06-09-2008, 07:59 AM
The object of the script? Get Link to Carnegie Hall. ...Which as it turns out is pretty hard due to the fact that Link has no musical talent. Someone's been playing too much guitar hero...

How to play? Simple, walk up to the tree...err, piano, and start playing the tree,uuh, piano. Three octaves of keys in C major: D,L.U.R.B.A.Start. Press R to increase pitch, L to decrease, L+R and other keys to play diatonic chords. You can play many notes at a time, single or chordal!

Now you can make those interior screens more interactive. Don't like Pianos? Maybe Link plays the guitar, or flute, or violin. or...*sigh* the ocarina...

How about something spooky? Make it an organ and choir, then replace each E and G note with a Eb and Gb...And maybe those F's with F#'s too..oh my. :o

Here it is: http://www.mediafire.com/?wlmx4majmmf


Q:Will it trigger secrets?
A:No.

Q:Will it be easy to play songs?
A:No.

Q:Can I play a bassline and melody at the same time?
A:Yes, but I hope you are really bored.

Q:How do you play Hyrule Ocarina theme from OOT?
A:U,B,L...U,B,L...U,B,R+L....R+D,.B..R,U,L.

Q:Why am I downloading this?
A:I don't know.





const int C1 = 100;
const int D1 = 101;
const int E1 = 102;
const int F1 = 103;
const int G1 = 104;
const int A1 = 105;
const int B1 = 106;

const int C2 = 107;
const int D2 = 108;
const int E2 = 109;
const int F2 = 110;
const int G2 = 111;
const int A2 = 112;
const int B2 = 113;

const int C3 = 114;
const int D3 = 115;
const int E3 = 116;
const int F3 = 117;
const int G3 = 118;
const int A3 = 119;
const int B3 = 120;





ffc script piano{

void run(){

bool PIANO = false;

bool input_up; bool u;
bool input_down; bool d;
bool input_left; bool l;
bool input_right; bool r;
bool input_b; bool b;
bool input_a; bool a;
bool input_start; bool s;

int timer = 300;

Game->PlayMIDI(0);

while(true){

Waitframe();

if(!PIANO){

if(Link->Y > this->Y && Link->Dir==0 && Abs(this->X-Link->X)<9
&& Abs(this->Y-Link->Y)<17 && Link->Z==0 && this->Data > 0 && Link->InputA)
{
PIANO=true;Link->InputA=false;
}
else PIANO=false;
}

else{

// needed setup

if(Link->InputUp){input_up=true;timer=600;}
else{input_up=false;u=false;}
if(Link->InputDown){input_down=true;timer=300;}
else{input_down=false;d=false;}
if(Link->InputLeft){input_left=true;timer=300;}
else{input_left=false;l=false;}
if(Link->InputRight){input_right=true;timer=300;}
else{input_right=false;r=false;}
if(Link->InputB){input_b=true;timer=300;}
else{input_b=false;b=false;}
if(Link->InputA){input_a=true;timer=300;}
else{input_a=false;a=false;}
if(Link->InputStart){input_start=true;timer=300;}
else{input_start=false;s=false;}

timer--;

if(timer==0)PIANO=false;

// plays sounds based on previous inputs

if(Link->InputL && !Link->InputR){

if(input_down && !d){
Game->PlaySound(C1);d=true;
}
if(input_left && !l){
Game->PlaySound(D1);l=true;
}
if(input_up && !u){
Game->PlaySound(E1);u=true;
}
if(input_right && !r){
Game->PlaySound(F1);r=true;
}
if(input_b && !b){
Game->PlaySound(G1);b=true;
}
if(input_a && !a){
Game->PlaySound(A1);a=true;
}
if(input_start && !s){
Game->PlaySound(B1);s=true;
}
}
else if(!Link->InputL && !Link->InputR){

if(input_down && !d){
Game->PlaySound(C2);d=true;
}
if(input_left && !l){
Game->PlaySound(D2);l=true;
}
if(input_up && !u){
Game->PlaySound(E2);u=true;
}
if(input_right && !r){
Game->PlaySound(F2);r=true;
}
if(input_b && !b){
Game->PlaySound(G2);b=true;
}
if(input_a && !a){
Game->PlaySound(A2);a=true;
}
if(input_start && !s){
Game->PlaySound(B2);s=true;
}
}
else if(!Link->InputL && Link->InputR){

if(input_down && !d){
Game->PlaySound(C3);d=true;
}
if(input_left && !l){
Game->PlaySound(D3);l=true;
}
if(input_up && !u){
Game->PlaySound(E3);u=true;
}
if(input_right && !r){
Game->PlaySound(F3);r=true;
}
if(input_b && !b){
Game->PlaySound(G3);b=true;
}
if(input_a && !a){
Game->PlaySound(A3);a=true;
}
if(input_start && !s){
Game->PlaySound(B3);s=true;
}
}
else if(Link->InputL && Link->InputR){

if(input_down && !d){
Game->PlaySound(C1);Game->PlaySound(E1);
Game->PlaySound(G1);Game->PlaySound(C2);d=true;
}
if(input_left && !l){
Game->PlaySound(D1);Game->PlaySound(F1);
Game->PlaySound(A1);Game->PlaySound(D2);l=true;
}
if(input_up && !u){
Game->PlaySound(E1);Game->PlaySound(G1);
Game->PlaySound(B1);Game->PlaySound(E2);u=true;
}
if(input_right && !r){
Game->PlaySound(F1);Game->PlaySound(A1);
Game->PlaySound(C1);Game->PlaySound(F2);r=true;
}
if(input_b && !b){
Game->PlaySound(G1);Game->PlaySound(B1);
Game->PlaySound(D1);Game->PlaySound(G2);b=true;
}
if(input_a && !a){
Game->PlaySound(A1);Game->PlaySound(C1);
Game->PlaySound(E1);Game->PlaySound(A2);a=true;
}
if(input_start && !s){
Game->PlaySound(B1);Game->PlaySound(D1);
Game->PlaySound(F1);Game->PlaySound(B2);s=true;
}
}

Link->InputUp=false;
Link->InputDown=false;
Link->InputLeft=false;
Link->InputRight=false;
Link->InputA=false;
Link->InputB=false;
Link->InputStart=false;
Link->InputL=false;
Link->InputR=false;

//Link->Action = LA_FROZEN;
}
}
}
}

bigjoe
06-09-2008, 10:22 AM
I tried it out. Pretty cool. With slight modification to make this have secret triggering capabilities, this script would be perfect. However, it seems like you don't want to do that. :p It wouldn't be too hard for someone to do manually though. Just need a way to store the last ... err.. six or so keys that have been pressed by the player.

_L_
06-09-2008, 11:18 AM
You know, I might use this in my own quest... if I could just figure out which of the buttons is assigned to "stop playing Chopsticks and get back to questing."

Gleeok
06-09-2008, 12:28 PM
You know, I might use this in my own quest... if I could just figure out which of the buttons is assigned to "stop playing Chopsticks and get back to questing."

Oh yeah, Haha, It was set at ten seconds of non-use. I just set it to five, ..Just change the delay to whatever. Also I realized that perhaps there should be a PlayMIDI(screen_midi); When the Piano is not in use. That might be a bit better also.

Maybe even a Link starts playing the piano! message. Sure.



Ah yes the secrets...Well there's no way I'm gonna code out a song or anything, but you can easily access a global variable by hitting any one single key. Like, play the high 'F' and a door opens up...or something.

Misopesaminos
06-09-2008, 12:57 PM
That's amazing! is there a way to get off the piano? lol

SpacemanDan
06-09-2008, 06:24 PM
Interesting...
If this could trigger secrets, I could see many possibilities with this. Still an awsome script as-is for a fun extra thing to do. Nice work! :D
I'm assuming those variables in the beginning are the sounds to use?

Ebola Zaire
07-01-2008, 04:38 PM
Sweet! It'd be cool if you could script this to activate secrets- it'd be like the Bat Cave. Play U D R and the bookcase moves right!

The_Amaster
07-01-2008, 04:51 PM
It's Gleeok, master of radical scripting. He amazed us with his overhaul of the engine to form a top down shooter, but not content to stop there, he now has released a script that turns ZC into a passable music synthesizer!

Whats next? ZC as pong? (Oh, wait, we already have that)
Maybe Mario?