For loop testing all 255 characters only showing less than half the colours.
Author |
Message |
Timothy Willard
|
Posted: Fri Jun 21, 2013 1:19 pm Post subject: For loop testing all 255 characters only showing less than half the colours. |
|
|
What is it you are trying to achieve?
I am trying to make a simple program that will show all 255 colours available in Turing.
What is the problem you are having?
Less than half the colours are showing up.
Describe what you have tried to solve this problem
I placed ".." after my put statements, which made several more colours appear, but still less than half.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: | setscreen ("graphics")
setscreen ("graphics:1920;1080")
View.Set ("offscreenonly")
for i : 1 .. 255
if i <= maxrow then
locate (i, 1)
put i. .
Draw.FillBox (31, (10 * i ) - 9, maxx div 4, 10 * i, i )
elsif i <= 2 * maxrow then
locate (i - maxrow, maxcol div 4)
put i. .
Draw.FillBox ((maxx div 4) + 30, 10 * i, maxx * 2 div 4, (10 * i ) - 9, i )
elsif i <= 3 * maxrow then
locate (i - (2 * maxrow), maxcol * 2 div 4)
put i. .
Draw.FillBox ((maxx * 3 div 4) + 30, 10 * i, maxx * 3 div 4, (10 * i ) - 9, i )
else
locate (i - (3 * maxrow), maxcol * 3 div 4)
put i. .
Draw.FillBox (maxx + 30, 10 * i, maxx, (10 * i ) - 9, i )
end if
delay (1)
end for
View.Update
|
Please specify what version of Turing you are using
4.1 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
KingGrumpz
|
Posted: Fri Jun 21, 2013 3:25 pm Post subject: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
Turing: |
for i : 1 .. 255
colour (i )
put i, " "..
end for
|
|
|
|
|
|
![](images/spacer.gif) |
Timothy Willard
|
Posted: Fri Jun 21, 2013 4:02 pm Post subject: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
Well, do thank you for that, but as of now I just want to know what is wrong with MY program. I was able to find the colours easily enough with a google search. I just posted this to figure out why my program isn't working. |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Fri Jun 21, 2013 5:02 pm Post subject: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
Any time you use put to display text, that entire line is erased before the new text is written. For example,
code: |
locate (1, 1)
put "A"
locate (1, 5)
put "B"
|
If you run this, only B will display. |
|
|
|
|
![](images/spacer.gif) |
Timothy Willard
|
Posted: Fri Jun 21, 2013 5:34 pm Post subject: Re: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
Insectoid @ Fri Jun 21, 2013 5:02 pm wrote: Any time you use put to display text, that entire line is erased before the new text is written. For example,
code: |
locate (1, 1)
put "A"
locate (1, 5)
put "B"
|
If you run this, only B will display.
Quite literally, I copied that into Turing, ran it, and both A and B appeared. |
|
|
|
|
![](images/spacer.gif) |
Nathan4102
|
Posted: Fri Jun 21, 2013 5:42 pm Post subject: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
The point is you're going to need to do this another way. You could try Font.Draw, or use put to draw all the text in a certain row all at once. |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Fri Jun 21, 2013 6:15 pm Post subject: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
Insectoid just put them in the wrong order:
locate (1, 5)
put "A"
locate (1, 1)
put "B" |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Fri Jun 21, 2013 6:16 pm Post subject: RE:For loop testing all 255 characters only showing less than half the colours. |
|
|
So essentially, it's not the fact that you need to not use put statements, it's just that you have to make sure your put statements don't cover eachother up. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Timothy Willard
|
Posted: Wed Jun 26, 2013 5:14 pm Post subject: Re: For loop testing all 255 characters only showing less than half the colours. |
|
|
I figured this out on my own. It was not the put statements (since each put statement started to the right of the drawn box it didn't interfere).
The real problem was a stupid mistake on my part. I forgot that (0,0) for (x,y) started in the bottom left, instead of the top left like columns. I was placing the boxes in the competely wrong location. |
|
|
|
|
![](images/spacer.gif) |
|
|