"Auto-Link" with HScript?

   10489   13   2
User Avatar
Member
398 posts
Joined: July 2005
Offline
Can I do the “Auto-Link” with HScript (i.e. bind between themselves two parameters)?
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
7725 posts
Joined: July 2005
Offline
Do you mean how to return values from hscript? If yes, then you can do it sort of like the Tcl way. You pass down the name of your variable as one of the parameters to your .cmd file. Then you can use the “set -p” to do it. There used to be an example in “help set” on how to do it but it seems to have been removed.

Basically, you do something like this: source myfile.cmd myvar
And then in your myfile.cmd file:
set -p $arg1=$newvalue
(where newvalue is the variable that contains your new value)
User Avatar
Member
398 posts
Joined: July 2005
Offline
I mean the “Auto-Link” field in the custom op Parameters page. See the pic.

I.e. I'm looking for analog for this thing in HScript.
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
49 posts
Joined: July 2005
Offline
I don't think you can do an “Auto-Link”, but you can script it. You have to add a channel then a key:
chadd -t 0 0 /obj/cam1/tx
chkey -t 0 -F ‘ch(“scale”)’ /obj/cam1/tx
This would add a channel to your tx parameter of your camera, and channel reference it's own scale parameter (which I do all the time :wink: ). Of course any relative or absolute channel reference will work (or any other expression).
Jeff Willette
Freelance TD
User Avatar
Member
398 posts
Joined: July 2005
Offline
jrwillette, it's not so simple as you think
I'm always do chadd & chkey if it's possible. But this method is not usable for parameter type “toggle” (I don't know why). Therefore I looking for analog of “Auto- link” in HScript.
Maybe I will switch toggles by callback script.
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
49 posts
Joined: July 2005
Offline
I think that method doesn't work with toggles because you can't keyframe a toggle, have you tried opparm?

This is where the syntax always messes with me ( I don't know what !! means but it seems to be very important), let me know if this workspparm /obj/myobj mytoggle ( ‘!!ch(“mychannel”)!!’ )
I haven't tested this out, but that is what opscript spits back for a toggle that has been previously Auto-Linked from using Operator Type Properties.

In your example above, it didn't look like you were trying to Auto-Link a toggle, so I assumed it was a parameter that could be keyframed.
Jeff Willette
Freelance TD
User Avatar
Member
398 posts
Joined: July 2005
Offline
Yes, opparm is usefull in callback scripts. But it's not same as autolinking (someone can explain the mechanism of autolinking?)
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
276 posts
Joined: July 2005
Offline
The Auto-Link field in the Type Properties dialog is there as a convenience to automatically link the parameter in question to the parameter specified in that field. So when you hit Accept (or Apply), the parameter mentioned in the Auto-Link (in the example above it would be /obj/model/tx) would get the equivalent of chadd/chkey mentioned above. Notice that when you open the Type Properties again, the Auto-Link field is empty. That's because it's already been applied.

As was also mentioned, the syntax for menus and toggles is different because these kinds of parameters cannot hold true channels.

Hope that clears up some of the mystery behind Auto-Link.

Take care,
George.
User Avatar
Member
398 posts
Joined: July 2005
Offline
Thanks, george, everything is crystal-clear now. But there is one question: where information about the parameter, which is used for autolinking, is stored? I don't see nothing similar in the Dialog Script.
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
276 posts
Joined: July 2005
Offline
In a strict sense, that information is only stored in the Type Properties Dialog while you are editing. When you are done (Apply or Accept), the information is used to create the channels and the “ch()” expressions in the auto-linked parameters. So I guess you could say that the information is stored in the parameters themselves (as channel references). But that seems confusing.

Just think of it as “when I close this dialog, the parameter in the Auto-Link field, will get a channel reference back to my parameter.”

Take care,
George.
User Avatar
Member
398 posts
Joined: July 2005
Offline
Hahaha… Sounds as an explanation of the term “magic”, given by Don Juan to Carlos Castaneda
Now I understand, that “Auto-Link” is the automatic creation of references like ch() or chsop() etc. Here now theme is closed.
Thanks!
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Actually, there are two ways to see a menu or toggle that is linked. The first in the UI is the little green dot that appears. That means it has a link somewhere.

The only way to find out where that link is is to go into the Textport and do “opscript -b OPNAME” where OPNAME is the operator you're interested in. That will show you the !!ch()!! syntax channel references.

It's a real shame you can't RMB Copy and RMB Paste Relative References with String fields, Menues and Toggles.

Cheers,

Peter B
User Avatar
Member
398 posts
Joined: July 2005
Offline
And bad too that if the parameter, having reference “!!ch()!!” to switch by hand, that it this reference loses.
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
49 posts
Joined: July 2005
Offline
hoknamahn
And bad too that if the parameter, having reference “!!ch()!!” to switch by hand, that it this reference
Yes, this is unfortunate. It would be great if there were a way to lock those parameters, It is very frustrating to find out that you've broken x amount of toggle references because you clicked the toggles without realizing it would delete the channel reference. This is also related to the fact that you cannot keyframe a toggle… this would make a good RFE.
Jeff Willette
Freelance TD
  • Quick Links