
-----------------------------------
upthescale
Fri Mar 31, 2006 5:27 pm

Font and random numbers
-----------------------------------
i  know how to use font.Draw like make a word bigger and different font
and i can also use randint


var x :int

randint (x,1,10)


but how do i put a random number inside the fontdraw, so in thoer words the pogram wud output a number, but in big lettering and whatever font u want?

-----------------------------------
[Gandalf]
Fri Mar 31, 2006 5:35 pm


-----------------------------------
You would use the + operator to concatenate the random number to the string you are outputting.  Before you do this, you must use the intstr function to convert the integer to a string (so that it is able to be concatenated to the output string).
Font.Draw ("The random number is: " + intstr(Rand.Int (1, 15)), 200, 150, myFont, red)
Note:  We are using the Rand.Int (min, max : int) : int function instead of randint() in this case, because a function is much more appropriate.

-----------------------------------
do_pete
Fri Mar 31, 2006 5:38 pm


-----------------------------------
This should be under [Turing Help]. Anyways, all you have to do is make the number and convert it to a string using "intstr". You may also want to use Rand.Int.

-----------------------------------
[Gandalf]
Fri Mar 31, 2006 5:41 pm


-----------------------------------
You're a bit slow. :)
Yes, this should definately be under [Turing Help].  [Turing Source Code] is for fully functional programs which others can learn from.

strint() would convert a string to an integer, check it out for yourself.  An easy way to remember this is "__ to __", so in this case "string to int".

*edit* I'm not crazy...  He had it as strint() before the edit. :)

-----------------------------------
do_pete
Fri Mar 31, 2006 5:47 pm


-----------------------------------
Oops! :oops: I realized that, then I edited it and you posted that while while I was editing

-----------------------------------
upthescale
Fri Mar 31, 2006 6:26 pm


-----------------------------------
ok i am using 


Font.Draw ("The random number is: " + intstr(Rand.Int (1, 15)), 200, 150, myFont, red)



fer a slots game i am making...i am done i am just coding it now ...i need it so if (x) = 3 and (x2) = 3 and (x3) = 3 then the person will win


but using 
Font.Draw ("The random number is: " + intstr(Rand.Int (1, 15)), 200, 150, myFont, red)

 there are no variables so how do i do this?

-----------------------------------
[Gandalf]
Fri Mar 31, 2006 6:36 pm


-----------------------------------
Replace Rand.Int (1, 15) with your integer variable.

-----------------------------------
upthescale
Fri Mar 31, 2006 6:37 pm


-----------------------------------
how?

-----------------------------------
[Gandalf]
Fri Mar 31, 2006 6:42 pm


-----------------------------------
Wow... ugh...  Double one word obvious post?  Really, this should be self-evident:
Font.Draw ("The random number is: " + intstr(myIntVar), 200, 150, myFont, red) 

-----------------------------------
upthescale
Fri Mar 31, 2006 6:45 pm


-----------------------------------
is it possible to make turing, in turing?

-----------------------------------
[Gandalf]
Fri Mar 31, 2006 6:56 pm


-----------------------------------
Random question?

Well...  you could recreate many aspects of it, since you would only need to parse the code and call the corresponding Turing functions.  To recreate the whole thing would be incredibely useless, and, although it's definately possible (basically anything is with a programming language) why would you want to do it?
