Computer Science Canada

Turing "Arugment is the wrong type" Error Problem

Author:  WhooliMooli [ Sat Jan 18, 2014 12:48 pm ]
Post subject:  Turing "Arugment is the wrong type" Error Problem

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
I am trying to make it so when the user enters there name, when the screen clears and writes these names it will actually work instead of give me an error.

What is the problem you are having?
<I keep getting an error saying "Argument is the wrong type">


Describe what you have tried to solve this problem
<I've tried changing the variables, however I cannot get anything to work>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

var scorefont : int := Font.New ("Agency FB:45")
var p1name, p2name : string

Font.Draw (": ", p1name, 100, 500, scorefont, yellow)
Font.Draw (": ", p2name, 524, 374, scorefont, yellow)>


Please specify what version of Turing you are using
<4.1.1>

Author:  Raknarg [ Sat Jan 18, 2014 2:57 pm ]
Post subject:  RE:Turing "Arugment is the wrong type" Error Problem

If I remember correctly, Font.Draw only takes in five parameters: A string, two ints, a font and a colour. You have six parameters there.

Author:  WhooliMooli [ Sat Jan 18, 2014 3:12 pm ]
Post subject:  Re: Turing "Arugment is the wrong type" Error Problem

Is there anyway I can fix this? Like use a new command which can hold that many parameters?

Author:  Raknarg [ Sat Jan 18, 2014 3:46 pm ]
Post subject:  RE:Turing "Arugment is the wrong type" Error Problem

No. You have to just use the parameters it gives you.

": ", p1name

What is that supposed to do? Do you want it to put them together? Remember that in a function (like Font.Draw) when you use a comma, it means you're moving on to the next parameter. If you want to put them together, use + instead

Author:  WhooliMooli [ Sat Jan 18, 2014 5:20 pm ]
Post subject:  Re: Turing "Arugment is the wrong type" Error Problem

so like this?

Font.Draw (": " + p1name, 100, 500, scorefont, yellow)

Author:  Raknarg [ Sat Jan 18, 2014 5:35 pm ]
Post subject:  RE:Turing "Arugment is the wrong type" Error Problem

Yup, that would work. But remember that in your code, p1name doesn't have any value, so you would still get an error.

Author:  WhooliMooli [ Sat Jan 18, 2014 6:24 pm ]
Post subject:  Re: Turing "Arugment is the wrong type" Error Problem

YAY! I fixed it, thanks A TON!!


: