Quick Reply
Search this Thread
Mad Poster
Original Poster
#1 Old 17th Feb 2018 at 5:10 PM Last edited by simmer22 : 17th Feb 2018 at 5:22 PM.
Default Deleting BHAV entries/strings safely
I've got a few objects I've cloned from other objects in the same set, and noticed a little too late that I'd made the originals AL shiftable - but a few of the new objects aren't meant to be.

How would I go about deleting it safely, without causing any weirdness in the BHAV?

I've tried "delete", "Pescado's delete" and "delete to end", but they leave a question mark in the place of the "T" (true) in the list, and I've got no clue if that's safe...

I know I can remake the object, but I'd rather know how to fix it so I don't have to remake so many files.
Screenshots
just a girl
#2 Old 17th Feb 2018 at 8:15 PM
Could you please show us a screenshot? Question marks are not good, unless a node that has them is unlinked (=won't be executed). Everything should have a proper continuation and ending in BHAVs, and a question mark means that the code doesn't know where do you want it to go after that node.

UPD. You added the screenshot while I was typing.

OK. So. Select node 3 and change True Target to 'Return TRUE' (instead of 4). Then node 4 becomes unlinked and you can delete it either by Delete or by Pescado's delete, won't matter in this case. You can even leave it there (though it won't be tidy). What's important is the BHAV will now return true - like inits should.
Mad Poster
Original Poster
#3 Old 18th Feb 2018 at 2:45 AM
Looks like it worked. Thanks :D

(Was going to say it didn't work, but realized I'd done the "false target" instead of the "true target"... )
just a girl
#4 Old 18th Feb 2018 at 3:35 AM
It may help to look at BHAVs like corridors with turns - labyrinth of some sort. Inside every node, the game solves equation / performs whatever it's instructed in that node and the result is either true or false (like yes or no). Targets indicate where you go next.
So, you start at 0 and walk your way to exit / end. The end of BHAV is when you reach 'Return True' or 'Return False'. Well, I should say, it's a proper end. If you reach a turn that points to 'Error' or non-existent node ('?'), your BHAV will end too, but with an error (dead end, you lose). There may be multiple ends and they may be in different parts of the 'labyrinth'. The paths leading to those ends may be different as well - depends on where the nodes point.
When you deal with bhavs, you should follow the arrows and make sure that the path is want you want it to be, and that it doesn't lead to error-traps or eternal loops.
As for Init functions, they should always Return True in the end. Init is like birth of an object: if it fails to init, it doesn't live.
Lab Assistant
#5 Old 17th Mar 2025 at 1:47 AM
@Lamare I find it confusing to tell what "Return True" means to the game however!

Sometimes I see checks return false out of BHAVS. Sometimes I see them return true out of BHAVS. But sometimes they don't make sense! For example, if a lot isn't liveable, then the BHAV "Add to Total Energy", which you can see how it works with Simler's utility mod, RETURNS TRUE if the Lot is not liveable. Which makes no sense to me!

Didn't like this world so I built my own - yourSims2guru
Scholar
#6 Old 17th Mar 2025 at 6:32 AM Last edited by jonasn : 17th Mar 2025 at 7:50 AM.
It means different things in different contexts. Sometimes either return value leads to the same result where the function just ends and we move on. You can test the lot zoning. If livable, do x/y/z, else end without doing it (return true). It is not always a test whether something happens or not. You can think of the function as "Try Adding to Total Energy". You try to do it if possible, and end if not. The caller doesn't need to know whether addition to the energy bill happened. In other cases there is a negation of a negation because of unfortunate naming and the != logical operator, and you just have to scratch your head and unpack it.

If the function you are modifying doesn't return false, you probably should make it without checking what the parent caller expects, or you can get the ‘undefined transition’ exception.
Back to top