View Single Post
# 2 17-11-2004 , 08:39 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
It's because you declare the variables inside the block. When you do that they become local variables to that block. When you try to use them outside of the block you are actually declaring new variables and that's why they show zero in the contents. To make the variables available outside the block you have to declare them in "upper level":

Code:
{
	int $MR_randX;
	int $MR_rotX;
	int $MR_randY;
	int $MR_rotY;
	int $MR_randZ;
	int $MR_rotZ;

	if ($MR_SnapButton == 1) 
	{ 
		$MR_randX = rand (360/$MR_snapx); 
		$MR_rotX = $MR_randX*$MR_snapx; 
	
		$MR_randY = rand (360/$MR_snapy); 
		$MR_rotY = $MR_randY*$MR_snapy; 
	
		$MR_randZ = rand (360/$MR_snapz); 
		$MR_rotZ = $MR_randZ*$MR_snapz; 
	}
}


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!