Computer Science Canada Font Draw HELP ! |
Author: | imsry [ Sun Dec 13, 2009 4:42 pm ] |
Post subject: | Font Draw HELP ! |
What is it you are trying to achieve? Using font draw with a variable. Like: put variable,"hello" im not using put because it will create a white line in background picture What is the problem you are having? Turing is not letting me put a variable in Font.Draw Describe what you have tried to solve this problem i have tried the following: Font.Draw (number,") Is it a mammal?", 110, 325, questionfont, red) Font.Draw (number, 110, 325, questionfont, red) Font.Draw (number ") Is it a mammal?", 110, 325, questionfont, red) Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) var number : int :=0 var questionfont : int %font for the question questionfont := Font.New ("ISOCT:30:bold") number +=1 Font.Draw (number,") Is it a mammal?", 110, 325, questionfont, red) %question then when i run turring says "argument is the wrong type" [/syntax] Please specify what version of Turing you are using 4.1 |
Author: | Tony [ Sun Dec 13, 2009 4:49 pm ] |
Post subject: | RE:Font Draw HELP ! |
Because the argument is of the wrong type, please use the right type. You can check Font.Draw documentation, and it will tell you that it's expecting a string. Also, commas don't join things together, they separate arguments. put takes an arbitrary number of arguments. |
Author: | imsry [ Sun Dec 13, 2009 4:55 pm ] |
Post subject: | RE:Font Draw HELP ! |
; D Thanks your the best !! |
Author: | imsry [ Sun Dec 13, 2009 5:06 pm ] |
Post subject: | RE:Font Draw HELP ! |
hmm i still dont get it X.X what string i put in it?? do i put var text:string := "is it a mammal?" Font.Draw ("is it a mammal?":text,100,100,red,question font:number) |
Author: | Tony [ Sun Dec 13, 2009 5:08 pm ] |
Post subject: | RE:Font Draw HELP ! |
check out the examples, click link -> Font.Draw |
Author: | imsry [ Sun Dec 13, 2009 5:16 pm ] |
Post subject: | Re: Font Draw HELP ! |
i tried that.. it dont help much i want to make a question and sometime i made it so that it skips certain questions. Therefore i need a variable that can count by1 to show the player what question they are on. which would be var number : int :=0 number +=1 that does the math but i need to put into font draw. ex number) is it a mammal? |
Author: | Tony [ Sun Dec 13, 2009 5:30 pm ] |
Post subject: | RE:Font Draw HELP ! |
So you need a single string to display. You can concatenate strings with +, as in "foo" + "bar". You can't join numbers with strings, because that behaviour is not defined, but you can turn an integer into a string with intstr |
Author: | imsry [ Sun Dec 13, 2009 5:50 pm ] |
Post subject: | RE:Font Draw HELP ! |
: D thanks i think it works now it lets me run it Font.Draw (intstr (number)+") Is it a mammal?", 110, 325, questionfont, red) %question this seems right. right? |
Author: | Tony [ Sun Dec 13, 2009 6:02 pm ] |
Post subject: | RE:Font Draw HELP ! |
That seems right. But also, don't be afraid to just try things out. It's ok to make mistakes ![]() |
Author: | mirhagk [ Sun Dec 13, 2009 11:32 pm ] |
Post subject: | Re: RE:Font Draw HELP ! |
Tony @ Sun Dec 13, 2009 6:02 pm wrote: That seems right.
But also, don't be afraid to just try things out. It's ok to make mistakes ![]() I wish that were true in all languages. I'm learning assembly right now... that quote does not apply at all. i put a 2 instead of a 9 and the whole computer starts displaying random symbols and beeping like crazy. My math teacher actually made a mistake once and his code dynamically erased itself right before his eyes... |
Author: | Tony [ Sun Dec 13, 2009 11:47 pm ] |
Post subject: | Re: RE:Font Draw HELP ! |
mirhagk @ Sun Dec 13, 2009 11:32 pm wrote: My math teacher actually made a mistake once and his code dynamically erased itself right before his eyes...
Source. Control. |