Replies: 59 (Who?), Viewed: 20915 times.
Page 1 of 3
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#1 Old 24th Dec 2010 at 5:13 PM Last edited by Phaenoh : 19th Aug 2011 at 7:01 AM.
Default Social and Pop up Menu Help
I'm poking around at an object I've had on my to do list for a while and the reason it hasn't been finished off yet is because I've got no idea how to make it do what I want it to do. BHAVs are my constant battle.

I'm trying to figure out how to make the object pop up the UI box that you get from the telephone, a list of all the sims you know, except, I want it to list all the sims instead. I had downloaded a mod that just made your sim know everyone but it took forever to load the phone menu so I took it out. I can't seem to find it anymore to look at, so I'm kinda stuck.

The second thing I have no idea how to do is after that menu pops up with all the sims in it, I want to be able to click one of them and then that sim becomes known to your sim in the relationship panel. 0/0, no friendship change. I've never dealt with Socials before, so I'm at a complete loss.

Any help? Thanks!
Advertisement
Retired Duck
retired moderator
#2 Old 30th Dec 2010 at 8:55 AM
I was quietly hoping that someone who had more experience in this than me might reply first, but apparently no such luck... This isn't part of the game I've ever really worked with, but here's what I've found from a little bit of digging.

The UI box from the telephone is one of the standard game dialogs. You can get it to display using opcode 0x0024, with the Dialog Type of "Phone Book - Invite". The sims which show up in that dialog are read from the SO's object array 0. To fill that with all the sims, you'll need to:

Clear array 0 -> [prim 0x0076] Array Operation (Stack Object's object array 0x0000, Clear contents)
Loop through all the sims in the neighbourhood using a set to next (sim), each time moving the sim's ID into a local.
Add each of those sims to the array -> [prim 0x0076] Array Operation (Stack Object's object array 0x0000, Unshift onto the front of the array: Local 0x0000)
Then call the dialog

You'll have to do some Stack Object shuffling though, to make sure that the right sim's array is being populated at the right time. There are a few examples in the phone call objects, with names like "Call - Load Sim Array" if you want to look at how that stuff works.

To make a sim known to another sim, you need to adjust the short and long term relationships. There are globals for each of these:
[global 0x020D] Soc&Rel: Adjust STR to Other Sim
[global 0x0216] Soc&Rel: Adjust LTR to Other Sim

You might also need to add the necessary memories of meeting, but that's probably optional.

There's an object doing something along those lines here, which you might like to take a look at:
http://modthesims.info/download.php?t=293941
It's listing existing friends and making them best friends, but the process is similar.

Good luck with it!
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#3 Old 2nd Jan 2011 at 5:29 AM Last edited by Phaenoh : 1st Mar 2011 at 4:26 AM.
And I was silently hoping the delay in your response was merely due to the holidays. Thanks for coming to my rescue!

I added what I interpreted to be your instructions and it threw an error. See image attachment.
Error - Bad Stack Object Array (John)

I'm creating a phone directory. The idea is that all sims will be listed in the dialog box and then when you click on a sim, they are now 'known' to you and you can call them. I'm thinking I won't need to do the SO shuffling, because its the same list of sims every time, all of them. I'm not sure how the phone -invite dialog box works yet, so that will change somethings I think. In my head looking up the number and actually going to call them are two separate actions, but whatever works out easier will be what I go for.

Btw, I'm super proud I mostly understood everything you said this time. I think I'm learning!
Screenshots
Retired Duck
retired moderator
#4 Old 4th Jan 2011 at 6:03 AM
Definitely learning!

First thing is that a set-to-next loop needs to look a bit more like this (SO == Stack Object):

1: SO ID := 0
2: Set To Next (whatever) [true => 3, false => 4]
3: whatever happens in the loop [true => 2]
4: whatever happens after the loop

That way, the "whatever happens in the loop" part gets run for every possible value that the set-to-next finds. In the case of your BHAV, that means that 0x2 false should point to 0x4, and 0x3 true should point to 0x2.

You will still need to do the SO shuffling because of lines 2 and 3. Line 2 is controlling a loop, and each time it gets run it looks at the current ID of the SO, then counts up until it either hits another object of the correct type, or until it runs out of objects. When it finds one, it assigns that to the SO ID. So basically, every time you run this line, the SO will get changed.

Line 3 is adding the new object to the Object Array stored inside the current SO. Since the SO has just been changed by the Set To Next, this will cause Bad Things To Happen.

You want to take the ID of the object found by the Set To Next, and copy that into a local. You then want to set the Stack Object back to the original object, so that you can store the newly found Sim's ID into that original object's array (I can't remember if the original object was the sim calling or the phone book object... I'd have to look at one of the objects which uses a dialog to be sure).

You then need to set the SO back to the value stored in the local, so that the next time Set To Next runs, it starts counting from where it left off.

Looking up the sim and making the call are definitely different beasts, so that shouldn't be a problem for you.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#5 Old 6th Jan 2011 at 5:30 AM
Okay, so that time I really didn't understand much, I think my brain decided one epiphany was enough and gave up. I looked up that Call - Load Sim Array BHAV and tried to just use that one, but it didn't work either. I extracted it and imported it, Fix Int and everything, no luck. Sim walked up to my object and then jump bugged away. I don't really know how to debug bhavs yet, getting a crash course on that prolly should have been on my list of things to learn a while ago.

Should I use the existing BHAV cuz it does mostly exactly what I need, or try to cobble one together myself?
Retired Duck
retired moderator
#6 Old 6th Jan 2011 at 9:23 AM
I'd actually suggest you borrow liberally from the BHAVs here:
http://modthesims.info/download.php?t=293941

They'll still need some fairly significant tweaking, but it will get you pretty close.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#7 Old 7th Jan 2011 at 4:04 AM Last edited by Phaenoh : 7th Jan 2011 at 5:23 AM.
Ok, now I have no idea what is going on. I downloaded that and loaded it in my game and it worked fine. Then I did some tweaking to it (copied the BHAVS to my object and removed a few lines of code that never got called) and it Disabled Custom Content in my game, no matter how many times I reloaded it I couldn't get it to Enable CC again. It even seems to have reset things like my neighborhoods and Game Tips, like it thinks MG was just installed. Then I took the things out and now I can't even get my game to load at all. I noticed that a Config folder ended up in my Downloads folder. I took that out and it still doesn't load, I think it might have gotten moved from somewhere, but I can't tell from where. This is really weird to me and very frustrating.

Ok, I tried stuffing this into an AGS and I got roughly the same problem. A fresh copy of the BFF mannequin is the only thing in its download folder, and I can't get it to Enable CC. Did I break my game?

Found more out, reading the comments in that thread, it sounds seriously buggy. I'm gonna take that out and see if I can't do damage control on it.

Gah! Can't fix!!
Retired Duck
retired moderator
#8 Old 8th Jan 2011 at 12:15 AM
Hmm. That's very strange. I'll have a look at it later, see if I can tell what's breaking.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#9 Old 8th Jan 2011 at 7:58 PM Last edited by Phaenoh : 1st Mar 2011 at 4:25 AM.
Simsample helped me fix my game, but that piece of CC still has a heck of a lot of buggy reports, I'm looking at a couple of different mods instead to see if they can be useful instead. I'm very uneasy about using bad CC as a base. After all the problems I had with my slides, I'm not looking for that headache again.

This one by monique seems to already do exactly what I need. Hers has more options and its not really an intuitive mesh, so I'll keep working on mine.

Edit: /me does a happy little spiffy dance. I'm almost done with this project and aside from it nearly eating my entire save game file, its being a breeze. I love it when someone has done all the hard work for me. I do need to figure out how to remove the pets from the menu though, pets aren't usually listed in a phone book. PROGRESS!!!

More Editing: I'm running into two problems now, the sim array loads up everything that the current sim doesn't know; birds, cats, dogs, grim reaper, penguin, robots. Isn't there a 'verify - am i human' thing I can run? Second problem, I can't seem to get it to pay attention to its placement flags. I vaguely remember having this problem with my garden windmill and not being able to solve it either. There is prolly a bunch of extra code in there as well, I didn't know what half of it did so I didn't pull it out.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#10 Old 16th Jan 2011 at 5:38 AM
Ok, I've been plugging away at this all week and can't seem to make any progress with it. I have no idea why it won't place, move_objects is the only way to get it to sit. Also, I've poked at every single object that loads a sim array that I can find. All except monique's don't load all the sims from the hoods, but hers also loads pets and NPC robot and penguins. I need a line that tests the SO's ID for being human and not a baby or toddler. I tried the 'Age, is SO teen?' and that didn't go so hot, and there wasn't a line for adult so it wasn't a complete fix. I found a global 'Pet - Is pet?' but when I entered it's op code, my package didn't recognize it and it didn't work in game. What now?
Retired Duck
retired moderator
#11 Old 19th Jan 2011 at 8:41 AM
Post it and I prod it.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#12 Old 19th Jan 2011 at 6:24 PM Last edited by Phaenoh : 1st Mar 2011 at 4:24 AM.
I'm starting to wonder if half of my creations shouldn't be posted under a joint account between me and you. You come to my rescue every time. <3s
Retired Duck
retired moderator
#13 Old 26th Jan 2011 at 1:29 AM Last edited by Echo : 26th Jan 2011 at 11:31 AM.
Heh heh! I come to the rescue of many BHAV projects, not just yours. But it makes up for the fact that I haven't actually made a real, new mod of my own for almost three years now. It's more fun letting other people do all the real work, then just fixing up the interesting BHAV stuff at the end.

Sorry it took so long to look at this, it was a crazy week.

There were a few reasons why it wasn't placable. You had an "idle" call in your init function - that causes "Check tree primitive blocked completion" errors. Also, your "function main" was calling your "function init". Not sure what was going on there. Finally, you had the original flamingo's "allow intersection" test set up in the objf. (You really should start up with testing cheats turned on ). I cleaned those up, and took out the various gardening and cleaning tasks from the OBJf as well, since they probably would have triggered a bug later in play.

I was having trouble figuring out your actual phone book BHAV, so I left it alone and copied out the really useful bits into in a new one instead. I find it a bit easier to follow now, so hopefully it'll help you too. Start reading from "Interaction - Phone - Look up Sim" and if there's anything there which isn't from your original and needs explaining, let me know and I'll explain it. It should exclude babies, toddlers, animals, and any sim in family 0 (the non-templated NPCs like Death, Hula Zombie, etc etc...)
Download - please read all instructions before downloading any files!
File Type: zip Phaenoh_PhoneBook7.zip (48.0 KB, 20 downloads) - View custom content
Description: Phone book is placeable, and excludes babies, toddlers, pets, and anyone in family 0
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#14 Old 26th Jan 2011 at 6:43 PM
I've known for awhile you are the superhero behind many projects, but that doesn't lessen what you do for me from my point of view. Super Echo! Also, no apologize needed for you having a real life. :P

Welp, I plead ignorance on all those bugs you just fixed. This was pretty much just a straight up clone of Monique's thing minus some things I knew I didn't need. Super sloppy job on my part. I can't wait to test out your shiny new and improved version. Five more hours till I get home from work.....

Just as an off the top of your head question, does the game have the ability to tell me which lot a sim is living on? Like for popup menus, $sim returns the name, and in the regular phone book under the sim's name is where they live. Can I call that info into a pop up box? Q tested this out for me and wasn't really sure that the name was looked up till he went and checked; a little sidebar notification that says something like "Dina Caliente lives at 19 Beach Drive, Pleasantview" or "Contessa Simovich lives in Downtown" would be helpful here. Then all I need is a little bit more mesh/texture tweaking and I'll be done and can conquer the world!!! MWHAHAHAHAH

god my job is boring today....
Retired Duck
retired moderator
#15 Old 26th Jan 2011 at 11:35 PM
The game stores the family ID, which is a number representing which household they're a part of. For putting it in a dialog... Not sure. You should be able to use any of these:
http://www.simswiki.info/wiki.php?t...g_Substitutions
But keep in mind that you actually have the sim's Neighbour ID, not the sim's Object ID, so they're the ones that will be easiest to display.
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#16 Old 27th Jan 2011 at 1:05 AM Last edited by Phaenoh : 1st Mar 2011 at 4:23 AM.
Ok, initial testing stage completed. Problem found. It does a good job of keeping out the penguins and robots, but I no longer have the downtownies, subhood sims or BV locals in my list.

From looking at the 'make me know sim' sub, it looks like it makes the relationship both ways, unless there is some problem with calling up a sim who doesn't know the person calling, i'd rather remove the other side. Doesn't answering a phone call and talking with a person add them to your list? I'll have to test that bit after I break it.

Edit: Huzzah! I did something on my own! I made the knowing stuff one sided, and it doesn't seem to bother the game at all. I looked up a sim after making it one sided, called the sim up, had a lovely conversation then summoned the sucker. He knew her after the conversation but not before.

I also noticed a couple more things. It does make sense that all sims would be listed in the book, but its not particularly useful to list sims the current one already knows. It seemed interesting that John Mole could look himself up in the phone book. I don't know what I want to do with that yet. What do you think?

Later Edit: More testing and stuff. I added in the walk-to bits and the entry and exit and i'm still gonna work on adding an animation and finalizing the texture. Also moved the mesh around a bit so it looks better on surfaces. Played around a bit with the dialog box, nothing working yet.

Problems with current: 1) Doesn't list sims from subhoods (help!), 2) doesn't place on floor ('must be on ground' appears), 3) dialog box doesn't work correctly yet, and the most interesting problem, 4) if you pick a sim you already know and have a relationship with, it resets the relationship to 0/0. Either I'll have to do some more hack and slashing to your fancy 'make me know sim' sub, or we can just remove sims we already know from the array so they can't be selected. Yay progress, and off to bed.
Retired Duck
retired moderator
#17 Old 27th Jan 2011 at 11:32 AM
1) Okay, that's kind of funky. Try this. Using "insert via false" between lines 0x4 and 0x5 of "Sub - Do I want this sim in the list?", add two new lines:
[global 0x0488] Sim - Is Townie? (2 args: Sim ID=Stack Object ID 0x0000, Sim ID is NID?=Literal 0x0001)
[global 0x05EE] Sim - Is Vacation Sim (1 arg: Person ID=Stack Object ID 0x0000)
The true target for both of these should return true. The false target should go to the next line. (I can't test this tonight, because none of my test hoods have subhoods and it's too late in the evening to start making one!)

