Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 unknown turning error
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Gold Flame




PostPosted: 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 Posted Image, might have been reduced in size. Click Image to view fullscreen.


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 Posted Image, might have been reduced in size. Click Image to view fullscreen.


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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Gold Flame




PostPosted: 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


Tony




PostPosted: Mon Jul 25, 2011 5:23 pm   Post subject: RE:unknown turning error

what does the error say?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Gold Flame




PostPosted: 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
Tony




PostPosted: 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?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Gold Flame




PostPosted: Mon Jul 25, 2011 8:55 pm   Post subject: Re: unknown turning error

colourback black
cls
Tony




PostPosted: Mon Jul 25, 2011 9:43 pm   Post subject: RE:unknown turning error

What is that supposed to do?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: