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!
Field Researcher
Original Poster
#1 Old 11th Jul 2005 at 11:58 PM
Default Calling a foreign semiglobal
I tried importing a foreign semiglobal library to my glabal data dolder, but I still dont get the wanted semiglobals when bhav editing. There is the added complexity that If I call a semiglobal, SimPE automatically calls the local SG, as opposed the the imported foreign one.
EG. Working on computer. Want to use a clothing rack semiglobal (yes i am making internet shopping, WooHoo!). So I clone the clothing rack, export the global data file and import it to the computer. Can I have 2 GLOB's? And how doI call a SG from the imported SG library?

Sorry about all the questions, but the end product will be super! Please dont copy my idea.

The sims 2 Rockin' The Road Content Pack: www.sims2rockintheroad.tk
OR:
Sims 2 Rockin The Road Alt Url
Project Manager
As featured on CNN, NBC and Wired, click this link for a free Ipod!!! Dont be one of the skeptics that misses out, join in the craze!http://www.freeiPods.com/?r=8571212
Advertisement
Fat Obstreperous Jerk
#2 Old 12th Jul 2005 at 12:09 AM
I'm sorry, Dave. I'm afraid you can't do that.
Inventor
#3 Old 12th Jul 2005 at 12:10 AM
I think that you can call a foreign semiglobal by importing just that single BHAVs contents into a new semi-global library.
Inventor
#4 Old 12th Jul 2005 at 12:12 AM
Crap what I said.
Field Researcher
Original Poster
#5 Old 12th Jul 2005 at 12:15 AM Last edited by chrisnjosh : 12th Jul 2005 at 12:21 AM.
LOL. I just realised, I poseted this thing 2ce. I tried 1st time, and got an error.
It is possible, as it is in Echo's BHAv guide for PRogrammers. But, it is in very little detail.

EDIT
The other post explains it better:

I will say what I am trying to do, have done and then hope to god for help.

I am trying to call a foreign semiglobal, basically. I exported the wanted global data (its ClothingRack, dont ask why!), and then imported into some other file. Now I have 2 GLOB's, and of course, when I call a semiglobal, it calls from the original SG library rather than the imported one.
By the way, I am directing a TTAB's ACTION field to this foreign semiglobal, if that is of importance.
I would like to know how to reference a semiglobal from a second, imported semiglobal library. Also, I am going to be using at least 2 different foriegn SG libraries, so I will need for this method to be usable for that. Thanks.
Fat Obstreperous Jerk
#6 Old 12th Jul 2005 at 12:27 AM
You can't do that. That doesn't work, you're going to break it.
Field Researcher
Original Poster
#7 Old 12th Jul 2005 at 12:33 AM
Doh. Im sure I can use foreign semiglobals. PLEASE!!!
Fat Obstreperous Jerk
#8 Old 12th Jul 2005 at 12:41 AM
You can use foreign semiglobals by importing the relevant GLOB, replacing your existing one. However, you cannot arbitrarily invent your own semiglobals, nor can you use more than one.
Field Researcher
Original Poster
#9 Old 12th Jul 2005 at 12:43 AM
O, well thanks. So you cant use semiglobals from 2 different semiglobal libraries? Cos Echo's guide is adament that you can.
Fat Obstreperous Jerk
#10 Old 12th Jul 2005 at 5:19 AM
I've never heard of this Echo or his guide. Or anything about making your own semiglobal libraries. That should say something about how authoritative he is.
Systemic Anomaly
#11 Old 12th Jul 2005 at 6:12 AM Last edited by jase439 : 12th Jul 2005 at 6:31 AM.
Chrisnjosh,