2) Add "Expression (My 0x002A (placement flags) Set Flag flag# Literal 0x0001 (allow on floor))" to the end of your init

3) Which dialog doesn't work?

4) Yes, it'll do that. The easiest thing is to only list sims your sim doesn't know. In line 0x3 of "Sub - Load Sim Array", change it to read "Set to Next (Stack Object ID 0x0000, Neighbor with no relationship to neighbor ID in temp 0, disabled objects included: False)". Then, immediately after line 0x0, add a new command which does this: Expression (Temp 0x0000 := My person data 0x001F (neighbor id)). That should stop anyone already known to your sim from showing up in the list. (In theory, anyway)
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#18 Old 27th Jan 2011 at 6:43 PM Last edited by Phaenoh : 28th Jan 2011 at 1:39 AM.
What's the difference between Allowed Height Flags and Placement Flags? They seem to be super similar and I never know which to use.

Well that was a grand failure. >.< Teach me to do this while on lunch break. The book wouldn't place on the ground, still said it had to be outside, and after walking to the books, she errored out. I'll poke at it some more later.

So, I figured out that I accidentally used Temp [Temp] instead of just Temp. Fixed that and she can use the books now, but I didn't notice much change in the list. I did notice however, she can only use the books once now. Her previous friends may or not still be listed, I forgot to check for that the first time the menu was open and then I couldn't get it to open a second time.

