SOLVED: Objects visible and invisible conditions

Started by barefoot, Thu 24/06/2010 21:02:33

Previous topic - Next topic

barefoot

Hi

Im trying to do a condition if some objects are Visible and some are not then do certain things.

Have used this:

Code: ags

if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)


also for multi conditions to apply if above code returns true

Is this legal scripting?

cheers for any help

-barefoot-


UPDATE... This now works ok and answered my question:

Code: ags

function region2_Standing()
{
if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)
Display("The Scales drop just enough to release the door");

if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)
cindy_bones.Say("Yes,Ive done it");

if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)
object[12].Move(425, 293, 4, eBlock, eAnywhere);

if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)
object[0].Move(206, 203, 4, eBlock, eAnywhere);

if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)
cindy_bones.Walk(254, 284, eBlock);
}








I May Not Be Perfect but I Have A Big Heart ..

Crimson Wizard

As I like to say: sometimes it is a good idea to ask questions, for it makes you find the answer yourself faster  ;D


Just one note - I noticed the condition is exactly the same in all 5 cases. Unless this is not a real code but sort of experiment, I'd suggest you optimize it like that:
Code: ags

if (!o44sc.Visible && !o35sc.Visible && !o22sc.Visible &&o28sc.Visible && o17sc.Visible)
{
   Display("The Scales drop just enough to release the door");
   cindy_bones.Say("Yes,Ive done it");
   object[12].Move(425, 293, 4, eBlock, eAnywhere);
   object[0].Move(206, 203, 4, eBlock, eAnywhere);
   cindy_bones.Walk(254, 284, eBlock);
}

barefoot

I will certainly use your method Crimson to cut down script size  :=

many thanks

-barefoot-
I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk