debugging help

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

debugging help

Post by darksmaster923 »

hey i need help debugging my script. its a parse error so i think its a syntax error but i cant fine anything wrong. can yall llook thru it?

Code: Select all

{
	offsetX			[-2]
	offsetY			[0]
	offsetZ			[10]
	offsettemp		[0]
	camerapitch		[0]

	DAMAGEATTRIBUTE		[hp]
	CURRENTWEAPON		[0]
	WEAPONTOCHANGE		[null]


	//SOCOM
	SOCOM			[socom]
	SOCOMCLIP		[12]
	SOCOMAMMO		[12]
	SOCOMSPREAD		[30]
	SOCOMARM		[socom_arm]
	SOCOMFIRE		[socom_fire]
	SOCOMIDLE		[socom_idle]
	SOCOMRUN		[socom_run]
	SOCOMFRELOAD		[socom_reload]
	SOCOMSHOT		[weapon\SOCOM.wav]

	//P90
	P90CLIP			[50]
	P90AMMO			[50]
	P90SPREAD		[25]

	//M16
	M16CLIP			[30]
	M16AMMO			[30]
	M16SPREAD		[10]

	//M9
	M9CLIP			[8]
	M9AMMO			[8]
	M9SPREAD		[50]

	//M82
	M82CLIP			[10]
	M82AMMO			[10]
	M82SPREAD		[4]

	//RAILGUN
	RAILGUNCLIP		[1]
	RAILGUNFIRED		[false]
	RAILGUNSPREAD		[0]

	//GAUSSRIFLE
	GAUSSRIFLECLIP		[20]
	GAUSSRIFLEAMMO		[20]
	GAUSSRIFLESPREAD	[2]

	//GAUSSSNIPER
	GAUSSSNIPERCLIP		[5]
	GAUSSSNIPERAMMO		[5]
	GAUSSSNIPERSPREAD	[2]


	Spawn[ ()
	{
		Console(true);
		Gravity(false);
		SetNoCollision();
		LowLevel("setup");
	} ]

	setup[ ()
	{
		self.yaw_speed = 1000;
		self.pitch_speed = 1000;
		debug(self.camera_pitch);
		pos();
		fire();
		if(self.key_pressed = 1)
		{
			CURRENTWEAPON = 1;	//Weapon is now hands which is punching
			WEAPONTOCHANGE = "hands";
			HighLevel("Changeweapon");
		}
		if(self.key_pressed = 2)
		{
			if(GetAttribute("socom", "Player") > 0)
			{
				CURRENTWEAPON = 2;	// Weapon is now socom
				WEAPONTOCHANGE = "socom";
				Animate(SOCOMARM);
				HighLevel("Changeweapon");
			}
		}
		if(self.key_pressed = 3)
		{
			if(GetAttribute("p90", "Player") > 0)
			{
				CURRENTWEAPON = 3;	// Weapon is now p90
				WEAPONTOCHANGE = "p90";
				HighLevel("Changeweapon");
			}
		}
		if(self.key_pressed = 4)
		{
			if(GetAttribute("m16", "Player") > 0)
			{
				CURRENTWEAPON = 4;	// Weapon is now m16
				WEAPONTOCHANGE = "m16";
				HighLevel("Changeweapon");
			}
		}
		if(self.key_pressed = 5)
		{
			if(GetAttribute("m9", "Player") > 0)
			{
				CURRENTWEAPON = 5;	// Weapon is now m9
				WEAPONTOCHANGE = "m9";
				HighLevel("Changeweapon");
			}
		}
		if(self.key_pressed = 6)
		{
			if(GetAttribute("m82", "Player") > 0)
			{
				CURRENTWEAPON = 6;	// Weapon is now m82
				WEAPONTOCHANGE = "m82";
				HighLevel("Changeweapon");
			}
		}
		if(self.key_pressed = 7)
		{
			if(GetAttribute("railgun", "Player") > 0)
			{
				CURRENTWEAPON = 7;	// Weapon is now railgun
				WEAPONTOCHANGE = "railgun";
				HighLevel("Changeweapon");
			}
		}
	} ]


	pos[ ()
	{
		camerapitchtemp = self.camera_pitch*10;
		PositionToPawn("player",offsetX,80+offsetY+camerapitchtemp,offsetZ+camerapitchtemp,true,false);
		self.ideal_yaw = self.player_yaw;
		ChangeYaw(); 

		self.ideal_pitch = self.camera_pitch;	
		ChangePitch();
	} ]

	Changeweapon[ ()
	{
		SetWeapon(SOCOM);
		LowLevel("setup");
	} ]

	fire[ ()
	{
		if(CURRENTWEAPON = 2)
		{
			if(SOCOMCLIP > 0
			{
				SOCOMCLIP = SOCOMCLIP - 1;
				Animate(SOCOMFIRE);
				//BANG
			}
			else
			{
				Animate(SOCOMRELOAD);
			}
		}
	} ]
}
Herp derp.
User avatar
bernie
RF Moderator
Posts: 1249
Joined: Tue Nov 15, 2005 10:07 am
Location: Ireland

Re: debugging help

Post by bernie »

fire[ ()
{
if(CURRENTWEAPON = 2)
{
if(SOCOMCLIP > 0
{
SOCOMCLIP = SOCOMCLIP - 1;
Animate(SOCOMFIRE);
//BANG
}
else
{
Animate(SOCOMRELOAD);
}
}
} ]




Closing bracket missing
Should be

fire[ ()
{
if(CURRENTWEAPON = 2)
{
if(SOCOMCLIP > 0)
{
SOCOMCLIP = SOCOMCLIP - 1;
Animate(SOCOMFIRE);
//BANG
}
else
{
Animate(SOCOMRELOAD);
}
}
} ]
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: debugging help

Post by darksmaster923 »

o now i see. why cant i ever notice this?
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: debugging help

Post by paradoxnj »

That script looks a lot like you're trying to remake Metal Gear Solid. ;) If you can pull it off, I would definitely play that.
Many Bothans died to bring you this signature....
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: debugging help

Post by darksmaster923 »

paradoxnj wrote:That script looks a lot like you're trying to remake Metal Gear Solid. ;) If you can pull it off, I would definitely play that.
it does? sorry to disappoint you, but this is an fps game. i mean like its not totally stealth, camera is different etc
Herp derp.
Post Reply