Computer Science Canada

Put With Line Spaces

Author:  josh [ Sat Feb 14, 2004 6:57 pm ]
Post subject:  Put With Line Spaces

I am a real newbee and I can't figure out what I have to do to my code in order for it to put spaces bewteen my different lines becasue right now it is very hard to read all clumped together.

Author:  Cervantes [ Sat Feb 14, 2004 7:27 pm ]
Post subject: 

you can use
code:
locate (row, col)

code:
locatexy (x,y)

code:
put ""


the last one there simply draws a blank space, moving the next put statement down one row.

Author:  Delos [ Sat Feb 14, 2004 8:28 pm ]
Post subject: 

code:

put "All sorts of stuff."
put "More sorts of stuff."

delay (1000)
% Pause for a moment of reflection.
cls

put "All sorts of stuff."
put ""
put "More sorts of stuff."

delay (1000)
% Pause for another moment of reflection.
cls

locate (2,1)
% Locate row 2, column 1.
put "All sorts of stuff."

locate (4, 1)
% Drop down to the forth row.
put "More sorts of stuff."

% Pause for yet another moment of reflection.
cls

put "All sorts of stuff."
put skip
% Skip some lines...whitespace...its complicated...but yeah.
% It skips lines.
put "More sorts of stuff."


Enjoy.

Author:  josh [ Sat Feb 14, 2004 9:41 pm ]
Post subject: 

thanks you guys this makes my program so much easier to understand.

Author:  sport [ Sun Feb 15, 2004 3:21 pm ]
Post subject: 

code:

var number:int:=99
var name:string:="Hello"
put name:7
%will put the name and put 2 more spaces after it (length of name is 5, 7-5=2)
put number:4
%for numbers i will pu spaces before the number. Put two spaces and then 99.
put number:7:2
%will also put 2 decimal spaces

Author:  zylum [ Sun Feb 15, 2004 3:42 pm ]
Post subject: 

or you could just use '\n'

code:

put "blablabla"
put "more blablabla\n"
%new paragraph
put "there is a blank above this line"
put "blablabla"


-zylum

Author:  Cervantes [ Sun Feb 15, 2004 4:26 pm ]
Post subject: 

zylum wrote:
code:

put "blablabla"
put "more blablabla\n"
%new paragraph
put "there is a blank above this line"
put "blablabla"


that doesn't solve the problem quite. He wanted to put an extra space between his lines.

like so

code:

text text text

more text more text


not like so

code:

text text text
more text more text



so for \n to work you'd actually have to put 2 \n 's in there. It saves lines, but it makes your code harder to read. For putting text outside of a loop use put "". For text inside a loop use locate (row, col). If you use the put "" inside a loop it'll continuasly draw the text on a new line which you don't want Eh

Author:  apomb [ Sun Feb 15, 2004 4:58 pm ]
Post subject: 

so all someone could have just told him to use
code:
put " words words words"
put skip
put "more words"

its just turing...not that hard!

Author:  Cervantes [ Sun Feb 15, 2004 5:00 pm ]
Post subject: 

dude.. read the thread Rolling Eyes
that was suggested along with many other methods.... Rolling Eyes

Author:  jonos [ Sun Feb 15, 2004 5:38 pm ]
Post subject: 

or, if you wanted to be really complicated and think about it, you could put just enough spaces extra at the one end of your first line to skip a line and then you wouldn't need an extra put statement Very Happy

Author:  zylum [ Sun Feb 15, 2004 5:59 pm ]
Post subject: 

if you run
code:

put "blablabla"
put "more blablabla\n"
%new paragraph
put "there is a blank above this line"
put "blablabla"


it does leave a space -_-

Author:  Andy [ Sun Feb 15, 2004 9:22 pm ]
Post subject: 

i think this is what u want

code:

drawfill (1, 1, green, blue)
put "blablabla" ..
locate (whatrow + 1, 1)
put "more blablabla" ..
locate (whatrow + 2, 1)
put "there is a blank above this line" ..
locate (whatrow + 1, 1)
put "blablabla" ..

whatrow and whatcol returns the row and col u are currently about to put text on


: