Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,510 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
door access code #431990
10/27/13 23:04
10/27/13 23:04
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
Code:
//////////////////////////////////////////////////////////////////////////////////
// copy the files from this folder inside your \work folder
// don't forget to include access.wdl
// place dialsmall.pcx in your level and attach it the "dial_small" action
// place a door in your level and attach it the "new_door" action 
//////////////////////////////////////////////////////////////////////////////////

BMAP* dialpad_pcx = "dialpad.pcx";

BMAP* one_pcx = "one.pcx";
BMAP* two_pcx = "two.pcx";
BMAP* three_pcx = "three.pcx";
BMAP* four_pcx = "four.pcx";
BMAP* five_pcx = "five.pcx";
BMAP* six_pcx = "six.pcx";
BMAP* seven_pcx = "seven.pcx";
BMAP* eight_pcx = "eight.pcx";
BMAP* nine_pcx = "nine.pcx";
BMAP* zero_pcx = "zero.pcx";
BMAP* asterisk_pcx = "asterisk.pcx";

///////////////////////////////////////////////////////////////////////////////////

var number_of_digits;

///////////////////////////////////////////////////////////////////////////////////

STRING* password_str = "1234";
STRING* guess_str = "";

///////////////////////////////////////////////////////////////////////////////////

ENTITY* locked_door;

///////////////////////////////////////////////////////////////////////////////////

SOUND* dial_wav = "dial.wav";
SOUND* error_wav = "error.wav";
SOUND* success_wav = "success.wav";

///////////////////////////////////////////////////////////////////////////////////

function check_code(button);
function show_dialpad();
function compare_strings();

///////////////////////////////////////////////////////////////////////////////////

PANEL* dialpad_pan =
{
	bmap = dialpad_pcx;
	pos_x = 0;
	pos_y = 0;
	layer = 10;

	button = 143, 8, one_pcx, one_pcx, one_pcx, check_code, null, null; 
	button = 270, 8, two_pcx, two_pcx, two_pcx, check_code, null, null; 
	button = 398, 8, three_pcx, three_pcx, three_pcx, check_code, null, null; 
	button = 143, 128, four_pcx, four_pcx, four_pcx, check_code, null, null; 
	button = 272, 128, five_pcx, five_pcx, five_pcx, check_code, null, null; 
	button = 397, 129, six_pcx, six_pcx, six_pcx, check_code, null, null; 
	button = 144, 248, seven_pcx, seven_pcx, seven_pcx, check_code, null, null; 
	button = 273, 249, eight_pcx, eight_pcx, eight_pcx, check_code, null, null; 
	button = 397, 250, nine_pcx, nine_pcx, nine_pcx, check_code, null, null; 
	button = 146, 368, zero_pcx, zero_pcx, zero_pcx, check_code, null, null; 
	button = 272, 370, asterisk_pcx, asterisk_pcx, asterisk_pcx, check_code, null, null; 

	flags = OVERLAY;
}

////////////////////////////////////////////////////////////////////////////////////

action dial_small()
{
	my.ambient = -40;

	set(my,PASSABLE); 
   my.emask |= ENABLE_CLICK; // lite-C
  

	my.event = show_dialpad;
}

action cells_access_door()
{
	locked_door = me;
}

function check_code(button)
{
	number_of_digits += 1;
	snd_play (dial_wav, 30, 0);
	if (button == 1) 
	{
		str_cat (guess_str, "1");
	}
	if (button == 2) 
	{
		str_cat (guess_str, "2");
	}
	if (button == 3) 
	{
		str_cat (guess_str, "3");
	}
	if (button == 4) 
	{
		str_cat (guess_str, "4");
	}
	if (button == 5) 
	{
		str_cat (guess_str, "5");
	}
	if (button == 6) 
	{
		str_cat (guess_str, "6");
	}
	if (button == 7) 
	{
		str_cat (guess_str, "7");
	}
	if (button == 8) 
	{
		str_cat (guess_str, "8");
	}
	if (button == 9) 
	{
		str_cat (guess_str, "9");
	}
	if (button == 10) 
	{
		str_cat (guess_str, "0");
	}
	if ((button == 11) | (number_of_digits > 4)) 
	{
		while (mouse_left == 1) {wait (1);
		}
		wait (0.5);
		snd_play (error_wav, 70, 0);
		reset(dialpad_pan,SHOW);
	}


	while (1)
	{
		if (str_cmp (password_str, guess_str) == 1) // pass ok?
		{
			snd_play (success_wav, 20, 0);
			reset(dialpad_pan,SHOW);
			while (locked_door.pan > -0) // unlock the door!
			{	
				c_rotate(locked_door, vector(-4 * time_step, 0, 0), IGNORE_WORLD);
				wait (1);
			}
			c_rotate(locked_door, vector(-4 * time_step, 0, 0), IGNORE_WORLD);
			break; // get out of the while loop
		}
		wait (1);
	}
}

function show_dialpad()
{
	number_of_digits = 0;
	str_cpy (guess_str, ""); // reset the string
   set(dialpad_pan,SHOW);
}


Re: door access code [Re: DuaneDawson] #431991
10/27/13 23:16
10/27/13 23:16
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Ehm.. Any words about it man? Resources?


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: door access code [Re: 3run] #432046
10/29/13 16:35
10/29/13 16:35
Joined: Nov 2007
Posts: 318
Brasil, Paraná
NeoNeper Offline
Senior Member
NeoNeper  Offline
Senior Member

Joined: Nov 2007
Posts: 318
Brasil, Paraná
what is the question?


Please! Use easy words to be translated. because my English is not very good! Grateful.
_______________________________________________________
Re: door access code [Re: NeoNeper] #432080
10/30/13 07:48
10/30/13 07:48
Joined: Jul 2013
Posts: 158
F
Feindbild Offline
Member
Feindbild  Offline
Member
F

Joined: Jul 2013
Posts: 158
No question, since this was posted in "contributions".

Re: door access code [Re: Feindbild] #432085
10/30/13 08:40
10/30/13 08:40
Joined: Jun 2013
Posts: 108
Alberta, Canada
C
CanadianDavid Offline
Member
CanadianDavid  Offline
Member
C

Joined: Jun 2013
Posts: 108
Alberta, Canada
What 3run is really asking is for a description for this script. Also, it's almost useless since we don't have the extra assets. Though from a quick glance the code seems simple enough.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1