Subhood sims are still not included. I've been testing in Desdirata with Natasha Una and John Mole and its pretty darn hard to miss all the plantsims from my Riverblossom sub hood. I also didn't see any Vampires in that list so I don't think the Downtownies are there either, but that might be due to the fact that I've got Bluewater as my downtown, but none of their residents are there either.

Later Edit: I figured out why she couldn't use them anymore, she didn't perform the 'standard exit'. Switched the interaction False return from error to the exit and it works now!
Retired Duck
retired moderator
#19 Old 28th Jan 2011 at 5:43 AM
The plantsims and vampires will be getting excluded by the "is human" check (they're not human - they're plantsims and vampires ). Take out this line:
[prim 0x0002] Expression (Neighbor's person data 0x00BA (Species) == Const 0x0171:0x00 ("Human" Value: 0x0000))
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#20 Old 28th Jan 2011 at 6:50 AM Last edited by Phaenoh : 1st Mar 2011 at 4:23 AM.
Ok, I have good news and bad news. Good news first, the subhood sims are being included in the array. The bad news, somehow the entire populations of Riverblossom and Bluewater have completely vanished. I wasn't too scared about that because I don't play that hood and maybe I just screwed up setting up that megahood. Not that hard to eff up a template hood like that. Then I skipped over to West Weasles, it's a subhood of Belladonna and that's when things got a little scary, all my sims from there are completely gone as well. I'm really hoping I have a backup somewhere for them otherwise these little sweethearts are gone for good. I'm still not entirely worried that this object did anything cuz I don't think I've checked in on that hood since I reformatted this computer and transplanted them back in game. That could be the cause of the other hood's issue too. Then holding my breath, I opened up Pleasantview. Luckily everyone there is still safe. Without letting go of that breath I checked on it's hood, Sand Simolean Point, also safe. Thank goodness. I asked Don Lothario to test it out for me and he got himself a couple numbers of some of his local hotties he hadn't met yet. Win-win. I took that human code out and now I've got dogs and cats back in my phone listing. Isn't there some 'Species == Dog' I can run a false past to get rid of them?

Problems yet:
1) Can't place on the floor, says it must be outside.
2) Critturs should be unlisted
3) It would be cool to include some sort of animation, I was hoping for a pointer finger running across the book like you'd do to read a recipe or what not. If that's not doable, at least looking at the object would be good.
4) I'd like a dialog box to pop up on the side of the screen with a picture of the sim I just looked up, but I can't get it to either display at all or if it does it doesn't use the right sim.
5) This latest brainchild idea is courtesy of John Mole; what about having a thought bubble of the sim I just looked up appear over their head either instead or in addition too.
*shrugs*
retired moderator
#21 Old 28th Jan 2011 at 7:16 AM Last edited by maybesomethingdunno : 28th Jan 2011 at 7:37 AM.
Oh! I wish I could be more helpful. But sadly, I can only possibly help with the first problem listed.

