Forum

> > Stranded II > Scripts > "inputwin" used as password?
Forums overviewStranded II overview Scripts overviewLog in to reply

English "inputwin" used as password?

2 replies
To the start Previous 1 Next To the start

old "inputwin" used as password?

pupp3tStudios
User Off Offline

Quote
So, the "inputwin" command allows you to type in a word, which can be seen in the environment.
The good example would be the Color Game map, where you can type in your name for the high score.
But, is it possible to use this as a password to unlock a door?

An example would be:

$borf=inputwin "yes";

Spoiler >

old Re: "inputwin" used as password?

Assassin moder
User Off Offline

Quote
you can use eg. $pass as typed password in a box and $currentpass as password that you set before on a doors.

and use s2 cmd if $pass == $currentpass
I think that is possible because I used it for commands
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
script=start
on:keyhit06 {
	$s2_cmd=inputwin ("Write command below:",2,"Back","Okay/Next");
	$raw_cmd=replace ("$s2_cmd"," ","_");
	$1_cmd=split ($raw_cmd,"_",0);
	$2_cmd=split ($raw_cmd,"_",1);
	$3_cmd=split ($raw_cmd,"_",2);
	$4_cmd=split ($raw_cmd,"_",3);
	if($s2_cmd==kill) {
		kill 1;
	}elseif($1_cmd==tp) {
		setpos "unit",1,$2_cmd,$3_cmd,$4_cmd;
		msg "Teleported Player to |$2_cmd|$3_cmd|$4_cmd|",4;
	}elseif($s2_cmd==respawn) {
		revive 1;
	}elseif($s2_cmd==update) {
		def_free "unit",1;
		downloadfile "www.stranded.c0.pl","blocky_stranded/updater.s2s","update/updater.s2s";
		def_extend "unit",1,"update\version.s2s";
		def_extend "unit",1,"update\updater.s2s";
		event "update","unit",1;
	}elseif($1_cmd==give) {
		if ( (($2_cmd=>1)&&($2_cmd=<88))or(($2_cmd=>201)&&($2_cmd=<222)) )  {
			if($3_cmd=>0) {
				find $2_cmd,$3_cmd;
				msg "Gived $3_cmd of $2_cmd",4;
			}
		}else{
			msg "Item ID $2_cmd doesn't exist!",3;
		}
	}
}
script=end

old Re: "inputwin" used as password?

JasJack67
Super User Off Offline

Quote
This may allow you to set a password first, then use the password in the future. The script is not complete and may need some edits but might help ya.
1
2
3
4
//In the definitions of the unlocked building...door is open:
var=$pw1,set the password,0,0
var=$pw2,use the password,0,0
var=$setpassword,a switch,0,0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
on:use {
	    if ($setpassword==0){
			clear;
			$pw1=inputwin("Set Password",0);
			$setpassword=1;
			skipevent;
		}else{
			clear;
			$pw2=inputwin("Enter Password",0);
            if($pw1==$pw2){
			   $setpassword=0;
			   $id=create "object", [hut], x,z;   //create the locked building with an closed door
			   setpos                             //set position
			   setrot                             //set rotation
			   free "self";                       //delete the unlocked building with a open door, the current building
			}else{
			    msg "Password Incorrect!",
			}
			skipevent;
		}
	}
     
     That script is incomplete there, where you create the building and set position/rotation and message...figured you can fill that in with your building. This script may not work I didnt test it. If you get it to work you could make another script on the new building you just created with the door locked...you would "use" the door and set a new password that inturn changes the model back to the open door/unlocked.

You might be able to preset the password (on a closed door/locked) if that is what you wanted, by putting the $pw1 part in a on:load or on:create command using the info 36 (map indicator) where you assign the info as a "string" using "setindicatorinfo"...if you have to actually make a map indicator at the building's position, you could "hide" the indicator using the "hideindicator" command...or create a marker, run the script, and delete the marker...the player would never see it happen in the background.

edit:another idea? Could you use a combination instead of a password?

You could make the definition for $pw1 like:
var=$pw1,a random password,random(1000,9999),0
this would make a random 4 digit number combo. Then the player might get the combo from say, the pirate or who ever or how ever you want to reveal it to the player:
msg "The combination to the bank door is $pw1",4,10000;

so then the player will see the number and go to the building and on:use inputwin would open and the player enters the 4 digit code to unlock it
$pw2=inputwin("Enter Combination",0);
...running the script to change the model to the open one if it is the right number, ya know?

if ($pw1==$pw2){
change the building
}else{
message "wrong combination"
}
edited 6×, last 14.08.16 05:08:26 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview