PDA

View Full Version : Set variable for current selected subtool



Norman3D
03-24-10, 02:54 PM
I'm trying to set a variable for the current selected subtool. But I'm not able to get it to work. I want the script to go through every subtool and check whether it's visible or not.

The following zscript is my attempt at storing the subtool name.



[Loop,1024,
[VarSet,SubToolTitle,[IgetTitle, Tool:Current Tool]]
[If,[IModGet,Tool:SubTool,SubToolTitle] >= 7,
[IColorSet,255,0,0] //Red Debug Color
,
[IColorSet,0,255,0] //Green Debug COlor
]


[If,[IsEnabled,Tool:SubTool:SelectDown],
[IPress, Tool:SubTool:SelectDown]
,//else no select down so end of subtools & exit
[LoopExit]
]//end if
]//end loop

This however works with the DemoSoldier_1:



[Loop,1024,
[If,[IModGet,Tool:SubTool:DemoSoldier_1] >= 7,
[IColorSet,255,0,0] //Red Debug Color
,
[IColorSet,0,255,0] //Green Debug COlor
]


[If,[IsEnabled,Tool:SubTool:SelectDown],
[IPress, Tool:SubTool:SelectDown]
,//else no select down so end of subtools & exit
[LoopExit]
]//end if
]//end loop

I think I'm slimpy failing at trying to replace "DemoSoldier_1" with a variable.

Any ideas?


Thanks!

marcus_civis
03-24-10, 11:50 PM
You need to use [StrMerge] in order to use the variable in the subtool path. Also, note that in 3.5R3 the Mod values have changed because of the Remesh options - you need to use >= 16 for visibility.


[Loop,1024,
[VarSet,SubToolTitle,[IgetTitle, Tool:Current Tool]]
[If,[IModGet,[StrMerge,"Tool:SubTool:",SubToolTitle]] >= 16,
[Note,[StrMerge,"\Cff9923SubTool named \Cffffff",#SubToolTitle,"\Cff9923 is visible"],,1]
,
[Note,[StrMerge,"\Cff9923SubTool named \Cffffff",#SubToolTitle,"\Cff9923 is \CffffffNOT \Cff9923visible"],,1]
]


[If,[IsEnabled,Tool:SubTool:SelectDown],
[IPress, Tool:SubTool:SelectDown]
,//else no select down so end of subtools & exit
[LoopExit]
]//end if
]//end loop

Norman3D
03-25-10, 02:20 AM
D'oh! Of course! Thanks a lot!!