More Awesome Than You!
Welcome, Guest. Please login or register.
2024 November 22, 15:24:51

Login with username, password and session length
Search:     Advanced search
540287 Posts in 18067 Topics by 6545 Members
Latest Member: cincinancy
* Home Help Search Login Register
+  More Awesome Than You!
|-+  TS2: Burnination
| |-+  The Podium
| | |-+  [Modding Question] BHAV calling scope
0 Members and 1 Chinese Bot are viewing this topic. « previous next »
Pages: [1] THANKS THIS IS GREAT Print
Author Topic: [Modding Question] BHAV calling scope  (Read 4793 times)
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
[Modding Question] BHAV calling scope
« on: 2009 December 19, 21:14:44 »
THANKS THIS IS GREAT

I understand the concept of globals: any BHAV from any group can call them, but they can't call BHAVs from other groups.  Does this extend to BHAVs defined in a package file that contains overridden globals with the group 0xFFFFFFFF?  E.g., say I have written a new version of global BHAV 0x0XYZ and in the same package where my version of 0x0XYZ is, there is a private BHAV with instance 0x1001 and group 0xFFFFFFFF.  Can I call the 0x1001 BHAV from 0x0XYZ, or do I have to create a new global?  I did create new globals in my family hack, but I do (and did) realize that that's not a great thing to do, and I want to know if there's a way around it.
Logged

I was thinking about these things and I am a feminist.

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26288



View Profile
Re: [Modding Question] BHAV calling scope
« Reply #1 on: 2009 December 20, 03:59:41 »
THANKS THIS IS GREAT

0xFFFFFFFF is automatically remapped to a random group, so 0xFFFFFFFFs cannot call others not in their package. An 0x2XXX semiglobal can call a local 0x1XXX, with the resulting local that runs being the one attached to that object. It is not known what happens if an 0x0XXX global tries this, as there is no telling what will run if this happens. If you wish to invoke a specific effect, it is best to use RTBN, so that the BHAV will be invoked by name instead of by instance number.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: [Modding Question] BHAV calling scope
« Reply #2 on: 2009 December 22, 22:30:27 »
THANKS THIS IS GREAT

I see.  If the 0xFFFFFFFF BHAV is in the same package as the OBJD/OBJf of the current stack object than it can be called via RTBN, right?

I have another question about tokens, too - I have gotten one to work as I want it to, but it does not seem to be saving when the game is saved.  I've looked through multiple token-using hacks made by other people, and I can't see what I'm doing wrong.  HALP?  Token has OBJD, OBJf, unique GUID, can be added to neighborhood memory and have its properties modified, etc., but when the game reloads it can't be found.
Logged

I was thinking about these things and I am a feminist.

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26288



View Profile
Re: [Modding Question] BHAV calling scope
« Reply #3 on: 2009 December 31, 02:54:24 »
THANKS THIS IS GREAT

I see.  If the 0xFFFFFFFF BHAV is in the same package as the OBJD/OBJf of the current stack object than it can be called via RTBN, right?
Any BHAV may be called by RTBN, regardless of whether it is global, semiglobal, or local, whether or not is an 0x7FXXXXXX, or an 0xFFFFFFFF. That's the entire point of RTBN. Any "local" will always be run in preference over a semiglobal over a global. It does not matter what groups are involved here, or whether the instance numbers are the same across all objects that may the RTBN may be invoked on.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: [Modding Question] BHAV calling scope
« Reply #4 on: 2010 January 01, 07:36:39 »
THANKS THIS IS GREAT

Right - but just to be clear, it's local/semiglobal where the current stack object is concerned, right?  So, like with the spell code, you get something like:

Ensure that SO is an instance of (Spell GUID)
RTBN "CT - Cast Spell"

which will run the CT - Cast Spell that's in the same group as the spell object, if it exists, and otherwise some general semiglobal version, and this is completely independent of the group number of the calling BHAV.  (Right?)
Logged

I was thinking about these things and I am a feminist.

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26288



