Change material and stop sound effects calls don't always work
#1 31-05-2014 

Hello, all.

I'm creating a skilling object that *should* activate an animated texture and start playing a sound effect when in use and then switch back to null and stop playing the sound effect when the sim stops using the object. On activating the object, both of the BHAVs seem to function exactly as they should , but on deactivating the object, both BHAVS seem to work about 50% of the time (sometimes the beam shuts off and the sound effect keeps playing, sometimes the sound effect stops and the beam remains on, sometimes both remain on, sometimes both are deactivated). I don't know where I went wrong; it seems like it should work all the time.

I've included the object in the attachment. Because it's a slave object, I included the two objects it gets its textures from. By the way, it's the Spectroscope object, and it's found in Electronics/Misc.

Any help would be much appreciated.

Attached File(s)
.rar  Buggy Spectroscope.rar (Size: 495.99 KB / Downloads: 73)
ocelotekatl, proud to be a member of LeeFish since Nov 2013.
(This post was last modified: 05-06-2014 04:10 AM by ocelotekatl.)

#2 05-06-2014 
I completely missed this, sorry! Good thing you mentioned me. Smile

Unfortunately I'm on my non-simming netbook right now (Win 8 and Intel graphics... yeah, not even gonna try) , won't be back on my big computer until Saturday, but if you can wait until then I'd be happy to have a look and see what I'd can see. Sounds weird that it works some of the time - unless you're coin-flipping it, that is, but I'm going to assume you're not. Tongue

#3 05-06-2014 
No worries, sister. I completely understand and I'd grateful for any guidance at all.

I think the issue with the Start/Stop sound effects call is that the wee operands are in the wrong box (fifth box in the top row instead of fourth) but when I try correcting this, the sound doesn't work at all. With the Change Material call, I've tried it both as a material and a moving texture. I don't know if it's the operands themselves, the way the command lines are routed, or some other obvious thing that I'm completely missing. I'm just so ham-fisted with BHAVs.Sad

By some of the time, what I mean is almost always. Sometimes cancelling the action turns off both the material and the sound effect, but most of the time it stays on. The object has two options. Sometimes if the sim chooses "Analyze Age of Mineral" and the sound and material remain active, then the sim runs "Analyze Composition of Mineral" and cancels the action immediately, both the material and the sound will shut off. Sometimes it's just the material. Less frequently it's just the sound. I'm baffled.

#4 05-06-2014 
Okay, there's a little troubleshooting I can do without SimPE. First of all, what did you clone it from? (Just so I know what we're working with.) And when you stop the sound and the change material, do you do it in just one or two places (at one point in one or two BHAVs), or do you do it everywhere you have a line that returns true with a pretty little green T? Because onerous as it might sound, I'm thinking that's what you need to do to make sure it stops the sound and changes the material no matter where you are in the BHAV chain when you cancel the action. I'd have to look at it in SimPE to say for sure, though.

Trying to remember if I've done anything with sound effects lately that you could reference, but I'm drawing a blank. With my music boxes, though, I change the material on the figurines, so if you need a reference for that you can look at those. Smile

Edit: Wait! My fireplaces! Unless I'm completely confused they have a crackling fire sound effect. I don't stop it, though, it just starts and then keep going, but it's just one operand you change to stop it... unless I'm confusing it with effects, I might be. Also, it might be set to My Object ID whereas yours should probably be Stack Object ID; depends on where it's called from. Might still be worth a look for reference, though.
(This post was last modified: 05-06-2014 03:07 PM by NixNivis.)

#5 06-06-2014 
1. The object is a fourth- or fifth-generation clone of Dr. Pixel's sklling motor with the BHAVs reworked by Sophie-David and by me (It works a lot like my other skilling consoles).

2. Each of the four commands (beam on, beam off, start sound, stop sound) is written as a private, 1-line BHAV. I added four command lines to the skill BHAVS in the appropriate places, referencing the private BHAVs. These are the only place that the skilling BHAVs reference the effect BHAVs.

I just figured it out! Turns out that the Whew! anims (the last BHAV in the chain- Animate Sim) all return true, and the anim that's played is randomly determined by two coin flips.. So I changed the position of the command lines so that all of those animate sim calls now route to the BHAVs that turn off the sound and the beam. Then the command line that shuts off the beam returns true. I even made each interaction load a different beam texture and play a different sound. I still have a bit of toinking to do, but it works. You're a genius, Nix!

#6 06-06-2014 
Yay! So glad you got it to work, and glad I could help! Smile But nah, I'm no genius, I've just learned from all the mistakes I've made in the past. Tongue


Sorry, that is a members only option