Variable has no value? But I put a value...
Author |
Message |
Destro
|
Posted: Mon Jan 13, 2014 12:59 pm Post subject: Variable has no value? But I put a value... |
|
|
What is it you are trying to achieve?
I want 'C' to clear the screen. I want 'R' to restate the instructions.
What is the problem you are having?
When I run the program, it says variable has no value even though I put
var leedle : array char of boolean
Describe what you have tried to solve this problem
I have tried putting it in the loop, in the 'if' statement. Out of the loop, out of the 'if' statement. I have tried different variables. None of it works.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
setscreen ("graphics:800;600,offscreenonly,nobuttonbar")
View.Set ("offscreenonly")
Draw.FillBox (0, 0, 1500, 1500, white)
var leedle : array char of boolean
var x, y : int := 550
x := 100
y := 100
Draw.FillBox (0, 0, 6000, 6000, 55)
Draw.FillBox (30, 30, 770, 570, 54)
Draw.Box (30, 30, 770, 570, black)
%Background
var leedle : int := Pic.FileNew ("turings.jpg")
%Sets picture for front page
var intfont: int
intfont := Font.New("Copperplate Gothic Bold:54")
Font.Draw ("Turing", 265, 470, intfont, 42)
Font.Draw ("Etch-a-Sketch", 120, 400, intfont, black)
Draw.FillBox (270, 130, 537, 353, 55)
Pic.Draw (leedle, 280, 140, picCopy)
%Actually draws picture for front page
var intfont2: int
intfont2 := Font.New("Impact:18")
Font.Draw ("Use the arrow keys to move and draw. Ball CAN move diagonally", 92, 100, intfont2, black)
Font.Draw ("Use the 'C' key to clear the screen. Press any of the arrow keys to begin!", 58, 70, intfont2, black)
Font.Draw ("Use 'R' to repeat the instructions any time. Warning: Will Clear Screen!", 62, 40, intfont2, black)
%beginning instructions
delay (1500)
cls
loop
const val : int := parallelget
if ((val div 16) mod 2 = 0) then
y := y + 3
Draw.FillOval (x, y, 7, 7, 54)
delay (5)
View.Update
Draw.FillOval (x, y, 7, 7, black)
end if
if ((val div 32) mod 2 = 0) then
y := y - 3
Draw.FillOval (x, y, 7, 7, 34)
delay (5)
View.Update
Draw.FillOval (x, y, 7, 7, black)
end if
if ((val div 64) mod 2 = 0) then
x := x + 3
Draw.FillOval (x, y, 7, 7, 48)
delay (5)
View.Update
Draw.FillOval (x, y, 7, 7, black)
end if
if ((val div 8) mod 2 = 0) then
x := x - 3
Draw.FillOval (x, y, 7, 7, 40)
delay (5)
View.Update
Draw.FillOval (x, y, 7, 7, black)
end if
if (x >= maxx - 7) then
x := x - 3
%Sets maximum parameters for x value
end if
if (x = 7) then
x := x + 3
%Sets minimum parameters for x value
end if
if (y >= maxy - 7) then
y := y - 3
%Sets maximum parameters for y value
end if
if (y = 7) then
y := y + 3
%Sets minimum parameters for y value
end if
if leedle ('c') then
cls
View.Update
Draw.FillOval (x, y, 7, 7, black)
end if
end loop
|
Please specify what version of Turing you are using
4.1.1
Thanks guys |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Jan 13, 2014 1:06 pm Post subject: RE:Variable has no value? But I put a value... |
|
|
'array char of boolean' is a type, not a value. Have a look at Input.KeyDown. |
|
|
|
|
![](images/spacer.gif) |
Destro
|
Posted: Mon Jan 13, 2014 1:13 pm Post subject: Re: RE:Variable has no value? But I put a value... |
|
|
Insectoid @ Mon Jan 13, 2014 1:06 pm wrote: 'array char of boolean' is a type, not a value. Have a look at Input.KeyDown.
Could you explain further please? I am very new to turing D: |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Mon Jan 13, 2014 5:46 pm Post subject: RE:Variable has no value? But I put a value... |
|
|
var num : int := 5
num's value is 5, its type is int.
http://compsci.ca/holtsoft/doc/ |
|
|
|
|
![](images/spacer.gif) |
Destro
|
Posted: Mon Jan 13, 2014 7:50 pm Post subject: RE:Variable has no value? But I put a value... |
|
|
I got it working, thanks guys! |
|
|
|
|
![](images/spacer.gif) |
|
|