Buried inside your "[semi 0x200A] Function - Init (no args)" inside your "Function - Init", there is a line: [prim 0x0002] Expression (My 0x001E (room placement) := Literal 0x0001).

This is probably what is making it want to be outside. (FYI: a value of Literal 0x0002 is indoors.) Add a node to the end of your Init that sets the value to Literal 0x0000. It should no longer care if it's indoors or outdoors.

I don't mind if you call me "MSD" or something for short.
Tumblr
Perhaps someday I'll have leisure time back...
Retired Duck
retired moderator
#22 Old 28th Jan 2011 at 10:12 AM
1) See MSD's post above.

2) Yep. There's:
Expression (Neighbor's person data 0x00BA (Species) == Const 0x0171:0x01 ("Large Dog" Value: 0x0001))
Expression (Neighbor's person data 0x00BA (Species) == Const 0x0171:0x02 ("Small Dog" Value: 0x0002))
Expression (Neighbor's person data 0x00BA (Species) == Const 0x0171:0x03 ("Cat" Value: 0x0003))

3) Did you have an animation in mind?

4) That should be possible. Use a standard "Text Notification", set up a bit like this:
[prim 0x0024] Dialog (Text Notification, Strings: Local, Message: "Your message here", TNS Style: Sim, Priority: 0x01, timeout: 0x14, TNS ID: Temp 0x0000, icon: neighbor, wait for user: True, block simulation: True. )

5) Thought bubbles are effects. You should be able to get a thought bubble with the appropriate sim using something like this:
Effect Stop/Start (Soft start effect, Target: My 0x000B (object id), routing slot: 0x04, "uiHeadlineGroup_ThoughtRuntimeThumb_x" [Effect:0x28 (Global)], icon: Stack Object Id 0x00, Priority: True, model: default)
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#23 Old 30th Jan 2011 at 4:23 AM Last edited by Phaenoh : 30th Jan 2011 at 4:46 AM.
Yay! This is coming together nicely finally! Cats and Dogs are out, Witches, Vampires are in. I've still got a couple problems yet though. As for animation, I think I'm canning that plan. I can't seem to find a basegame animation I'd like to use.

