Welcome to
Mod The Sims
Online: 2250
News:
Have an account? Sign in:
pass:
If you don't have an account, why not sign up now? It's free!
Other sites: SimsWiki
Reply  Replies: 2 (Who?), Viewed: 984 times.
Search this Thread
Old 30th May 2012, 09:54 PM Default[Solved] Nested IF from hell... #1
MDM
Original Poster

Lab Assistant

Join Date: Nov 2004
Posts: 195
Thanks: 2634 in 7 Posts
7 Achievements


I'm usually good at these, but this one in particular had me screaming in pain cos I can't figure out how to accomplish what I want

This is what I have so far :

Code:
            protected override bool Test(Sim a, Stereo target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
if (target.Repairable.Broken || isAutonomous && a.Motives.GetValue(CommodityKind.Fun) > (float)Tuning.kMotiveThresholdToAllowConverse && a.Motives.GetValue(CommodityKind.Social) > (float)Tuning.kMotiveThresholdToAllowConverse)
{
return false;
}
if (target.InUse && a.HasTrait(TraitNames.Insane))
{
greyedOutTooltipCallback = new GreyedOutTooltipCallback(Common.greyedOutTooltipCallbackObjectInUse);
return false;
}
return a.HasTrait(TraitNames.Insane) && a.SimDescription.TeenOrAbove;
}


What I want to accomplish is, keeping everything as it is, just adding that the sim actually using the interaction with the object, will have the string available, so Test should return true.
I tried adding a == null but it makes the string available for all, even if in use.

Can anyone help me here, please?

Nothing's real. Nothing's unreal either.
The frontier between true and untrue is a shady fuzzy line.
Destiny, or maybe the long flight's time-span, shall decide the issue.
Last edited by MDM : 2nd Jun 2012 at 04:11 AM. Reason: Problem Solved
Old 30th May 2012, 10:25 PM #2
Consort
Field Researcher

Join Date: Oct 2005
Posts: 338
Thanks: 3605 in 88 Posts
10 Achievements


Not 100% sure what you're trying to do

target.IsActorUsingMe(a)

would check if a specific sim is using a specific stereo.

Purrhaps something like

Code:
 protected override bool Test(Sim a, Stereo target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)

            {

                if (target.Repairable.Broken || isAutonomous && a.Motives.GetValue(CommodityKind.Fun) > (float)Tuning.kMotiveThresholdToAllowConverse && a.Motives.GetValue(CommodityKind.Social) > (float)Tuning.kMotiveThresholdToAllowConverse)

                {

                    return false;

                }
if (!target.IsActorUsingMe(a))
{
                if (target.InUse && a.HasTrait(TraitNames.Insane))

                {

                    greyedOutTooltipCallback = new GreyedOutTooltipCallback(Common.greyedOutTooltipCallbackObjectInUse);

                    return false;

                }
}
                return a.HasTrait(TraitNames.Insane) && a.SimDescription.TeenOrAbove;

            }


Not sure what the insane trait check does, you will know better if you want that or not
Old 30th May 2012, 10:45 PM #3
MDM
Original Poster

Lab Assistant

Join Date: Nov 2004
Posts: 195
Thanks: 2634 in 7 Posts
7 Achievements


Quote:
Originally Posted by Consort
Not 100% sure what you're trying to do

target.IsActorUsingMe(a)

would check if a specific sim is using a specific stereo.

Purrhaps something like

//////

Not sure what the insane trait check does, you will know better if you want that or not


Yay! That did it!

The insane trait check is there because if the target was in use, sims without the insane trait would see the greyedout tooltip, which made no sense.

Now that I know what makes it work, I can nest it better and remove the insane trait check redundancy.

Thanks a lot, you saved my brain

Nothing's real. Nothing's unreal either.
The frontier between true and untrue is a shady fuzzy line.
Destiny, or maybe the long flight's time-span, shall decide the issue.
Reply


Section jump:


Powered by MariaDB Some icons by http://dryicons.com.