"Auto-Link" with HScript?
10453 13 2- hoknamahn
- Member
- 398 posts
- Joined: July 2005
- Offline
- edward
- Member
- 7694 posts
- Joined: July 2005
- Online
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)
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)
- hoknamahn
- Member
- 398 posts
- Joined: July 2005
- Offline
- jrwillette
- 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).
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
Freelance TD
- hoknamahn
- 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.
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
fx td @ the mill
- jrwillette
- 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.
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
Freelance TD
- hoknamahn
- Member
- 398 posts
- Joined: July 2005
- Offline
- george
- 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.
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.
- hoknamahn
- Member
- 398 posts
- Joined: July 2005
- Offline
- george
- 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.
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.
- hoknamahn
- Member
- 398 posts
- Joined: July 2005
- Offline
- pbowmar
- Member
- 7024 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
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
- hoknamahn
- Member
- 398 posts
- Joined: July 2005
- Offline
- jrwillette
- Member
- 49 posts
- Joined: July 2005
- Offline
hoknamahnYes, 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.
And bad too that if the parameter, having reference “!!ch()!!” to switch by hand, that it this reference
Jeff Willette
Freelance TD
Freelance TD
-
- Quick Links