PDA

View Full Version : ItemActive()



eFFeFFe
02-25-2004, 07:43 AM
Hi ... I'm not an expert in Lscript, I can't seem to find a command to get the active/inactive (visible in Scene Editor) state of an object ... Does anybody know a way to get this state ? Also, with ItemActive() you can set the active/inactive state but it needs a value, 1 or 2 or ... But it does not matter what (numeric?) value you give, it always toggles between on and off ...

Below is the script I'm working on, something very simple to set the active/inactive and visibility state of selected objects ... now, you change toggle between active and inactive, but if in your selection of objects are some inactive and other active, you can not set them all to inactive (or active), you can only toggle them to the other state ...

@warnings
@name HIDER
@version 2.3

generic
{
var1 = 1;
var4 = 1;

reqbegin("HIDER");
reqsize(472,165);

c1 = ctltext("","// Hider v0.3 //");
ctlposition(c1,20,13,475,13);

s1 = ctlsep(-1,185);
ctlposition(s1,0,40,475,5);

c2 = ctlchoice(">",var1,@"/ HIDEN /","/ B_BOX /","/ WIRES /","/ F_F_WIRES /","/ TEXTURE /"@);
ctlposition(c2,20,60,375,21);

c3 = ctlchoice("> CHANGE ACTIVITY",var4,@"/ YES /","/ NO /"@);
ctlposition(c3,20,99,214,21);

return if !reqpost();

var1 = getvalue(c2);
varA = getvalue(c3);
if (var1 == 3)
var1 = 5;
else
if (var1 == 4)
var1 = 6;
else
if (var1 == 5)
var1 = 7;

OBJECTOR = Scene().getSelect();
var0 = 0;
var2 = OBJECTOR.size();

reqend();

while (var0 < var2)
{
var0 = var0 + 1;
IDENTICATOR = OBJECTOR[var0].id;
SelectItem(OBJECTOR[var0].id);
ItemVisibility(var1);
if (varA == 1)
ItemActive(1);
}
}

GregMalick
03-09-2004, 10:56 PM
I didn't check out your code, but: obj = Scene().getSelect(); returns an array of all selected items.

You can then deal with the items as you wish.


obj = Scene().getSelect();
for(i=1 ; i<=obj.size() ; i++) { sItems += obj[i].name; }

This scrap of code happens to load the selected items into an array called sItems. I used this in a ctlPopup.

-nuff said

GregMalick
03-17-2004, 01:37 PM
Similarly,

Scene().visibility can be used to determine the display state of an object in the scene.

p122 LScript Reference has more details.:)