PDA

View Full Version : Utility Script #5 Password



HeroOfFire
06-10-2007, 07:57 PM
Thats right, a password script. Last tested in build 364.
Update: Last Tested in build 478.

Script #5: Password
Link steps on specific combos to enter an 8 character password.


//Various Scripts, by HeroOfFire

//NOTE: When I say activation of a script, I mean setting its CSet to 0.
//This is how I tell a script its been activated, triggered, etc.

import "std.zh"

//FFC Script Password
//Script that takes input for a password based on Link stepping on a set of 10 consecutive combos.
//Link does not step in a combo if in the air.
//It activates another script upon a valid code
//It displays code as it is enteded by default through 10 display combos
//2 Additional display combos show if the code was valid or not
//D0 = FFC Number (starts at 1)
//D1 = Number of the first 'button' combo (Value 0). The next 9 button combos must come directly after it (Values 1

//- 9).
//D2 = Number of the first display combo. The next 11 display combo must come directly after it (values 1-9,

//Checkmark, and X)
//D3 = The first code. Enter any value from 0 to 9999. These are the first 4 digits of the code
//D4 = The second code. Enter any value from 0 to 9999. THese are the last 4 digits of the code
//D5 = THe FFC that is 'activated' if the code is valid
//D6 = If not 0, the display combos will not appear. Good if you have mutliple Password FFCs on a screen.
ffc script Password {

void run(float thisFFC, int firstButton, int firstDisplay, int firstCode, int secondCode, float FFCTarget, float

showDisplay) {
ffc this1 = Screen->LoadFFC(thisFFC);
ffc other1 = Screen->LoadFFC(FFCTarget);
int targetLoc = 0;
int keyCount = 0;
int targetKey = -1;
int firstKey = 0;
int secondKey = 0;
while (true)
{
Waitframe();
targetLoc = ComboAt(Link->X + 8, Link->Y + 8);
if (Screen->ComboD[targetLoc] >= firstButton && Screen->ComboD[targetLoc] <= firstButton + 10 && targetKey

== -1)
{
targetKey = Screen->ComboD[targetLoc];
targetKey = targetKey - firstButton;
}
else if (Screen->ComboD[targetLoc] < firstButton || Screen->ComboD[targetLoc] > firstButton + 10)
{
if (targetKey > -1)
{
if (keyCount > 3)
{
if (keyCount > 5)
{
if (keyCount == 7)
{
secondKey = secondKey + targetKey;
}
else
{
secondKey = secondKey + (targetKey * 10);
}
}
else
{
if (keyCount == 5)
{
secondKey = secondKey + (targetKey * 100);
}
else
{
secondKey = secondKey + (targetKey * 1000);
}
}
}
else
{
if (keyCount > 1)
{
if (keyCount == 3)
{
firstKey = firstKey + targetKey;
}
else
{
firstKey = firstKey + (targetKey * 10);
}
}
else
{
if (keyCount == 1)
{
firstKey = firstKey + (targetKey * 100);
}
else
{
firstKey = firstKey + (targetKey * 1000);
}
}
}
keyCount++;
if (showDisplay == 0)
{
targetLoc = 33 + keyCount;
Screen->ComboD[targetLoc] = firstDisplay + targetKey;
}
targetKey = -1;
}
}
if (keyCount == 8)
{
targetLoc = 42;
if (firstKey == firstCode && secondKey == secondCode)
{
if (showDisplay == 0)
{
Screen->ComboD[targetLoc] = firstDisplay + 10;
}
other1->CSet = 0;
}
else
{
if (showDisplay == 0)
{
Screen->ComboD[targetLoc] = firstDisplay + 11;
}
}
Quit();
}
}
}
}

Quick Overview:
This script has an incredible 7 parameters!
The first is the FFC number (yawn).
The second is the combo # of the first 'button'. This combo, and the next consecutive 9, are used for inputing the password. To use this part of the script, make up 10 combos that have unique identifiers on them and pass the number of the first one in.
The third is the combo # of the display. This is a separate set of 10 combos that should look like the 10 combos used for the buttons, followed by a 'confirmed/password correct tile' and a 'denied/password incorrect tile'. These get displayed as you enter the password, so you can see what you have entered so far (and when finished, if you entered it correctly or not).
The fourth is the first half of the password. This is simply a number between 0 and 9999 (must be a whole number).
The fifth is the second half of the password. Once again, between 0 and 9999.
The sixth is the FFC activated if the password is correct.
The seventh is a flag. If not set to 0 (the default), there will be no display from entering the password. This is useful, if not needed if you have 2 or more passwords used on one screen.

Basic Uses:
This is anything but a basic script.

Cool Things:
The buttons don't have to display numbers. They can display anything you want (although they should all look unique).
You can have multiple passwords on a screen with one set of buttons (just use the same combos for all the scripts).
The display feature allows the player to see what they have entered, almost like a password screen.
The odds of guessing the password come out to: 1 in 100,000,000!
Go ahead, drop passwords all over your quest. Use strange shapes for the buttons and have cryptic riddles. Go wild! This script has great potential.
You can have 10 ProgressChecker scripts that create the buttons used for the password script. Maybe you can't enter the password without enough life for example.
You can always hide the key to a password using secret combos and the lens of truth or having them as undercombos.
You can always have a secret combo create the buttons.
If the button combos are cycling combos, you just created a time limit to enter the password.

Flaws:
You need another FFC that uses activation in order for the password script to be of any use (try combining with one of my other utility scripts).

Awsome Idea:
Try this: On one screen, have several of my ProgressChecker scripts create warps when Link has a certain item in his inventory. These warps take you to guys who give you a password.
On another screen (IN ANOTHER QUEST!!!), place several of these password scripts with the same passwords from those guys. When you enter one correctly, activate a SpawnItem script to spawn the item Link needed to get the password in the other quest.
Do all this, and you have item transfer between quests!
Or:
Have a screen with password scripts at the very beginning of a quest. If Link enters a password correctly, a ProgressChecker script places 'invisible' pit combos in front of the exit door. When Link go through the door in the identical warped room, he gets an item that mods his appearance (and possibly gets other good items in the process). Thes extra items react to ProgressCheckers all throughout the quest, changing the storyline. Now you have password linked quests!

Fix: Better Link positioning now allows Link to step on these key combos from any direction!

Update: Link now will not enter a key if in the air. This means you can jump over buttons.

Potential Updates:
If the plans for 5 digit variables come through, I can make a password script that asks for a 10 digit code.

Din
06-14-2007, 06:07 PM
This is awesome!

Russ
06-23-2007, 10:10 PM
I must be an idiot but nowhere in the script or any other Freeform Combo utility scripts do I see constant variables for me to set the values I want to. Or in simpler terms, I can't find where to input the D0-6 values.

HeroOfFire
07-22-2007, 01:42 AM
Since it's hard to tell if a post has been edited...

I've updated this script. First, the bug with Link approaching these key combos from below has been fixed! This also removed the not addressed bug of approaching from the right.
Second, Link can now jump over these buttons without triggering them (thanks to Link->Z, so you'll need a more recent build).

I'm planning on releasing a short quest soon that shows off all these scripts (including this entertaining one). I have also seen that 5 digit variables work, so I'll have a 10-digit password script shortly as well.

Russ
11-20-2007, 07:17 PM
Um, I have a little problem with this. No matter what I do, the buttons to enter the code don't show up. I have touched the freeform combo, I have bombed it, I've tried everything, but it doesn't want to work. Help please.

P.S. Sorry for the huge bumb. Again.