unknown turning error
Author |
Message |
Gold Flame
|
Posted: Sun Jul 24, 2011 11:28 pm Post subject: unknown turning error |
|
|
What is it you are trying to achieve?
Make a character walk and stand in four different positions/directions
What is the problem you are having?
the code looks right to me but turing wont run it. it gives me an error message. when i folow the directions to add '.' it still doent work. or look like it should
gives me this
Describe what you have tried to solve this problem
i trieid changing var to 'var' as suggested by turing. ive also tried changig ariable names aas it gives me an error messaga on my variable "p1standforward"
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") % Enter graphics mode
setscreen ("graphics:800;600") %
setscreen ("nocursor") % Turn off cursor
setscreen ("noecho") % Do not echo keys
colorback (black)
cls
var Control : array char of boolean
var VERT, HORI : int
%%%%%%%%%%%%%%%%% New Workspace "christian alchemy" %%%%%%%%%%%%%%%%%
%%%%%%%% Standing player 1 vars%%%%%%%%%%
var p1standforward
var p1standback
var p1standleft
var p1standright
%%%%%%%% END Standing player 1 vars%%%%%%%%%%
%%%%%%%%%%%%%%%%%% p1 Picture input commands
p1standforward := Pic.FileNew ("p1-Standing-forward.bmp")
p1standback := Pic.FileNew ("p1-Standing-back.bmp")
p1standleft := Pic.FileNew ("p1-Standing-left.bmp")
p1standright := Pic.FileNew ("p1-Standing-right.bmp")
%%%%%%%%%% END p1 Picture input commands
%%%%%%%%%% p1 sprite draw procedures
procedure StandForward
Pic.Draw (p1standforward, HORI, VERT, picMerge)
end StandForward
procedure StandBack
Pic.Draw (p1standback, HORI, VERT, picMerge)
end StandBack
procedure StandLeft
Pic.Draw (p1standleft, HORI, VERT, picMerge)
end StandLeft
procedure StandRight
Pic.Draw (p1standright, HORI, VERT, picMerge)
end StandRight
%%%%%%%%%% END p1 sprite draw procedures
%%%%%% p1 movement
loop
Input.KeyDown (Control )
if Control (KEY_DOWN_ARROW) then
VERT := VERT - 1
end if
if Control (KEY_UP_ARROW) then
VERT := VERT + 1
end if
if Control (KEY_RIGHT_ARROW) then
HORI := HORI + 1
end if
if Control (KEY_LEFT_ARROW) then
HORI := HORI - 1
end if
end loop
%%%%%%%%%%%%%%%%%%%%%%%incomplete loop
|
Please specify what version of Turing you are using
i think 4.1.1.0 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Sun Jul 24, 2011 11:57 pm Post subject: RE:unknown turning error |
|
|
That should be read as:
- Syntax error associated with token var
- expected to find token :, but couldn't
That is, you are missing the declaration of variable's type. E.g.
code: |
var p1standforward : int
|
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Gold Flame
|
Posted: Mon Jul 25, 2011 4:51 pm Post subject: Re: unknown turning error |
|
|
so im just missing :int. thanks i thought i was going to have to use a whole different programming language
, but as soon ad
EDIT. K i added : var to my program and now i can get the run window to open but my character is not displayed ans as soon as i hit an arrow it gives me an error for that arrow
Quote:
setscreen ("graphics") % Enter graphics mode
setscreen ("graphics:800;600") %
setscreen ("nocursor") % Turn off cursor
setscreen ("noecho") % Do not echo keys
colorback (black)
cls
var Control : array char of boolean
var VERT, HORI : int
%%%%%%%%%%%%%%%%% New Workspace "christian alchemy" %%%%%%%%%%%%%%%%%
%%%%%%%% Standing player 1 vars%%%%%%%%%%
var p1standforward : int
var p1standback : int
var p1standleft : int
var p1standright :int
%%%%%%%% END Standing player 1 vars%%%%%%%%%%
%%%%%%%%%%%%%%%%%% p1 Picture input commands
p1standforward := Pic.FileNew ("p1-Standing-forward.bmp")
p1standback := Pic.FileNew ("p1-Standing-back.bmp")
p1standleft := Pic.FileNew ("p1-Standing-left.bmp")
p1standright := Pic.FileNew ("p1-Standing-right.bmp")
%%%%%%%%%% END p1 Picture input commands
%%%%%%%%%% p1 sprite draw procedures
procedure StandForward
Pic.Draw (p1standforward, HORI, VERT, picMerge)
end StandForward
procedure StandBack
Pic.Draw (p1standback, HORI, VERT, picMerge)
end StandBack
procedure StandLeft
Pic.Draw (p1standleft, HORI, VERT, picMerge)
end StandLeft
procedure StandRight
Pic.Draw (p1standright, HORI, VERT, picMerge)
end StandRight
%%%%%%%%%% END p1 sprite draw procedures
%%%%%% p1 movement
loop
Input.KeyDown (Control)
if Control (KEY_DOWN_ARROW) then
VERT := VERT - 1
end if
if Control (KEY_UP_ARROW) then
VERT := VERT + 1
end if
if Control (KEY_RIGHT_ARROW) then
HORI := HORI + 1
end if
if Control (KEY_LEFT_ARROW) then
HORI := HORI - 1
end if
end loop
%%%%%%%%%%%%%%%%%%%%%%%incomplete loop
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
Gold Flame
|
Posted: Mon Jul 25, 2011 5:28 pm Post subject: Re: unknown turning error |
|
|
"variable has no value" i trie setting a value to VERT and HORI a few times (which the error is in reference too) takes away the error message but still just prints a black screen. i think im a turng failure |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Mon Jul 25, 2011 6:38 pm Post subject: RE:unknown turning error |
|
|
Is it not supposed to be just a black screen? That is, where in your code do you print anything else? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Gold Flame
|
Posted: Mon Jul 25, 2011 8:55 pm Post subject: Re: unknown turning error |
|
|
colourback black
cls |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|