Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Mad Poster
Original Poster
#1 Old 22nd Sep 2017 at 3:04 AM
Default Function main and attributes
Hello!

I'm stuck on a project of mine, and for the life of me I can't figure out why. I want to run a BHAV periodically in the background, but only if the player wants it to. So I've set up a pie menu option that sets an attribute to 0 or 1 depending on if it's on or off. Used that setup plenty in the past. In function main I check if the attribute is set to 1, and if it is it calls the bhav. For some reason, it's refusing to work if the attribute check is there. I've tried every possible setup I can think of, including running the bhav straight and adding the attribute check inside the bhav itself, and creating a third bhav that runs both check and calls attribute. I've double, triple and quadruple checked that the lines setting and checking for attribute are setup correctly, and I've checked that OBJD is set to allow that number of attributes, and that nothing else is using that specific attribute.

If I remove the check, the bhav runs fine just when it's supposed to. If I put it back, it no longer works. I'm out of ideas. Any one have any suggestions on what the problem might be? I know the function main can handle attribute checks, because there is one in there to begin with (my object is based on an existing object). It makes no sense

Creations can be found on my on tumblr.
Advertisement
Instructor
#2 Old 22nd Sep 2017 at 6:18 AM
It might help to know what the object error is telling you. In tne meantime, I don't know if it will help but I'll try anyway : have you set the said attribute to zero in the init function ? It worked for me in some extent in the past ...

I believe in the "Thanks" button and its amazing powers !!!
Mad Poster
Original Poster
#3 Old 22nd Sep 2017 at 3:26 PM
There's no object error. The only thing that happens is that the bhav doesn't get run. I know it doesn't because it brings up a dialog when it does, and if the check is there it never happens. And I know the BHAV works since it works exactly as intended if I remove the attribute check. And yes, sorry, forgot to say that I set the attribute to zero in function init.

Creations can be found on my on tumblr.
Scholar
#4 Old 22nd Sep 2017 at 3:40 PM
You're right it makes no sense, force an error on the object and check the value of the attribute in the error log. It could be getting changed elsewhere, something as simple/silly as using a := instead of == in a test.
You don't need to start attributes (or Locals) as zero as that is always their default state, if you can't sort it if you can you attache the file maybe a second set of eyes can catch what you've missed.
Mad Poster
Original Poster
#5 Old 22nd Sep 2017 at 3:54 PM Last edited by gummilutt : 22nd Sep 2017 at 5:02 PM.
Glad I'm not the only one baffled. I had gdayars go over it for me yesterday, and she couldn't find anything wrong either. I've recoded it multiple times, in case it is some kind of little mistake I'm missing, in hopes I'd not make the same mistake that time. And I've gone over it so many times looking for a := or == that is off, since that would make sense. But nothing!

And yes, I know it's not technically necessary. I realized that when I tested attributes back when I first started using them, and it was obvious they start as 0, but neat freak in me thinks it's good to be 200% sure and if you set it in init then you are 200% sure

-Removedlink-. The relevant attribute is controlled by monitor needs-options in pie menu. If anyone tries to test in game you'll need a baby with one motive low enough to prompt the dialogs, which is -25 in energy/hunger, in need of a diaper change, or has social under 25. It's in general/child, costs 250. Heads up guid conflicts with Inge's baby monitor receiver.

Creations can be found on my on tumblr.
Instructor
#6 Old 22nd Sep 2017 at 3:57 PM
Not something as simple as the difference between My Attribute and Stack Object's Attribute (know that's caught me out in the past)

Just call me William, definitely not Who-Ward
Mad Poster
Original Poster
#7 Old 22nd Sep 2017 at 3:59 PM
I suppose that could be it, but I don't see why. Mine is set up the exact same as the other attribute check in function main, and that one does work. I use my attribute.

Creations can be found on my on tumblr.
just a girl
#8 Old 22nd Sep 2017 at 4:48 PM
I think, the mistake is in the action BHAVs of interactions. When you click with a sim, you need to change Stack Object's (object's) attribute, not My (sim's) attribute. This resulted in the object's attribute never being changed from initial 0.
Mad Poster
Original Poster
#9 Old 22nd Sep 2017 at 4:56 PM
I suppose that could be it I figured attribute changing was working, because pie menu reflects changes correctly, but perhaps since both action and guardian use my attribute that might be misleading. Thanks, I'll change them to stack objects attribute and test.

Creations can be found on my on tumblr.
Mad Poster
Original Poster
#10 Old 22nd Sep 2017 at 5:01 PM
*insert stupid face*

Well that did it! Thanks a billion Lamare and whoward (and everyone else for chiming in!). Changed action/guardian to stack objects attribute instead of my, and what do you know, suddenly it does work. From now on I won't assume changing is working just because pie menu changes accordingly

Creations can be found on my on tumblr.
just a girl
#11 Old 22nd Sep 2017 at 5:07 PM
Yes, the guardian ended up testing sim's attribute 4, instead of object's attribute 4, and that's why it reflected changes.
'My' and 'stack object' variables are tricky beasts -- easy to forget what's what. They often get me too
Back to top