Posted: Sat Jan 31, 2004 11:26 am Post subject: Gettings values to stay on a chart
Hey, I was just starting this program to calculate the RPM/speed/torque of a cars preformance, and when I tell it to write the values on the chart on the screen, it never stays there and once it shows it, it disappears and also when it is writing down the values it is flashing, and i tried the View.Set ("graphics:offscreenonly") and the View.Update but it still did it... any ideas how to correct these?
Sponsor Sponsor
Thuged_Out_G
Posted: Sat Jan 31, 2004 11:34 am Post subject: (No subject)
well if you have the new turing, you can use View.UpdateArea(x,y,x1,y1) to jut update a certain area, and your values wont stay on screen because you must be using a cls after you put them to the screen
KawaNinja
Posted: Sat Jan 31, 2004 11:41 am Post subject: (No subject)
hmm.. I tried that View.UpdateArea code, never worked. and i dont have a cls in my loop for it.. but the thing is, when it runs through the values only one column stays up there, which is the most recent written code and the others stay up there (but flashing) for the time that it runs through the values... its sort of hard to explain what it does
KawaNinja
Posted: Sat Jan 31, 2004 12:11 pm Post subject: (No subject)
I have a feeling this is something really easy, but since im a n00b at turing i cant seem to crack it
Tony
Posted: Sat Jan 31, 2004 12:27 pm Post subject: (No subject)
it would help to see your output code no need for the full program (cuz if you post a lot of code, not many people will bother reading it). Just the part of the code that has the put statements for your chart.
Posted: Sat Jan 31, 2004 12:43 pm Post subject: (No subject)
View.Set ("graphics:offscreenonly") doesn't work.
the correct syntax is
code:
View.Set ("offscreenonly")
if you want something else in there (ie graphics), separate with a comma.
code:
View.Set ("graphics:500;400,offscreenonly")
below is just something interesting I've noticed about View.Update and "offscreenonly"
try this:
code:
View.Set ("offscreenonly")
put "hey"
no view.Update, but still outputs it
however, if you do this
code:
View.Set ("offscreenonly")
loop
put "hey"
end loop
it won't output it. it needs a View.Update..
strange huh?
McKenzie
Posted: Sat Jan 31, 2004 5:46 pm Post subject: (No subject)
D'OC Student? Anyways, attach the code, I'll look at it.
Cervantes
Posted: Sat Jan 31, 2004 6:12 pm Post subject: (No subject)
McKenzie wrote:
D'OC Student
is that where you teach? and who are you talking to?
Sponsor Sponsor
McKenzie
Posted: Sat Jan 31, 2004 6:23 pm Post subject: (No subject)
Talking to kawaNinja. I used to Teach in Ajax (In Windsor now) at D'OC. The computer teacher at D'OC is still a very good friend of mine.
Andy
Posted: Sat Jan 31, 2004 6:40 pm Post subject: (No subject)
so i'm guessing he's not the moron you told us about...
McKenzie
Posted: Sat Jan 31, 2004 6:43 pm Post subject: (No subject)
No He's my student though (He has a marketing degree, I taught him to program, taught him MTG too , I also taught him that guardians can out-range 'goons")
Andy
Posted: Sat Jan 31, 2004 6:46 pm Post subject: (No subject)
LOL, well teach that to mr.levack... the thinks that bunkers are "GREAT!"
Cervantes
Posted: Sat Jan 31, 2004 7:10 pm Post subject: (No subject)
haha were you playing starcraft in class? damn I wish my teacher were like you he doesn't let us play games, though we do (sometimes)
Andy
Posted: Sat Jan 31, 2004 7:13 pm Post subject: (No subject)
lol he doesnt let us play during class, not even during lunch anymore... after school is a different story tho
KawaNinja
Posted: Sat Jan 31, 2004 9:10 pm Post subject: (No subject)
Ok, I tried that View.Set stuff and it didnt work (the whole screen went white) but i took out the loops and it still went white.. so
Quote:
D'OC Student?
and no i dont goto D'OC i goto Notre Dame.. not sure if you heard of it depending when you left (opened 3 years ago), but i know that there are quite a few teachers from D'OC that teach at my school now..
Mr O'Connor is one that i had just this past semester... when did you teach there?
And finally my code... ok this is the hard part because my code is very long.. (but in not sure if all of it is necasary because i usually always take the long way in life ), and the way its set up i pretty much have to add all of it.. anyways;
(by the way, press the UP arrow and hold it down to view the values on the chart)
code:
var chars : array char of boolean
var second : int := 0
process time_count
Input.KeyDown (chars)
delay (1000)
if chars (KEY_UP_ARROW) then
second := 1
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 2
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 3
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 4
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 5
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 6
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 7
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 8
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 9
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 10
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 11
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 12
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 13
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 14
end if
delay (1000)
if chars (KEY_UP_ARROW) then
second := 15
end if
end time_count
%%%%%%%%
%%%%%%%%
process action
loop
%ACTION BEGINS
var accel : int := 0
var rpm : int := 0
var speed : int := 0
var gear : int := 1
% UP ARROW TO ACCELERATE
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
accel := 1
end if
if accel = 1 then
speed := 1
end if
% SPEED UPING IF ACCEL HELD
if second = 2 and accel = 1
then speed := 10
end if
if second = 3 and accel = 1
then speed := 25
end if
if second = 4 and accel = 1
then speed := 60
end if
if second = 5 and accel = 1
then speed := 80
end if
if second = 6 and accel = 1
then speed := 110
end if
% CALCULATING RPM
if speed = 1 then
rpm := 1000
end if
if speed = 10 then
rpm := 1800
end if
if speed = 25 then
rpm := 2300
end if
if speed = 60 then
rpm := 2900
end if
if speed = 80 then
rpm := 3500
end if
if speed = 110 then
rpm := 1500
end if
% CALCULATING GEAR
if rpm = 1000 then
gear := 1
end if
if rpm = 1800 then
gear := 1
end if
if rpm = 2300 then
gear := 1
end if
if rpm = 2900 then
gear := 1
end if
if rpm = 3500 then
gear := 1
end if
if rpm = 1500 then
gear := 2
end if
%WRITING RPM VALUE ON CHART
Text.LocateXY (250,290)
if speed = 1 then
put rpm
end if
Text.LocateXY (250,280)
if speed = 10 then
put rpm
end if
Text.LocateXY (250,270)
if speed = 25 then
put rpm
end if
Text.LocateXY (250,255)
if speed = 60 then
put rpm
end if
Text.LocateXY (250,225)
if speed = 80 then
put rpm
end if
%GEAR 2
Text.LocateXY (250,220)
if speed = 110 then
put rpm
end if
%DRAWING STATS ON CHART
Text.LocateXY (150, 290)
if second =1 then
put speed
end if
Text.LocateXY (150, 275)
if second = 2 then
put speed
end if
Text.LocateXY (150, 260)
if second = 3 then
put speed
end if
Text.LocateXY (150, 245)
if second = 4 then
put speed
end if
Text.LocateXY (150, 230)
if second = 5 then
put speed
end if
Text.LocateXY (150, 215)
if second = 6 then
put speed
end if
%DRAWING GEARS ON THE CHART
Text.LocateXY (50,290)
if rpm = 1000 then
put gear
end if
Text.LocateXY (50,275)
if rpm = 1800 then
put gear
end if
Text.LocateXY (50,260)
if rpm = 2300 then
put gear
end if
Text.LocateXY (50,245)
if rpm = 2900 then
put gear
end if
Text.LocateXY (50,230)
if rpm = 3500 then
put gear
end if
Text.LocateXY (50,215)
if rpm = 1500 then
put gear
end if
% DRAWING THE CHART
Draw.Box (0,0,400,300,7)
Draw.Line (100,0,100,300,7)
Draw.Line (200,0,200,300,7)
Draw.Line (300,0,300,300,7)
%TITLING THE CHART
Text.LocateXY (35,310) % gear
put "GEAR"
Text.LocateXY (140,310) % speed
put "SPEED"
Text.LocateXY (240,310) % rpm
put "RPM"
Text.LocateXY (330,310) % torque
put "TORQUE"
end loop
end action
fork time_count
fork action
I am terribly sorry for all this code, its just the way its setup and stuff in order to show the values on the chart..