The whole concept behind semi-globals is data typing (a sort of poor man's inheritence model) and functional/data encapsulation. If semi-global A can transparently call through to foreign semi-global B willy-nilly, you've broken the abstraction and the whole Simantics model goes to pud.

What you're trying to do (if I understand you) is to jump contexts to call routines on two completely different data types so you can logically treat them as a single "thing". As JM states, there's no way I know of that you can do this directly. What you're trying to do is something akin to aggregation through multiple (implementation) inheritance in C++, a concept that is not natively supported in Simantics.

You could create some little proxy object that inherits your foreign GLOB and *it* could call the foreign semi-globals you need...you could then expose interface functions on that object which you could indirectly invoke from your "native" object via Run Tree By Name or Push Interaction and shuttle data back and forth between the two via temporary storage. That's a fair bit of hoop jumping to go through (and kind of messy) to call a handful of routines in a foreign context. I think most would just clone the foriegn BHAVs that you need and just import them into your package file so you can call them directly.

J

PS. I've never heard of Echo either, except possibly at the bottom of the Grand Canyon.
One horse disagreer of the Apocalypse
#12 Old 12th Jul 2005 at 8:01 AM
Well import the foreign semi-global, and assign it an instance number in the private range - ie take it private. Then obviously you'll have to do the same for any BHAV in the chain of call.
Field Researcher
Original Poster
#13 Old 12th Jul 2005 at 10:27 AM Last edited by chrisnjosh : 12th Jul 2005 at 10:30 AM.
Thanks you 2! PLease can you tell me how I do that?

Echo's guide to bhav hacking for programmers is informative in most parts. He is rather authorative, and please do not base somebodies skills with sims tools on whether you know them or not.

I am not trying to create a SG library. I wish to simply call certain semiglobals from foreign libraries, that is all.
One horse disagreer of the Apocalypse
#14 Old 12th Jul 2005 at 10:39 AM Last edited by Inge Jones : 12th Jul 2005 at 10:42 AM.
As far as I know it is impossible to use semi-globals from more than one semi-global file, per object. When you ask how to do what I suggested, are you saying you don't know how to use that feature in SimPe? I am not sure how to best provide further advice to you

Actually I am at a bit of a disadvantage here, because I have just realised I don't know what you mean by "I tried importing a foreign semiglobal library to my glabal data dolder" so to a certain extent I have been trying to guess what you're trying to do - but I could be very wrong.
Field Researcher
Original Poster
#15 Old 12th Jul 2005 at 10:43 AM
Its the foreign semi global importing. I must admit, I am not too cllear on how I
Quote:
Well import the foreign semi-global, and assign it an instance number in the private range - ie take it private. Then obviously you'll have to do the same for any BHAV in the chain of call.


But are you saying this is how to change your SG library, not allow foeign SG's?
Field Researcher
Original Poster
#16 Old 12th Jul 2005 at 10:47 AM Last edited by chrisnjosh : 12th Jul 2005 at 11:03 AM.
EDIT:

Of course, the plugin. I forgot about that one!

All I want to do, maybe this is best in example format:

I am making net shopping. I would like the computer to use 0x2011 of ShoppingRackGlobals: '[semiglobal] Interaction - Buy - Clothing Rack (0x2011)' However, I cannot just type 0x2011 in, as that would call the 0x2011 semiglobal from the comuters semiglobal library.

I want the computer object to be able to call a semiglobal from the clothingrack semiglobals.

Here is what echo says. But, I dont get the last bit.

Adding semi-globals from a foreign semiglobal
library
The process of importing semi-globals from a foreign semi-global
library (that is, a library that is not the one your object normally
accesses,) is similar to the process of importing from your own
library. However, there is an added complexity involved.
Say, for example, you have a painting (which can only see the
“Paintings” semi-globals) and you import a semi-global BHAV from
the “Stereo” semi-global library. Any function calls that exist in the
imported function are expecting to be called from a Stereo type
object, not a Painting type object. Thus, when the BHAV makes a
call to opcode 0x2009, it thinks it will be getting the Stereo semiglobal
(Stereo – Turn Off/On), but what it will actually get is the
Painting semi-global (Interaction – Critique – Test).
This means that when you are importing semi-globals from a
foreign library, you must also import all the semi-globals that are
called by the function and repeat the same process.
One horse disagreer of the Apocalypse
#17 Old 12th Jul 2005 at 11:18 AM Last edited by Inge Jones : 12th Jul 2005 at 11:21 AM.
Ok I just read your final message. That clarifies it a bit. No you can't do it. An object can only recognise one semi global file.

Therefore you need to make the "foreign" BHAV part of your current object package. You need to make new Private BHAVS based on the code in the "foreign" semi global you wanted to use, and call them instead

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Field Researcher
Original Poster
#18 Old 12th Jul 2005 at 12:15 PM
Ye, I thnk thats what Iv done. I used the import SG plugin, and then just set the action field of the TTAB to the imported SG, which is actually classed as a private now.

I also need to update all SG references within though, so it may take a while.
One horse disagreer of the Apocalypse
#19 Old 12th Jul 2005 at 12:50 PM
You did remember to give it an instance number between 0x1000 and 0x1999 didn't you? Or else it will still be looked for in the named SemiGlobal.

Yes, remaking the calling chain when you localise a semi is a bit of a pain, sadly I can't think of another way
Field Researcher
Original Poster
#20 Old 12th Jul 2005 at 2:07 PM Last edited by chrisnjosh : 12th Jul 2005 at 2:10 PM.
It wasnt that difficult. All I did was just found the 4 SG's it called and imported those as well. I dont know if its supposed to ,but SimPE changed the instance # for me. It was automatically a private.

Only think now is that the pie menu wont work. There is no option.

LOL just realised why, I duped the scholarship major option, its the gaurdian thats making it not there!
Retired Duck
retired moderator
#21 Old 12th Jul 2005 at 2:24 PM Last edited by Echo : 12th Jul 2005 at 2:29 PM. Reason: forgot the link...
Aw, no one's ever heard of me... Well fortunately, I've heard of you JM, so I guess that gives me the upper hand? The guide he's refering to is here: http://www.modthesims2.com/showthread.php?t=67365 and I'm always happy to make modifications based on comments from experienced modders such as yourself.

Good to see you figured it out chrisnjosh, but just for clarification (since it was my instructions that caused the confusion in the first place)

You can't import entire semi-global libraries. Your object has one library and that's it. Like Jase said, it's a bit of a poor-man's inheritance system. The explaination I provided in the guide is for importing an individual semi-global function, not the entire library.

What you can do is import INDIVIDUAL behaviors from a semi-global library and make them private functions. Your object doesn't know that the file was ever part of a semi-global library, all it knows is that there is a new local BHAV file that's been copied into it. That's why I explained the process of importing from your own semi-global library first, to clarify what was actually going on.

For example, if there is a BHAV function that belongs to a chair, and you want to your object to have that functionality even though it isn't actually a chair itself, then you can copy that single BHAV function into your object as a local.

Like I said when I explained that in the guide, this can be very complicated, because you then have to track down all the BHAVs that are accessed by your newest BHAV and import them as well. In short, it's a pain, and not for the faint-hearted.

Finally, I'm female. Being refered to as a he is very mildly irritating.
One horse disagreer of the Apocalypse
#22 Old 12th Jul 2005 at 2:58 PM
Hi Echo
Retired Duck
retired moderator
#23 Old 12th Jul 2005 at 3:05 PM
Hi Inge.
Field Researcher
Original Poster
#24 Old 12th Jul 2005 at 4:40 PM
I am very sorry, Mrs Echo I wasnt to know though!

It was not your guide at all that caused confsion. Rather, it was your guide which gave me the conviction that it is possible. I think you sould put in your guide for dummies like me that you use the plugin, or did you and I just didnt read that part! I learnt bhav's from you mainly, good job and thanks.
Retired Duck
retired moderator
#25 Old 12th Jul 2005 at 4:59 PM
"Miss", actually, but getting closer. Don't worry, forums often make people seem confusingly androgenous.

The reason I didn't mention the plugin explicitly is that it is specific to SimPE, and the guide is meant to be generic (so the concepts are the same regardless of whether you were using SimPE/DatGen/Some other program yet to be developed). Plus, with UIs changing on these programs so frequently, it tends to date any explanations.

There is a line that hints to look for these things, but I'm afraid it's a bit of a "blink-and-you'll-miss-it" moment :
"...some Sims tools can perform this task automatically for you on request (to varying degrees of success), so investigate your program for this capability."

A quick heads up on your project though; if you're modding something that uses a "scholarship" option, then it's most likely University specific. When you do get it working, you'll either need to specify that Uni is required, or make a second, EP-free version of your mod.
Page 1 of 2
Back to top