1) I don't know where to fix the thing MSD mentioned. Can't I just remove the line within that BHAV? Is that stuff actually in my package? I tried to add a line to the end of my Init, but I guess I didn't have the op codes right because something when way wrong.
2) The dialog box isn't displaying to correct neighbor, so I'm not really sure where I'm supposed to include it. I've tried in the Go and Use interation and also the interaction you wrote, both had the same result of having Townie Chloe Gordon show up in the icon instead of whichever sim I picked.
3) I'm also having a bit of trouble with the though bubble too, the little wrench icon is greyed out for that one and I can't guess all the op codes I need for that. How do you know these things?
*shrugs*
retired moderator
#24 Old 30th Jan 2011 at 5:16 AM
I apologize. Looking back at my post, I realize I could have explained it a bit clearer.

In your package's "Function - Init" Bhav, the first node (0x0) calls the semi-global's "Function - Init()" bhav. So the room code is not in your package per se. It is there indirectly via your package calling a bhav tree that contains it.

To fix it, all you need to do is go to your package's "Function - Init" Bhav. Select the last node (0x6) and click the "Insert via True" button to create a new node (0x07). The OpCode should be 0x0002. If you're using the wizard, the parameters should be My room placement := Literal 0 (assuming "Decimals" and "use Attribute picker" are checked). You could also set the parameters by clicking the little button with the ", then copy/paste 1E000000000503070000000000000000 into the little window that appears.

The call to the semi is for convenience (i.e. reusing already written code). It's kinda like saying "I'll have what she (*you point to a person sitting next to you who has already ordered*) is having" when you give the waiter at a restaurant your order, rather than repeating everything that was said. You don't want to change the semi-globals; you just want to append it: "I'll have what she is having...but I want ketchup instead of mustard and no onions please."

I hope that is more clear.

I don't mind if you call me "MSD" or something for short.
Tumblr
Perhaps someday I'll have leisure time back...
Doing all the things, and *mostly* not failing.
retired moderator
Original Poster
#25 Old 30th Jan 2011 at 6:26 AM
Yay! That worked!

I found another issue. (gah, they never stop it seems!) I have the ability to select and 'know' sims like the Human Statue, Social Bunnies, and Social Workers, however they don't show up later in the phone call list. Is there an easy way to sort those NPCs out?

I've also decided to drop the dialog box in favor of the thought bubble. I do hate dialog boxes in game, this seems like a better way to keep the illusion while still letting the player know something happened. Where should I stick that in my code?
Page 1 of 3
Back to top