View Profile
Re: [Modding Question] BHAV calling scope
« Reply #5 on: 2010 January 01, 07:43:15 »
THANKS THIS IS GREAT

Right - but just to be clear, it's local/semiglobal where the current stack object is concerned, right?
Depends on the arguments. Using an RTBN-2, yes, the BHAV run will be the one associated with the stack object in aforementioned order of precedence. RTBN-3, however, will let you invoke a BHAV by a GUID of an object that may or may not actually be present, which will also be invoked in aforementioned order of precedence, only the stack object will be twaddle and no physical object will exist, and the BHAVs run will be those associated with the GUID.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: [Modding Question] BHAV calling scope
« Reply #6 on: 2010 January 03, 18:16:39 »
THANKS THIS IS GREAT

The -2/-3 is the version/format/whatever-it-was setting when setting opcodes and operands, then?  I haven't messed with it much, but I have noticed that the Relationship primitive seems to have different incarnations based on what goes there.

"Associated with the GUID" just means "in the same group as the OBJD of the object with that GUID", right?

(Slightly) related question: NREFs determine group numbers, right?  If I put an NREF with a unique name/number into a package with one OBJD (and the same instance as that OBJD) then when the package is loaded, everything in the package will be considered to be in the group corresponding to the NREF - correct?  If there are multiple OBJDs in the package (and multiple NREFs corresponding to them by instance number) does this divide all the non-immediately-OBJD-associated resources (like general-purpose non-Pie-Menu-related BHAVs and BCONs) into different groups?  What does including NREFs in a package do, from a purely functional standpoint?  Are they necessary/do things break if they aren't there?  Sims 2 Wiki just says something about unknown EAxian hash functions.

If it is possible to hand-pick group numbers using NREFs, is it also possible to set up one's own semiglobal groups and determine which private groups have access to their resources?  Are the semiglobal groups determined by some mathematical function of the group numbers, or are they hardcoded?
Logged

I was thinking about these things and I am a feminist.

J. M. Pescado
Fat Obstreperous Jerk
El Presidente
*****
Posts: 26288



View Profile
Re: [Modding Question] BHAV calling scope
« Reply #7 on: 2010 January 04, 01:19:49 »
THANKS THIS IS GREAT

"Associated with the GUID" just means "in the same group as the OBJD of the object with that GUID", right?
Or its semiglobal, or its global.

(Slightly) related question: NREFs determine group numbers, right?  If I put an NREF with a unique name/number into a package with one OBJD (and the same instance as that OBJD) then when the package is loaded, everything in the package will be considered to be in the group corresponding to the NREF - correct?
Nope. Everything in 0xFFFFFFFF in one package is associated and shares a group. Everything outside that package isn't, unless explicitly given a group.

If there are multiple OBJDs in the package (and multiple NREFs corresponding to them by instance number) does this divide all the non-immediately-OBJD-associated resources (like general-purpose non-Pie-Menu-related BHAVs and BCONs) into different groups?
No.

What does including NREFs in a package do, from a purely functional standpoint?  Are they necessary/do things break if they aren't there?  Sims 2 Wiki just says something about unknown EAxian hash functions.
They show up in error logs. Other than that, nothing we can tell.

If it is possible to hand-pick group numbers using NREFs, is it also possible to set up one's own semiglobal groups and determine which private groups have access to their resources?  Are the semiglobal groups determined by some mathematical function of the group numbers, or are they hardcoded?
They are determined by a reference type, GLOB, or something.
Logged

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
rufio
Non-Standard
Uncouth Undesirable
****
Posts: 3030


More Nonstandard Than You


View Profile WWW
Re: [Modding Question] BHAV calling scope
« Reply #8 on: 2010 January 04, 21:38:54 »
THANKS THIS IS GREAT

Ahh.  I had thought they might have something to do with the group number, because the NREFs in objects.package seem to have numbers corresponding to the groups they are in.
Logged

I was thinking about these things and I am a feminist.

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.13 seconds with 20 queries.