Bounding box problems
#41 23-01-2016 
(23-01-2016 01:49 PM)gummilutt Wrote:  I think you might have gotten confused somewhere along the reading of what I've written, BO.

Yeah, many long posts, several of them with lots of problems. At some point I think I get the gist of the post and stop reading, missing the good news... My bad!!! I'm glad we're on similar pages now, though.

1
#42 24-01-2016 
I wouldn't want to read through everything here either, if it wasn't my creation Tongue

I was thinking about this last night, and I wonder how the game will react if two Sims have the same job and only one of them has the car. Also, since I'm going to be doing your approach, I'd like to figure out how to make it also apply to the school bus. I have some households with stay-at home parents, and I think it'd be nice if those parents drive their kids to work.

1
#43 24-01-2016 
The correct institution sign from SimLogical *would* stop the school bus. A carpool mod would test the sim that needs to leave, to decide whether or not to send a car. Similarly, the school bus routine would not test the parents but the children, which are *obviously* not the owners of whatever car might be present. So that would not work, unless you put a model in the children's inventories as well.

0
#44 24-01-2016 
I was unclear. I meant I'd like to make a tiny bus that you can put in kids inventory to stop the school bus from showing up. The downside with institution sign is that it does not separate work from school, and it affects the entire lot. This would give more room to adapt to a players specific wishes, as long as I can make it only exclude carpool/bus from the individual with the item, but still send it if more people are around that should get it.

I have a ton of studying to do, so I won't get much done on this project today either, but I'll try to look at it some more later. I'm going to look at the institution sign again, because it has to at least link to the stuff that's relevant in some way.

1
#45 24-01-2016 
@BoilingOil I'm looking at institution sign again, and I think I've found the BHAV I need for the real car approach. A semi-global called Sub - Push Go To Work Ownable Car. If that ain't the right one then the name is very misleading Tongue

I have an idea of how to make it look for objects in inventory, but in this case I need to make it look at the GUID of the car the Sim owns. Do you think you could help me figure out how to make it do that? I'll start deciphering the BHAV I found, but I wanted to post and ask you right away Smile

And on a totally unrelated note, I got a request on MTS for no death by Murphy bed, and thanks to all your help in the thread about understanding primitives, I was able to understand everything in the BHAV and even add a 0/1 check to toggle parts of it on and off. Thank you so much. While I don't mind asking for help, it's also a great feeling to realize you've learned enough to do something by yourself too Smile But I'd never have been able to if you hadn't explain things to me, so it's all thanks to you.

EDIT: Looking at the BHAVs, I notice that if you have free will off it does not push go to work interaction, it only gives you a message that your Sim has to be at work in one hour. Very handy! I think what I'll try to do is to redirect to that code if the Sim owns a tiny car, so that players are informed that it's time to go to work, but the interaction isn't pushed.
(This post was last modified: 24-01-2016 08:20 PM by gummilutt.)

0
#46 24-01-2016 
Ah, it seems you don't need my help with this one, then. I'm going to get some rest now. Good night Big Grin

1
#47 24-01-2016 
I think I've figured out where the code needs to go. There's a place where it checks if you own a car or not, and if you don't own one, it summons carpool. If you do own one, it checks for free will to decide if it should push or just send the message. That seems like the correct place for both approaches. Check for car in inventory before the carpool summon, and check for owning tiny car before deciding to push.

I do need help with the actual code though. I have an idea how to check inventory, but I don't know exactly how to set it up. And I have no idea how to set it up to compare guid to the guid of a car you own. So if you haven't gone to bed already, I could very much use your help <3

0
#48 24-01-2016 
As you yourself said, it already contains a test for an owned car. So why don't you simply copy that for your own purpose? It should not be any more complicated than that.

The other part - checking for a model in inventory - requires that I know the GUID of the model. It also requires that I look some stuff up, which is not going to happen before tomorrow.

1
#49 25-01-2016 
The test it contains is a semi global that just checks if you own a car, it doesn't check for a specific car from what I can tell. I suppose I could just make it not push the interaction if you own any car, but I imagine some people like that their Sims go on their own, so if possible I'd prefer to only stop it if the owned car is one of the tiny cars. There's a lot of stack object going on, and I don't know much about what that means. If you can/want to have a look and see if you can make more sense of it, the BHAV is called Get in Temp0 - Preferred Car and has group 0x7F8F4EB6.

