Hscript syntax

   10489   13   1
User Avatar
Member
196 posts
Joined: July 2005
Offline
I'm trying to create a string that will be used as a parm. The quote syntax is slowly killing me.


for i = 1 to 10

set colour_R = ‘pic(“/img/img2/Line_Color”,0.5,’ + $i + ‘,R)’
opparm $node3 color ( $colour_R 0.5 0.3 1 )

end


This is the jist of it. The priority and limitations of ' and ` and " are confusing.

Does the back slash work for more than protecting the hash character.

??

Cheers

( acknowledged, having a UV value going from 1 to 10 is daft )
Henster
User Avatar
Member
4336 posts
Joined: July 2005
Online

for i = 1 to 10

set colour_R = ‘pic(“/img/img2/Line_Color”,0.5,’ + $i + ‘,R)’
opparm $node3 color ( $colour_R 0.5 0.3 1 )

end


What are you trying to do? The syntax can be completely different based on the result you want.

Do you want the pic() expression to be evaluated? Do you want the pic expression to be in the channel?

Details details details.

if(coffees<2,round(float),float)
User Avatar
Member
196 posts
Joined: July 2005
Offline
Sorry, not concentrating.

I'd like the expression in the channel, not evaluated.

so the channels read:

pic(“/img/img2/Line_Color”,0.5,1,R) 0.5 0.3 1

pic(“/img/img2/Line_Color”,0.5,2,R) 0.5 0.3 1
….

What happened to the RFE on a `remove problem` button? I'm sure it was suggested…

Cheers
Henster
User Avatar
Member
12995 posts
Joined: July 2005
Offline
Henster
Sorry, not concentrating.
What happened to the RFE on a `remove problem` button? I'm sure it was suggested…



Right now this is implemented in the web browser as “New Topic” in which you may write the problem in simple english and a panel of enthusiasts are all ready to help.
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
User Avatar
Member
196 posts
Joined: July 2005
Offline


Great! Could the same enthusiasts help with an `upgrade system` button?
Henster
User Avatar
Member
8080 posts
Joined: July 2005
Offline
Type your expression into a parameter and then run opscript on that node. That should give you the correct code.
User Avatar
Member
196 posts
Joined: July 2005
Offline
Hi,

Getting the string into the channel is not a problem. Its the concatenation of the mixture of variables and strings that is confusing me. Even trial and error just didn't seem to be getting me anywhere.

set colour_R = ‘pic(“/img/img2/Line_Color”,0.5,’ + $i + ‘,R)’

?

Thanks
Henster
User Avatar
Member
8080 posts
Joined: July 2005
Offline
Then you want to evaluate the expression in your loop then. You can't put expressions into parameters via opparm.

Assuming that, then you want:
set colour_R = `pic(“/img/img2/Line_Color”,0.5,$i,D_CR)`
User Avatar
Member
196 posts
Joined: July 2005
Offline
I'll try re-phrasing this. Must be going wrong somewhere.

I would like $i to evalute in the loop, but the rest to remain.

I'm creating multiple nodes and inserting this expression. So in the channel box for red reads:

Node 1:
pic(“/img/img2/Line_Color”,0.5,1,R)

Node 2:
pic(“/img/img2/Line_Color”,0.5,2,R)

Node 3:
pic(“/img/img2/Line_Color”,0.5,3,R)

.
.
.

Hope this makes it a little clearer

H
Henster
User Avatar
Member
8080 posts
Joined: July 2005
Offline
Right, read the first reply I wrote in this thread. See also the recent question on opparm in the mailing list.
User Avatar
Member
196 posts
Joined: July 2005
Offline
chadd -t 0 0 strip_colour colorr
chkey -t 0 -v 1 -m 0 -a 1 -F ‘pic(“/img/img2/Line_Color”,0.5,1,R)’ strip_colour/colorr

is the opscript ouput from the first node when I make the nodes manually.

Type your expression into a parameter and then run opscript on that node. That should give you the correct code.

I don't see how this opscript output helps me with sticking the string together in hscript.

The value of $i in reality is evaluated elsewhere in the script and is usually different upon each execution, as is the number of nodes. So just writing out each expression by hand would not work.

I understand now that chadd and chkey are required as opposed to opparm.
Henster
User Avatar
Member
941 posts
Joined: July 2005
Offline
Hey Henster,

Have you tried just catting the two ends with ‘$i’ in the middle?… something like:
chadd -t 0 0 strip_colour colorr
chkey -t 0 -v 1 -m 0 -a 1 -F `strcat(strcat('pic(\“/img/img2/Line_Color\”,0.5,',$i),“,R)”)` strip_colour/colorr

Butt-ugly, I agree!… but; who knows, it might just work
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
196 posts
Joined: July 2005
Offline
Thanks Mario. Its working now.

It was those back slashes.

I easily get confused with the butt-ugliness of those cat functions. The big + signs work better for me….

chkey -t 0 -v 1 -m 0 -a 1 -F `“pic(\”/img/img2/Line_Color\“,0.5,” + $i + “,R)”` strip_color/colorr

Thanks again,

H
Henster
User Avatar
Member
941 posts
Joined: July 2005
Offline
Henster
It was those back slashes.

I easily get confused with the butt-ugliness of those cat functions. The big + signs work better for me….



Hehe… yup; forgot all about them fancy + signs (still stuck in the stone age over here) … and they were all over the thread too, lol! (note to self: next time read the whole thread before posting)

But look at it on the bright side: using the functions reminds you that what you're building is an expression. The + operators also become functions (internally, something like string.operator+()), but it's harder to see this. Which means that both forms need the single back-quotes surrounding the whole thing…. which you were also missing in your attempts…. not just the back slashes.

There; I justified my archaic, butt-ugly ways. Ha!
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
  • Quick Links