Need little help with TEXT and freeze mode...

Posted By: Anonymous

Need little help with TEXT and freeze mode... - 05/01/09 12:48

Hi again,

i use this code below, and i modify it a little bit. First, i tried to use the freeze_mode while the message is shown, but the game keeps freezing, wats wrong in my code?
and Second: How can i do it, so the message disappier again and the game stop freezing again only wen i hit the space key again.

CODE:---------

TEXT mymessage_txt
{
pos_x = 300;
pos_y = 100;
string("Damn! The way is blocked by a big hole in the floor!");
}

action my_blkdway
{
while (!player) {wait (1);}
while (1)
{
// if the player comes close to the object
if (vec_dist(player.x, my.x) < 100) // play with 100
{
if (key_space)
{
while (key_space)
{
wait (1);
} // wait until the space key is released
mymessage_txt.visible = on;
freeze_mode = 1;
wait (3);
freeze_mode = 0;
// for 3 seconds
mymessage_txt.visible = off;
}
}
wait (1);
}
}
Posted By: Anonymous

Re: Need little help with TEXT and freeze mode... - 05/01/09 19:49

nobody can help me here? crazy
Posted By: KiwiBoy

Re: Need little help with TEXT and freeze mode... - 05/01/09 19:58

Looks like you got syntax mixed up.
Havnt tested this but it should look something like this...compare with yours and the source and you will see defferrence I think.
Code:
action my_blkdway
{
while (!player) {wait (1);}
while (1)
	{
// if the player comes close to the object
		if (vec_dist(player.x, my.x) < 100) // play with 100
		{
		if (key_space)
		{
		while (key_space){wait (1);}		 // wait until the space key is released
		mymessage_txt.visible = on;
		freeze_mode = 1;
		wait (3);
		freeze_mode = 0;
// for 3 seconds
		mymessage_txt.visible = off;
	}
	}
wait (1);
}
}

Posted By: Anonymous

Re: Need little help with TEXT and freeze mode... - 05/01/09 20:43

hope sorry, but stil not working, if i press space the message appears and the game freezes, but it keeps freeze and i can not do anything...
Posted By: KiwiBoy

Re: Need little help with TEXT and freeze mode... - 05/01/09 23:31

Sorry, just gave as example for comparison, not a tested script.
I think the while loop is out of place, should be above if(key_space) I think.
Something more like this
Code:
action my_blkdway
{
while (!player) {wait (1);}
	while (1)
	{	
		while (key_space){wait (1);}		 
	// wait until the space key is released
		// if the player comes close to the object
		if (vec_dist(player.x, my.x) < 100) // play with 100
		{
		
		mymessage_txt.visible = on;
		freeze_mode = 1;
		wait (3);
		freeze_mode = 0;
		// for 3 seconds
		mymessage_txt.visible = off;
		wait (1);
	}
	

}

Posted By: flits

Re: Need little help with TEXT and freeze mode... - 05/02/09 08:04

i gues your function get freezed to

not tested
Code:
function pauze()
{
my = NULL;
freeze_mode = 1;
wait(-3);
freeze_mode = 0;
}

...
		mymessage_txt.visible = on;
		pauze();
		mymessage_txt.visible = off;
		wait (1);

..

© 2023 lite-C Forums