I tried to look at Marhis social group mod, but she uses locals in her check and the locals in my bhav are different. I don't understand it well enough to adapt it. GUID of the inventory car is 0x00866E54. The BHAV I need to edit is Sub - Process, with Group 0x7F8F4EB6.

I'm looking at the M&G versions of these. I always start with M&G and then figure out if anything changed since earlier EPs, and if necessary make EP-specific versions.

0
#50 25-01-2016 
As for the check on the normal car, don't look for more trouble yet. Assume that the EAxis BHAV knows what it's doing. It will probably look in a special token on the sim that contains the objects number of a specific item on the lot, and then test if that object is a clone of the generic 'car' object. It will automatically point to the car that was assigned to this sim, and not to anyone else. So just use it again for your own purpose as I said before, and see if that does the trick.

Stack object - it's like this: there's a stack, a LIFO (Last In, First Out) structure for those who have previous experience in computer languages and programming. If you don't know what that means: all numbers and such that the program has no viariable for to put it in, are thrown on top of the heap. In SimAntics those numbers are usually the return address to the previous BHAV and the Object it was processing when it called the current BHAV. Whenever the program refers to stack object, it means that specific object: the top value on that heap. There's a number of complications there, but they are hard to explain. Anyway, when the current BHAV ends and goes back to the previous caller, the top values from the stack - the Stack Object *and* the return address into the previous BHAV - are discarded, and the previous set is now the top again. But until that happens, in the mean time, the current BHAV can simply read the Stack Object value and use what it contains (or write to it, if we dare).

And now for your car model in inventory. Yeah, I know how the Social Group mod works. If I had thought that that would help you, I would have *told* you to look there. Mind you, it's good that you looked at it, but I knew beforehand that it wasn't going to help you. (Although that isn't *entirely* true either. In fact, if you follow the semi-globals deep enough, you will run into some instances of what we're going to discuss next, because they are the only way to solve certain issues.)

Now as for how it works... You're going to need a Local Variable to store a number in. The BHAV already uses four of those: Local 0x0000 - 0x0003. I'm not comfortable with using any of those, because that might interrupt the proper working of the code. So we need another one: Local 0x0004. However, we cannot simply start using that without a preparation, because the game will not understand what you're referring to, and throw errors. Preparation is simple, though. Near the top-right corner of Plugin View, you'll see a field labeled "Local Var Count" which contains the value 4. Increase that to 5, and the game will understand that Local 0x0004 is now also valid for this BHAV.

Then comes the hard part. In the place where you want to add the new test, you'll have to start by adding a new expression that puts the value -1 in Local 0x0004:

[prim 0x0002] Expression (Local 0x0004 := Literal 0xFFFF)

Now we are going to be searching in the Neighborhood's huge DataBase of Tokens, Inventory Items and Memories. This DB contains *ALL* instances of such... Every object that rests in any sim's inventory and every memory that any sim may have, can be found in this DB. So we need to devise a 'query' with sufficient parameters to make sure that only the right object is found. This query is built up with the following primitive: [prim 0x0033] Manage Inventory (Set to Next Token of GUID ....)

So, you add a new line and set its OpCode to 0x0033, press the "clear" button (x), and then enter the Wizard. Now, make the data look like this picture: [Image: Gummilutt%20car%20test.jpg]

If the sim in question *does* have a car model in inventory, the index to that specific model will be in Local 0x0004, and the expression will return TRUE. If the sim *does not* have a car model, the result in Local 0x0004 is uncertain, but the expression will have returned FALSE. Now we don't give a gosh-darn about the result in Local 0x0004 - the Manage Inventory primitive just would not have worked if we hadn't given it a variable to dump an index, if it found one - but I think you know what to do with the TRUE/FALSE results.

Well, there you have it... your first glance into one of the most complicated structures in the game: the Inventory/Memory/Token database!
We will eventually go deeper into what everything means and what all things one can do with it, but that's TMI for this project.

BTW: if you'd like to see what all things one can do with [prim 0x0033] Manage Inventory (...) , you'll find it used in my "No Sim Loaded" mod - for example - to dig through Memories. It'll also be found in my "Feed Baby" mod to determine if a sim owns a Bottomless Bottle; in "P4A - Alien Trigger Override" to check if sims have certain tokens to influence their "internal gender" and in several other mods of mine.

2


Sorry, that is a members only option