Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Displaying variables with Font.Draw
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
vertozia




PostPosted: Sat Jan 20, 2007 5:42 pm   Post subject: Displaying variables with Font.Draw

Hey there, I'm trying to make a scoring system, but i want to make the score bigger, there is a problem

correct is my score variable and is equal to 0, with each correct answer it increases by one. When i want to see the score it gives me an error that i do not know how to correct this (argument is the wrong type. please have a look at my code. I tried defining font . draw with a variable then trying to execute it instead of executing it on the spot, it still didn't work.



Posted Image, might have been reduced in size. Click Image to view fullscreen.



math score-error.zip
 Description:

Download
 Filename:  math score-error.zip
 Filesize:  58.16 KB
 Downloaded:  76 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
neufelni




PostPosted: Sat Jan 20, 2007 6:19 pm   Post subject: RE:Displaying variables with Font.Draw

The problem is that your score is an int variable and Font.Draw takes a string as an argument. To solve this problem you just need to convert your int to a string. This is done using intstr:
Turing:

var score : int := 5
var font : int := Font.New("Arial:12")

Font.Draw(intstr(score), 10, 10, font, 7)
CodeMonkey2000




PostPosted: Sat Jan 20, 2007 6:20 pm   Post subject: RE:Displaying variables with Font.Draw

use intstr(correct)
vertozia




PostPosted: Sat Jan 20, 2007 8:51 pm   Post subject: RE:Displaying variables with Font.Draw

cool, thanks a lot, gave you both some random bits.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: