Welcome to
Mod The Sims
Online: 1162
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: 10 (Who?), Viewed: 2873 times.
Search this Thread
Old 22nd Sep 2017, 4:04 AM DefaultFunction main and attributes #1
gummilutt
Original Poster

Mad Poster

Join Date: May 2011
Posts: 6,947
Thanks: 10016 in 79 Posts
38 Achievements

View My Journal


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

If you have questions on how to use SimPE or WW, you're welcome to PM me.
Old 22nd Sep 2017, 7:18 AM #2
ankoyume
Field Researcher

Join Date: Aug 2013
Posts: 385
Thanks: 221 in 5 Posts
13 Achievements

View My Journal


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 !!!
Old 22nd Sep 2017, 4:26 PM #3
gummilutt
Original Poster

Mad Poster

Join Date: May 2011
Posts: 6,947
Thanks: 10016 in 79 Posts
38 Achievements

View My Journal


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.

If you have questions on how to use SimPE or WW, you're welcome to PM me.
Old 22nd Sep 2017, 4:40 PM #4
Chris Hatch
Lab Assistant

Join Date: Dec 2005
Posts: 210


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.
Old 22nd Sep 2017, 4:54 PM #5
gummilutt
Original Poster

Mad Poster

Join Date: May 2011
Posts: 6,947
Thanks: 10016 in 79 Posts
38 Achievements

View My Journal


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.

If you have questions on how to use SimPE or WW, you're welcome to PM me.
Last edited by gummilutt : 22nd Sep 2017 at 6:02 PM.
Old 22nd Sep 2017, 4:57 PM #6
whoward69
Instructor

Join Date: Jan 2015
Posts: 520
2 Achievements

View My Journal


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
Old 22nd Sep 2017, 4:59 PM #7
gummilutt
Original Poster

Mad Poster

Join Date: May 2011
Posts: 6,947
Thanks: 10016 in 79 Posts
38 Achievements

View My Journal


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.

If you have questions on how to use SimPE or WW, you're welcome to PM me.
Old 22nd Sep 2017, 5:48 PM #8
Lamare
just a girl

Join Date: Jan 2014
Posts: 670
Thanks: 3443 in 26 Posts
16 Achievements


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.

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Old 22nd Sep 2017, 5:56 PM #9
gummilutt
Original Poster

Mad Poster

Join Date: May 2011
Posts: 6,947
Thanks: 10016 in 79 Posts
38 Achievements

View My Journal


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.

If you have questions on how to use SimPE or WW, you're welcome to PM me.
Old 22nd Sep 2017, 6:01 PM #10
gummilutt
Original Poster

Mad Poster

Join Date: May 2011
Posts: 6,947
Thanks: 10016 in 79 Posts
38 Achievements

View My Journal


*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

If you have questions on how to use SimPE or WW, you're welcome to PM me.
Old 22nd Sep 2017, 6:07 PM #11
Lamare
just a girl

Join Date: Jan 2014
Posts: 670
Thanks: 3443 in 26 Posts
16 Achievements


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

Assorted mods: Moving out and job options
Apartment rent agreement mod - fresh update
Testers wellcome on Electrical box & Fertile land
Functional sofa bed is ready to be tested as well
Reply


Section jump:


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