Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
The ModFather
retired moderator
Original Poster
#26 Old 30th Jul 2006 at 9:58 PM
If I have understood correctly your question, you need to know what the Stack Object is, and how it is affected by the BHAV.
The problem is that the Stack Object (let's call it "StObj" for brevity) is dynamically updated quite often, and therefore it's highly unpredictable what the StObj is when a particular line of the BHAV is executed.
The only certain (well... almost! ) thing is that, in the first BHAV executed when you click on an object, the StObj is the object that you have clicked on (the one that popped up the pie menu, letting you to choose an interaction).
But as soon as the BHAV is executed, the StObj might be changed by the instructions contained in the BHAV itself.

Let's make an example, to better understand.

You click on the indoor trashcan and select "Take out trash"; in this moment, the StObj is the indoor trashcan. Then, the internal BHAVs are executed, the sim approaches to the trashcan and takes the trash... And in this moment the StObj becomes the trash itself. Then the sim searches for an outdoor trashcan, and the StObj is now the outdoor trashcan; the sims approaches it, opens the lid and put the trash in it: now the StObj is the trash again...
I stop here, but the process goes on, with the StObj changing quite often.

I hope to have been clear enough in my explanation... But in brief, this means that it's not possible to create a guide that can tell you what is the Stack Object...

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Advertisement
Corrosively Delightful
retired moderator
#27 Old 31st Jul 2006 at 2:49 AM
Thank you Numenor! I had a bit of an idea, and I know you can't give a guide on what it is for all objects at all moments, but just getting a non-programmer idea about it is very welcomed! It is easy to get lost in all the programmer-speak. Thank you. As always, your explanation is very clear.

If you're not having fun, you're not doing it right.
SO much to do and so many other things to distract me.
The ModFather
retired moderator
Original Poster
#28 Old 31st Jul 2006 at 9:24 AM
There is an interesting article by Dizzy2 over at *cough* Varioussimmers; I would never thought I would post a link to there , but Dizzy has my fullest consideration and respect as a modder, and her articles were enlighting for me.

The article I'm talking about can be found HERE; I'm sure you will find useful also the other "Just the basics" installments, that can be found in the same forum.

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Corrosively Delightful
retired moderator
#29 Old 31st Jul 2006 at 6:58 PM
Thanks once again Numenor! *going incognito to check it out*

If you're not having fun, you're not doing it right.
SO much to do and so many other things to distract me.
Lab Assistant
#30 Old 2nd Aug 2006 at 12:40 AM
*read the Dizzy2 thing*

Very useful. I've been wondering about the scope of variable for quite a while.

I still have a question, though. When it says globals can be accessed anywhere, does that mean anywhere for the specific action that's going on, or anywhere as in literally, in any action that's going on anywhere on the lot?

I think it's the first, but I figure it's a big enough distinction to ask about. And if so, what happens to them when sims switch between objects? Are the temps cleared?

The above post should be ingested with 1/4 Tbsp salt. In the event of an allergic reaction, panic and wait for the reaction to pass.
Lab Assistant
#31 Old 2nd Aug 2006 at 12:42 AM
*scrolls down*

...oh. Dizzy answers.

I still want to know, though, what happens when an interaction ends? Are the temps cleared?

The above post should be ingested with 1/4 Tbsp salt. In the event of an allergic reaction, panic and wait for the reaction to pass.
The ModFather
retired moderator
Original Poster
#32 Old 2nd Aug 2006 at 1:50 AM
Frankly, I don't know; I never rely on the temps values, unless a temp is set (even in a sub) and read immediately afterwards.

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
One horse disagreer of the Apocalypse
#33 Old 2nd Aug 2006 at 8:36 AM
I agree Numenor, the temp must be transferred into a local variable ASAP after being set, and certainly before any other function or BHAV is called, in case the temp is reused there.

If it's not convenient to return and store a temp for any reason, you can consider using an attribute on the object to store the value, where it will remain safely to be read not only by any other BHAV on the object, but also by any other object.
The ModFather
retired moderator
Original Poster
#34 Old 2nd Aug 2006 at 9:30 AM
Talking about what Dizzy's articles say and don't say...
I have a question about parameters, and I hope that someone will clear up this for me.

When an interaction is called called via the TTAB, or a functional tree is invoked by the OBJF, are there any parameters passed to the BHAV? Sometimes, the first BHAV executed expects a parameter, and I don't know how to set it, or where the BHAV gets the value for that parameter...

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
One horse disagreer of the Apocalypse
#35 Old 2nd Aug 2006 at 9:47 AM
I know Param 0 passed to the *test* BHAV is the flag for whether the sim is choosing it autonomously. Param 0 passed to the action BHAV contains whatever was the stack object when the menu line was generated. That's how things like the teleporter let you choose a sim to teleport.

But there are bound to be others, and it would be highly useful to know them!
Test Subject
#36 Old 4th Aug 2006 at 11:29 PM
Ahhh...Params...didn't I cover those? *<puzzled look on face>*


I will see about getting you an example! sorry for not being around,...Heat- computer etc...

SimAntics, What would life be without 'em!
Retired Duck
retired moderator
#37 Old 5th Aug 2006 at 7:04 AM
For cross referencing purposes about parameters in BHAVs - here's the MTS2 discussions I have bookmarked for specifically those questions:
http://www.modthesims2.com/showthread.php?t=128350 (which leads on to)
http://www.modthesims2.com/showthre...4413#post874413
Instructor
#38 Old 6th Aug 2006 at 6:49 AM
I hope this is the right place to ask :-<

I noticed that when you pass parameters to a BHAV, it can be done in (at least) 2 different ways - depending on something in BHAV. The question is, what is that 'something' and what else it affects?

Say, I cloned a BHAV, set it to have 1 argument, and passing parameters to it from another BHAV. In both cases, I'm passing 'Literal Value 1' - just to point which opcodes affected - so, i.e. replacing 07 to 19 in opcode string will pass Local Variable instead of Literal Value, as usual.

Example 1: a BHAV cloned in the 'fruitbowl' decorative object, sorry, forgot which BHAV. OpCode string is:
070100FFFFFFFFFFFFFFFFFFFFFFFFFF
3 first bytes correspond to first argument, whatever goes next is not important - I could put 00s instead of FFs and it would accept it.

Example 2: a BHAV cloned in the birthday cake, AFAIR - source was semiglobal 'Grab Plate - Remove Slice'. OpCode string is:
0701000A00000A00000A000001000000
Same way, 3 first bytes correspond to first argument, but what goes next is important - not sure if all of those 0As, but at least some.

1st question is: what in BHAV makes it accept arguments in a certain way? It's not Format, Tree Type or Tree Format from the top row - tried to copy them from one BHAV to another, way of acepting parameters didn't changed. (By the way, any links where to read what those 3 values are, please)?
2nd question is: is there any other difference besides way of passing parameters?

If anyone knows something, please share it :-<
Retired Duck
retired moderator
#39 Old 6th Aug 2006 at 9:06 AM
Well I'm not 100% sure what the "different way" is, but assuming you're talking about non-primitives, there are two ways to pass parameters:
Option 1: Operand 13 == 0. Each parameter takes two operand boxes, and all values are treated as literals.
Option 2: Operand 13 == 1. Each parameter takes three operand boxes. The first specifies the data owner and the second two are the data value.

If you have to pass a lot of values to a function, the former is obviously better. However, if you need to be able to pass non-literal values then you have to go with the latter.

As for the Format, Tree Type, Tree Version etc, I only know the superficial details. The format specifies how the file is decoded - some formats will allow things that others don't. In most cases, your choice of format doesn't matter, although if you're making objects for the original game you shouldn't use anything in 8008 or 8009 (unfortunately). There's a bit more info on it here: http://www.sims2wiki.info/BHAV

Tree type is deprecated - it isn't used any more.

Tree version is, I believe, a mechanism used by the game to choose which function two run if there are two that conflict (ie - have the same instance) in case you include multiple versions of code. However, I've never tested this, nor heard from anyone who has, so I'm just speculating.
The ModFather
retired moderator
Original Poster
#40 Old 6th Aug 2006 at 7:03 PM
Inge, Echo, thanks for the info and the links!

Adidas, I might have overlooked this subject when reading your guides; if so, forgive me for having asked again :P

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Test Subject
#41 Old 7th Aug 2006 at 10:13 PM
I think I'll forgive you this time :-P, but just remember!...I'm always lurking somewhere...

Yes that somewhere should be home typing on the tutorial....

/me swooshes back to work *swoooooooooosh*

SimAntics, What would life be without 'em!
Test Subject
#42 Old 9th Aug 2006 at 9:37 PM
News Flash!

Set To Next (0x1F) Tutorial will be up tomorrow!

Get Ready for the next in the series!

SimAntics, What would life be without 'em!
The ModFather
retired moderator
Original Poster
#43 Old 9th Aug 2006 at 10:23 PM
Countdown started!
23:59:59...58...57...

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Test Subject
#44 Old 23rd Aug 2006 at 9:51 PM
Sorry All, The Internet here has been down for a couple of weeks. I will try to get it up tomorrow or so...I apologize for the Totally Lateness of the download....don't worry, it will be up soon!

Again, I apologize!

SimAntics, What would life be without 'em!
Corrosively Delightful
retired moderator
#45 Old 24th Aug 2006 at 4:53 AM
Thank you for writing these, and no worries if it is late; it is still very much appreciated.

If you're not having fun, you're not doing it right.
SO much to do and so many other things to distract me.
Test Subject
#46 Old 7th Sep 2006 at 11:11 PM
Hello All!

Set to Next Is now up!

Next one comming soon...

SimAntics, What would life be without 'em!
Test Subject
#47 Old 11th Sep 2006 at 10:30 PM
Hey all,

Tutorials will be on hold until TS2 has an update for Vista, as that is the sys I am running, but I will still continue on the intermitten tut comming up.

Sorry for the delay all, I will try to do what I can, with what I have.

SimAntics, What would life be without 'em!
The ModFather
retired moderator
Original Poster
#48 Old 12th Sep 2006 at 10:06 AM
You mean that The Sims 2 doesn't run on Vista? Hope that Maxis will fix this soon...

I've finally started my Journal. Information only, no questions.

My latest activity: CEP 9.2.0! - AnyGameStarter 2.1.1 (UPD) - Scriptorium v.2.2f - Photo & Plaques hide with walls - Magazine Rack (UPD) - Animated Windows Hack (UPD) - Custom Instrument Hack (UPD) - Drivable Cars Without Nightlife (UPD) - Courtesy Lights (FIX) - Custom Fence-Arches - Painting-TV - Smarter Lights (UPD)


I *DON'T* accept requests, sorry.
Test Subject
#49 Old 13th Sep 2006 at 10:27 PM
I am not sure if TS2 will/won't run on Vista, I have read that one site says yes, another says no.

Plus Latley, my OFB Disc has gone bad! :-( I cannot install it, it throws up an error that it cannot copy file B001_Lot116.package, "Error Reading Source Media", and yes I tried to copy the file over to HD, then extract.

Anyway, sorry for the delays comming up!

SimAntics, What would life be without 'em!
Lab Assistant
#50 Old 14th Sep 2006 at 12:43 AM
Well, in all fairness to Maxis, you guys tend to forget that Vista is still only a beta OS, and it is unreasonable to expect Maxis to dedicate time and resources to support it at the moment.
Page 2 of 7
Back to top