Ahahaha!!! At long last I believe I have a non-buggy Portal script! (and yet I promise nothing...) Well, I was gonna make a ridiculously hard Portal demo and make someone beat it to get the password...but then I remembered I don't really like making lots and lots of puzzles. Oh well, whatever, I'll leave the puzzles to you guys. Here it is:


*EDIT* I've edited this to contain all three versions of PORTAL_item. Read below for what each do differently.

EDIT#2 - Here they are at last, at long last. And now i'll be taking a short break from scripting. :brainfried emoticon!!!:

EDIT #3 friggin billion....now you can't get stuck in a wall or warp shooters yada yada enjoy.

Portal item version 3 will recall the portals so you can fire them again
^^*RECOMMENDED*^^

. and portal item 2 will keep one of them active if there are two open portals or let you fire both again or vice-versa, But it's a bit tricky to use. Of coarse practice makes perfect.

(It's fixed now)Here is the Final version:
Code:
//D0 Cset of first portal
//D1 Cset of second portal
//D2 speed of portal gun

item script PORTAL_item_ver2{

	void run(int cset, int cset2, int speed){

		ffc portal1 = Screen->LoadFFC(29); //set hard coded ffc data here
		ffc portal2 = Screen->LoadFFC(28);  // and here




			if(!((portal1->Data >= portal_data) && (portal1->Data <= portal_data+7))){  

				Game->PlaySound(11);

				if(Link->Dir == 0) {
					portal1->X = Link->X; 
					portal1->Y = Link->Y - 16;
					portal1->Vy = -speed;
					portal1->Vx = 0;
					portal1->Data = portal_data;
					portal1->CSet = cset;
				}
				if(Link->Dir == 1) {
					portal1->X = Link->X; 
					portal1->Y = Link->Y + 16;
					portal1->Vy = speed;
					portal1->Vx = 0;
					portal1->Data = portal_data+1;
					portal1->CSet = cset;
				}
				if(Link->Dir == 2) {
					portal1->X = Link->X - 16; 
					portal1->Y = Link->Y;
					portal1->Vx = -speed;
					portal1->Vy = 0;
					portal1->Data = portal_data+2;
					portal1->CSet = cset;
				}
				if(Link->Dir == 3) {
					portal1->X = Link->X + 16; 
					portal1->Y = Link->Y;
					portal1->Vx = speed;
					portal1->Vy = 0;
					portal1->Data = portal_data+3;
					portal1->CSet = cset;
				}
			}
			else{
				if(!((portal2->Data >= portal_data) && (portal2->Data <= portal_data+7))){ 

					Game->PlaySound(11);
			
					if(Link->Dir == 0) {
						portal2->X = Link->X; 
						portal2->Y = Link->Y - 16;
						portal2->Vy = -speed;
						portal2->Vx = 0;
						portal2->Data = portal_data;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 1) {
						portal2->X = Link->X; 
						portal2->Y = Link->Y + 16;
						portal2->Vy = speed;
						portal2->Vx = 0;
						portal2->Data = portal_data+1;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 2) {
						portal2->X = Link->X - 16; 
						portal2->Y = Link->Y;
						portal2->Vx = -speed;
						portal2->Vy = 0;
						portal2->Data = portal_data+2;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 3) {
						portal2->X = Link->X + 16; 
						portal2->Y = Link->Y;
						portal2->Vx = speed;
						portal2->Vy = 0;
						portal2->Data = portal_data+3;
						portal2->CSet = cset2;
					}
				}
				else{    // if both portals are already set fire portal 1 again

					if((portal1->Data > portal_data+3) && (portal1->Data <= portal_data+7)&&
					(portal2->Data > portal_data+3) && (portal2->Data <= portal_data+7)){  

				Game->PlaySound(11);

				if(Link->Dir == 0) {
					portal1->X = Link->X; 
					portal1->Y = Link->Y - 16;
					portal1->Vy = -speed;
					portal1->Vx = 0;
					portal1->Data = portal_data;
					portal1->CSet = cset;
				}
				if(Link->Dir == 1) {
					portal1->X = Link->X; 
					portal1->Y = Link->Y + 16;
					portal1->Vy = speed;
					portal1->Vx = 0;
					portal1->Data = portal_data+1;
					portal1->CSet = cset;
				}
				if(Link->Dir == 2) {
					portal1->X = Link->X - 16; 
					portal1->Y = Link->Y;
					portal1->Vx = -speed;
					portal1->Vy = 0;
					portal1->Data = portal_data+2;
					portal1->CSet = cset;
				}
				if(Link->Dir == 3) {
					portal1->X = Link->X + 16; 
					portal1->Y = Link->Y;
					portal1->Vx = speed;
					portal1->Vy = 0;
					portal1->Data = portal_data+3;
					portal1->CSet = cset;
				}
			}
			else{  // if not then fire portal 2 once more

				if((portal2->Data >= portal_data+4) && (portal2->Data <= portal_data+7)){ 

					Game->PlaySound(11);
			
					if(Link->Dir == 0) {
						portal2->X = Link->X; 
						portal2->Y = Link->Y - 16;
						portal2->Vy = -speed;
						portal2->Vx = 0;
						portal2->Data = portal_data;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 1) {
						portal2->X = Link->X; 
						portal2->Y = Link->Y + 16;
						portal2->Vy = speed;
						portal2->Vx = 0;
						portal2->Data = portal_data+1;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 2) {
						portal2->X = Link->X - 16; 
						portal2->Y = Link->Y;
						portal2->Vx = -speed;
						portal2->Vy = 0;
						portal2->Data = portal_data+2;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 3) {
						portal2->X = Link->X + 16; 
						portal2->Y = Link->Y;
						portal2->Vx = speed;
						portal2->Vy = 0;
						portal2->Data = portal_data+3;
						portal2->CSet = cset2;
					}	
				}
			}	
		}} // end of else statements
	}
}

item script PORTAL_item_ver3{

	void run(int cset, int cset2, int speed){

		ffc portal1 = Screen->LoadFFC(29); //set hard coded ffc data here
		ffc portal2 = Screen->LoadFFC(28);  // and here




			if(!((portal1->Data >= portal_data) && (portal1->Data <= portal_data+7))){  

				Game->PlaySound(11);

				if(Link->Dir == 0) {
					portal1->X = Link->X; 
					portal1->Y = Link->Y - 16;
					portal1->Vy = -speed;
					portal1->Vx = 0;
					portal1->Data = portal_data;
					portal1->CSet = cset;
				}
				if(Link->Dir == 1) {
					portal1->X = Link->X; 
					portal1->Y = Link->Y + 16;
					portal1->Vy = speed;
					portal1->Vx = 0;
					portal1->Data = portal_data+1;
					portal1->CSet = cset;
				}
				if(Link->Dir == 2) {
					portal1->X = Link->X - 16; 
					portal1->Y = Link->Y;
					portal1->Vx = -speed;
					portal1->Vy = 0;
					portal1->Data = portal_data+2;
					portal1->CSet = cset;
				}
				if(Link->Dir == 3) {
					portal1->X = Link->X + 16; 
					portal1->Y = Link->Y;
					portal1->Vx = speed;
					portal1->Vy = 0;
					portal1->Data = portal_data+3;
					portal1->CSet = cset;
				}
			}
			else{
				if(!((portal2->Data >= portal_data) && (portal2->Data <= portal_data+7))){ 

					Game->PlaySound(11);
			
					if(Link->Dir == 0) {
						portal2->X = Link->X; 
						portal2->Y = Link->Y - 16;
						portal2->Vy = -speed;
						portal2->Vx = 0;
						portal2->Data = portal_data;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 1) {
						portal2->X = Link->X; 
						portal2->Y = Link->Y + 16;
						portal2->Vy = speed;
						portal2->Vx = 0;
						portal2->Data = portal_data+1;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 2) {
						portal2->X = Link->X - 16; 
						portal2->Y = Link->Y;
						portal2->Vx = -speed;
						portal2->Vy = 0;
						portal2->Data = portal_data+2;
						portal2->CSet = cset2;
					}
					if(Link->Dir == 3) {
						portal2->X = Link->X + 16; 
						portal2->Y = Link->Y;
						portal2->Vx = speed;
						portal2->Vy = 0;
						portal2->Data = portal_data+3;
						portal2->CSet = cset2;
					}
				}
				else{
				
					portal2->Data = 1;
					portal2->X = 0; 
					portal2->Y = 0;
					portal1->Data = 1;
					portal1->X = 0; 
					portal1->Y = 0;
		
			}	
		}
	}
}


//===================GLOBAL VARIABLES=====================
	int portal_warp_delay = 0;
	int enemy_portal_warp_delay = 0;

	int portal_data = 160;	// change this to be the first of 8 block combos for graphics

//make a block of 8 combos, the first 4 being gun projectile up, down, left, right in that order
//then make the next 4 the same used for open portal animation(no combo cycling)
//========================================================

//D0 - this ffc number
//D1 - other ffc number
// Ex: Set ffc 28 D0 to 28 and D1 to 29 then set ffc 29 D0 to 29 and D1 to 28. easy, huh?

ffc script PORTAL_FFC_ver4{ //   BUGFIXED VERSION

	void run(int this_ffc_number, int other_ffc_number){

		ffc this_ffc = Screen->LoadFFC(this_ffc_number);
		ffc other_ffc = Screen->LoadFFC(other_ffc_number);

		int portal_set = 0;

		int portal_position = 0;

		bool portal_open = false;

		int enemy_number = 0;
		npc enemy;

		this_ffc->Data = 1;this->Y = 0; this->X = 0;

		while(true){

			if(this_ffc->X < 14 || this_ffc->X > 226 || this_ffc->Y < 14 || this_ffc->Y > 146 ||
 				Link->X < 0 || Link->X > 240 || Link->Y < 0 || Link->Y > 160){
				this_ffc->Data = 1; this->Y = 0; this->X = 0; portal_open = false;}
			if(this_ffc->Data <= portal_data+3){ portal_open = false;}

			if(portal_warp_delay > 0){ portal_warp_delay--;}
			if(enemy_portal_warp_delay > 0){ enemy_portal_warp_delay--;}

			if( (this->Data >= portal_data) && (this->Data <=portal_data+3) ){

				if( (this_ffc->Vx < 0) && (Screen->ComboS[ComboAt(this_ffc->X-1, this_ffc->Y+8)] != 0) 
					&& (Screen->ComboT[ComboAt(this_ffc->X-1, this_ffc->Y+8)] != 3)){ portal_open = true;}
				
				if( (this_ffc->Vx > 0) && (Screen->ComboS[ComboAt(this_ffc->X+16, this_ffc->Y+8)] != 0) 
					&& (Screen->ComboT[ComboAt(this_ffc->X+16, this_ffc->Y+8)] != 3)){ portal_open = true;}

				if( (this_ffc->Vy < 0) && (Screen->ComboS[ComboAt(this_ffc->X+8, this_ffc->Y-1)] != 0) 
					&& (Screen->ComboT[ComboAt(this_ffc->X+8, this_ffc->Y-1)] != 3)){ portal_open = true;}

				if( (this_ffc->Vy > 0) && (Screen->ComboS[ComboAt(this_ffc->X+8, this_ffc->Y+16)] != 0) 
					&& (Screen->ComboT[ComboAt(this_ffc->X+8, this_ffc->Y+16)] != 3)){ portal_open = true;}
				
			}
			if(portal_open){
	
				if(Screen->ComboS[ComboAt(this_ffc->X+8, this_ffc->Y+8)] == 15){ portal_open = false;}
				else{ this_ffc->Data = portal_data+4; this_ffc->Vx = 0; this_ffc->Vy = 0;}
			}
			if(portal_set == 0){

				if(other_ffc->Data >= portal_data + 4){

					if(portal_warp_delay == 0){

						if ( (Link->X <= this_ffc->X + 8)&&(Link->X >= this_ffc->X -8)&&
							(Link->Y <= this_ffc->Y + 8)&&(Link->Y >= this_ffc->Y -8) ){

							portal_warp_delay = 60;
							Link->X = other_ffc->X;
							Link->Y = other_ffc->Y;
							Game->PlaySound(36);
						}
					}
					if(enemy_portal_warp_delay == 0){

						enemy_number = Screen->NumNPCs();

						while(enemy_number > 0){
			
							enemy = Screen->LoadNPC(enemy_number);
							if ( (this_ffc->X - 10 < enemy->X) && (this_ffc->X + 10 > enemy->X) &&
								(this_ffc->Y - 10 < enemy->Y) && (this_ffc->Y + 10 > enemy->Y) &&
								!(enemy->Tile==0) ){
							
								enemy->X = other_ffc->X; enemy->Y = other_ffc->Y; 
								Game->PlaySound(35);enemy_portal_warp_delay = 80;
							}	
							enemy_number--;
						}
					}
				}
			}
		Waitframe();
		}
	}
}
It's currently set up to use ffc's 28 and 29. These are changable only once, before you compile it. Everything else is noted, just read.


Oh, one more thing. This will warp enemies too, as well as being able to cross over water combos. Want to make some nasty puzzles? I suggest using water...alot. Any non-walkable combo you don't want to open a portal near in fact. And believe it or not it would be quite easy to make 3 or 4 portals using this code. Only a few things would need to be tweaked. I might still do that just for fun. ...or maybe not.

Oops, I threw something together anyways. :) If you have any problems getting it to work, just download this: PORTAL_DEMO-635( use 635 or 655 to play this.NOTE* THIS DEMO DOES NOT HAVE THE BUGFIXED SCRIPT.

...I swear if I have to edit this again i'm gonna go crazy...(crosses fingers and logs off)


Have fun.