Converting int to string 
	 
	
		| Author | 
		Message | 
	 
		 
		TuringDan
 
 
 
    
		 | 
		
		
			
				  Posted: Sun Apr 13, 2008 1:57 pm    Post subject: Converting int to string  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				I want to convert an int variable into a string in order to display it using Draw.Text instead of put (to avoid the nasty background).
 
 
the int variable is health, it is constantly changing, and I want to display the number on my health bar.
 
 
Any help would be much appreciated.
 
 
also, this is my first post on these boards. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		[Gandalf]
 
  
 
    
		 | 
		
		
			
				  Posted: Sun Apr 13, 2008 2:08 pm    Post subject: RE:Converting int to string  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				It's been a while since I've done Turing, but it goes something like this:
 
	  | code: | 	 		  Draw.Text("Health: " + intstr(health), x, y, colour)  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		TuringDan
 
 
 
    
		 | 
		
		
			
				  Posted: Sun Apr 13, 2008 2:11 pm    Post subject: Re: Converting int to string  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| That worked! thanks a million. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		[Gandalf]
 
  
 
    
		 | 
		
		
			
				  Posted: Sun Apr 13, 2008 2:13 pm    Post subject: RE:Converting int to string  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				No problem, and welcome to CompSci.ca, enjoy your stay!   | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		TuringDan
 
 
 
    
		 | 
		
		
			
				  Posted: Sun Apr 13, 2008 2:16 pm    Post subject: Re: Converting int to string  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Good to be here. I did a bit of turing in grade 9 and did not start again until this year (Im in grade 11)
 
 
I'm just teaching myself right now, and preparing for the grade 12 comp. info sciences course. I would have taken it this year but mandatory credits got in the way.
 
 
The code I wrote with your advice looks like this:
 
 
	  | code: | 	 		  Draw.Text (intstr(health)+" /160", 175, 321, font1, black)
 
Draw.Text (intstr(enemy1)+" /160", 505, 321, font1, black)
 
Draw.Text (intstr(enemy1mana)+" /160", 505, 306, font1, black)  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		Nick
 
  
 
    
		 | 
		
		
			
				  Posted: Sun Apr 13, 2008 2:34 pm    Post subject: RE:Converting int to string  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| looks good, but look up arrays in the Turing Walkthrough | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |