Computer Science Canada

Help with text

Author:  hackman [ Tue Oct 21, 2003 10:48 am ]
Post subject:  Help with text

Can i make text with a line going straight through it, to make the text look like its been crosed out? If so, whats the code? I have to make a Yahtzee game for comp sci and thought this would add a nice affect.

Author:  Dan [ Tue Oct 21, 2003 12:27 pm ]
Post subject: 

well there is no text coamnd for that, but you could use the graifcks comands like Draw.Line to draw a line thougth it after you print it on the screen

Author:  Tony [ Tue Oct 21, 2003 3:26 pm ]
Post subject: 

if you're using Font.Draw, you can draw another string of
code:

put repeat("-", length(word))


using same coordinates. It should cross it out.

Author:  hackman [ Mon Oct 27, 2003 11:03 am ]
Post subject: 

Sorey i took so long to reply. Looks like im gona have to just use drawline.
Tony's idea dosent seem to work on my schools version of turing. Thanks for the replies.

Author:  Tony [ Mon Oct 27, 2003 6:10 pm ]
Post subject: 

repeat is a function and returns a value, not a procedure. You'd have to ether assign value to a variable first or use something like put that assepts a value. I modified the code above.

Author:  hackman [ Tue Oct 28, 2003 11:52 am ]
Post subject: 

I still get an 'Expression cannot contain subscripts' error.

Author:  thoughtful [ Tue Oct 28, 2003 5:30 pm ]
Post subject:  example

Here is an example of wht tony means Arrow
code:

var font : int := Font.New ("verdana:12")
var word : string
var strikeout : string
var x, y := 50
put "Type in the word to be striked out"
get word : *
cls
Font.Draw (word, x, y, font, black)
strikeout := repeat ("-", length (word) + length (word) div 3)
Font.Draw (strikeout, x, y, font, black)

Author:  thoughtful [ Tue Oct 28, 2003 5:36 pm ]
Post subject:  Mine

I made this program which can strikeout almost ne fontsize and look pretty good

code:

const fontsize:=40
var font : int := Font.New ("verdana:"+intstr(fontsize))
var word : string
var strikeout : string
var x, y := 50
put "Type in the word to be striked out"
get word : *
cls
Font.Draw (word, x, y, font, black)
strikeout := repeat ("_", length (word)-length(word) div 10)
Font.Draw (strikeout, x, y+(fontsize div 2), font, black)

Change the fountsize:= value to change the font size

Author:  hackman [ Wed Oct 29, 2003 10:54 am ]
Post subject: 

Ok, now i get it. Thanks.


: