POV-Ray : Newsgroups : povray.newusers : declaring variables and float operations Server Time
5 Sep 2024 16:20:01 EDT (-0400)
  declaring variables and float operations (Message 1 to 7 of 7)  
From: DeathMacabre
Subject: declaring variables and float operations
Date: 18 Feb 2000 23:35:51
Message: <38AE1DAB.5AEDA8A1@fcmail.com>
after reading the pov ray help file i am left with a question
why does the following line not work?
#declare ZPos = RCon-XPos;
before this line the variables RCon and XPos are declared and set to 2.3
and 0 respectively
however, it returns an error saying that an object or directive was
expected but a while (the beginning of the next line) was found instead


Post a reply to this message

From: Bob Hughes
Subject: Re: declaring variables and float operations
Date: 19 Feb 2000 06:06:45
Message: <38ae7945@news.povray.org>
Seems alright to me.  Most likely explanation is that something else is wrong.
Try commenting sections out until you can get the error narrowed down if you
haven't tried that already anyway.
Make sure you have a #end placed after your #while loop, or some other possible
reason for the error.  They sometimes get misdirected when somethings wrong, not
often though.
I tried those 3 declares just to prove to myself it's okay and it was.

Bob

"DeathMacabre" <dea### [at] fcmailcom> wrote in message
news:38AE1DAB.5AEDA8A1@fcmail.com...
| after reading the pov ray help file i am left with a question
| why does the following line not work?
| #declare ZPos = RCon-XPos;
| before this line the variables RCon and XPos are declared and set to 2.3
| and 0 respectively
| however, it returns an error saying that an object or directive was
| expected but a while (the beginning of the next line) was found instead
|


Post a reply to this message

From: Steve
Subject: Re: declaring variables and float operations
Date: 19 Feb 2000 11:02:41
Message: <slrn8atcfv.an0.sjlen@zero-pps.localdomain>
On Fri, 18 Feb 2000 23:35:55 -0500, DeathMacabre 
<dea### [at] fcmailcom> wrote:
>after reading the pov ray help file i am left with a question
>why does the following line not work?
>#declare ZPos = RCon-XPos;
>before this line the variables RCon and XPos are declared and set to 2.3
>and 0 respectively
>however, it returns an error saying that an object or directive was
>expected but a while (the beginning of the next line) was found instead
>

Make sure that the case is the same in all of your declarations, eg, rCon will
be treated as a seperate variable to RCon, and make sure you've got all the 
semi colons in there at the end of the declarations.  If you're still having a 
problem after all of this, post some more code. 

-- 
Cheers
Steve              email mailto:sjl### [at] ndirectcouk

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.ndirect.co.uk/~sjlen/

or  http://start.at/zero-pps

  3:04pm  up 5 days,  2:07,  6 users,  load average: 2.40, 1.73, 1.30


Post a reply to this message

From: DeathMacabre
Subject: Re: declaring variables and float operations
Date: 19 Feb 2000 11:32:02
Message: <38AEC583.4BEBED05@fcmail.com>
checked case and there's nothing wrong with it, but here's the rest of the
code
#declare RCon = 2.3;
#declare XPos = 0.0;
#declare ZPos = RCon-XPos;
while (XPos <= RCon)
  sphere {< XPos,0, ZPos>,.1}
  sphere {< XPos,0,-ZPos>,.1}
  sphere {<-XPos,0,-ZPos>,.1}
  sphere {<-XPos,0, ZPos>,.1}
  #declare XPos = XPos+.1;
  #declare ZPos = RCon-XPos;
#end//while

DeathMacabre wrote:

> after reading the pov ray help file i am left with a question
> why does the following line not work?
> #declare ZPos = RCon-XPos;
> before this line the variables RCon and XPos are declared and set to 2.3
> and 0 respectively
> however, it returns an error saying that an object or directive was
> expected but a while (the beginning of the next line) was found instead


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: declaring variables and float operations
Date: 19 Feb 2000 11:55:57
Message: <38aecb1d@news.povray.org>
Fixed version:

#declare RCon = 2.3;
#declare XPos = 0.0;
#declare ZPos = RCon-XPos;
#while (XPos <= RCon)
  sphere {< XPos,0, ZPos>,.1}
  sphere {< XPos,0,-ZPos>,.1}
  sphere {<-XPos,0,-ZPos>,.1}
  sphere {<-XPos,0, ZPos>,.1}
  #declare XPos = XPos+.1;
  #declare ZPos = RCon-XPos;
#end//while


Post a reply to this message

From: DeathMacabre
Subject: Re: declaring variables and float operations
Date: 19 Feb 2000 14:11:45
Message: <38AEEAF0.E71680CE@fcmail.com>
oh
i just realized what i did
THANKS!!!
stupid syntax mistake huh?

Thorsten Froehlich wrote:

> Fixed version:
>
> #declare RCon = 2.3;
> #declare XPos = 0.0;
> #declare ZPos = RCon-XPos;
> #while (XPos <= RCon)
>   sphere {< XPos,0, ZPos>,.1}
>   sphere {< XPos,0,-ZPos>,.1}
>   sphere {<-XPos,0,-ZPos>,.1}
>   sphere {<-XPos,0, ZPos>,.1}
>   #declare XPos = XPos+.1;
>   #declare ZPos = RCon-XPos;
> #end//while


Post a reply to this message

From: Margus Ramst
Subject: Re: declaring variables and float operations
Date: 19 Feb 2000 18:49:13
Message: <38AF2C7E.C7F3C284@peak.edu.ee>
Hell, I had to paste both versions together to find the difference :P
I will never make a good proof-reader.

Margus

Thorsten Froehlich wrote:
> 
> Fixed version:
> 
> #declare RCon = 2.3;
> #declare XPos = 0.0;
> #declare ZPos = RCon-XPos;
> #while (XPos <= RCon)
>   sphere {< XPos,0, ZPos>,.1}
>   sphere {< XPos,0,-ZPos>,.1}
>   sphere {<-XPos,0,-ZPos>,.1}
>   sphere {<-XPos,0, ZPos>,.1}
>   #declare XPos = XPos+.1;
>   #declare ZPos = RCon-XPos;
> #end//while


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.