Question about Globals

Post » Fri May 27, 2011 2:41 pm

I have a question about Global variables. If a global is declared in an esp, will that global carry over to other esp's like it was in an esm? I'm making a compatibility patch, and a script I am editing uses a global variable stored in a separate esp. Will that global be valid for the compatibility esp I'm making, or will I have to add it to my compatibility esp?
User avatar
Carlos Rojas
 
Posts: 3391
Joined: Thu Aug 16, 2007 11:19 am

Post » Fri May 27, 2011 2:20 pm

No, the global, even if added to both .esps with the same name, will automatically load in the game with different IDs. I don't believe you can refer to information from one .esp in another that way. :)
User avatar
Emily abigail Villarreal
 
Posts: 3433
Joined: Mon Aug 27, 2007 9:38 am

Post » Fri May 27, 2011 9:03 pm

So how do I go about making the scripts work right. I just tried my patch and it doesn't work. I have a feeling it has something to do with this. Basically I'm trying to make Cats and Rats compatible with OOO's Harvest Containers. If C&R is loaded before OOO, the rats don't spawn like they should. If it is loaded after OOO, the HC don't work like they should. This is because both attach scripts to the same containers. What I did is combine the scripts and attach them to the containers, but it doesn't work. They both use globals in their scripts. Do you think it has something to do with that?
User avatar
Emerald Dreams
 
Posts: 3376
Joined: Sun Jan 07, 2007 2:52 pm

Post » Fri May 27, 2011 11:56 am

The issue is a pretty classic case of incompatibility. Any time two mods change the same object, whichever loads first wins, so second one in the load order will not. Pretty tricky conflict you're tangling. Not sure what options you have for making it work, wish I could help. :shakehead:

Good Luck

[EDIT] Not sure how those mods work, does C&R alter every container? Or just a few? Could they be replaced with custom containers?
User avatar
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Fri May 27, 2011 7:43 am

It alters about 20 containers. So, yes, I suppose they could be replaced with custom containers. Maybe I should look into that.

EDIT

I don't know. It uses vanilla placed containers. So in order to match the spawns I would have to place a lot of containers. I think.
User avatar
Kate Norris
 
Posts: 3373
Joined: Mon Nov 27, 2006 6:12 pm

Post » Fri May 27, 2011 6:25 pm

The issue is a pretty classic case of incompatibility. Any time two mods change the same object, whichever loads first wins, so second one in the load order will not. Pretty tricky conflict you're tangling.

I thought it was the last mod to load wins the conflict. There may be some changes depending on bash tags and if merging is involved.
User avatar
Nick Swan
 
Posts: 3511
Joined: Sat Dec 01, 2007 1:34 pm

Post » Fri May 27, 2011 3:38 pm

I would think you should be able to communicate between mods with globals.
See this topic: http://www.gamesas.com/bgsforums/index.php?s=&showtopic=1067215&view=findpost&p=15507944
Or it could be that I don't understand what they are saying.
User avatar
kirsty joanne hines
 
Posts: 3361
Joined: Fri Aug 18, 2006 10:06 am

Post » Fri May 27, 2011 12:32 pm

I thought it was the last mod to load wins the conflict.


Yeah that could be, flip it. :)
User avatar
Brooks Hardison
 
Posts: 3410
Joined: Fri Sep 07, 2007 3:14 am

Post » Fri May 27, 2011 8:08 am

So how do I go about making the scripts work right. I just tried my patch and it doesn't work. I have a feeling it has something to do with this. Basically I'm trying to make Cats and Rats compatible with OOO's Harvest Containers. If C&R is loaded before OOO, the rats don't spawn like they should. If it is loaded after OOO, the HC don't work like they should. This is because both attach scripts to the same containers. What I did is combine the scripts and attach them to the containers, but it doesn't work. They both use globals in their scripts. Do you think it has something to do with that?

What you should do is to esmify the two esp files you want to make a patch for, then load the CS with those two esm files active, and create your mod. Now, your mod uses both of those as masters, and thereby has full access to any variables, globals, etc. defined in both mods. When you're finished, espify the two masters again, and you have created a patch plugin that has the other two esp files as masters. :)
User avatar
Adrian Morales
 
Posts: 3474
Joined: Fri Aug 10, 2007 3:19 am

Post » Fri May 27, 2011 9:58 am

What you should do is to esmify the two esp files you want to make a patch for, then load the CS with those two esm files active, and create your mod. Now, your mod uses both of those as masters, and thereby has full access to any variables, globals, etc. defined in both mods. When you're finished, espify the two masters again, and you have created a patch plugin that has the other two esp files as masters. :)


Well Cats and Rats is an esp. So I would have to do that for Cats and Rats. But all of the info I need for OOO's HC is located in the OOO esm. So with my patch, you would think that at the least the HC should work, but they don't. What have i done wrong?
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Fri May 27, 2011 8:29 am

Well Cats and Rats is an esp. So I would have to do that for Cats and Rats. But all of the info I need for OOO's HC is located in the OOO esm. So with my patch, you would think that at the least the HC should work, but they don't. What have i done wrong?
Hard to say without looking at your script, but try esmyfying Cats and Rats (right-click on it in Wrye Bash and select "Esmify self" or something like that), then open the CS with both OOO.esm and C&R ticked, create the modifed script, now with full access to any globals etc. and save as a new esp. Then espify C&R again and test.
User avatar
stephanie eastwood
 
Posts: 3526
Joined: Thu Jun 08, 2006 1:25 pm

Post » Fri May 27, 2011 5:33 pm

Well C&R uses globals. Would a script not run if a global is called at the beginning of the script, but for something different? I mean the C&R stuff is in the beginning of my combined scripts. It calls for a global. The HC stuff is in the end of the script. If the global is not recognized, wouldn't the HC stuff still run?
User avatar
Bethany Watkin
 
Posts: 3445
Joined: Sun Jul 23, 2006 4:13 pm

Post » Fri May 27, 2011 8:38 pm

What you really should do is make a mod that would load after both mods, which changes those same containers yet again, but this time sets the script to a new script that is a combination of the scripts from the other two.
User avatar
Luis Reyma
 
Posts: 3361
Joined: Fri Nov 02, 2007 11:10 am

Post » Fri May 27, 2011 8:45 pm

What you really should do is make a mod that would load after both mods, which changes those same containers yet again, but this time sets the script to a new script that is a combination of the scripts from the other two.


That's what I've done. But it doesn't work. I've esmified C&R, saved my plugin. Now should I espify C&R or leave it as is? I haven't tested yet to see if it works.
User avatar
Noraima Vega
 
Posts: 3467
Joined: Wed Jun 06, 2007 7:28 am

Post » Fri May 27, 2011 4:48 pm

Doesn't work. There is more to it than combining the scripts.
User avatar
Katharine Newton
 
Posts: 3318
Joined: Tue Jun 13, 2006 12:33 pm

Post » Fri May 27, 2011 9:13 pm

Bad juju.
User avatar
Killah Bee
 
Posts: 3484
Joined: Sat Oct 06, 2007 12:23 pm

Post » Fri May 27, 2011 8:14 am

Bad juju.

This may work:
1. Open one of the esps you want to patch in the CS. It doesn't really matter which one.
2. Make your script changes and add the variables from the other mod.
3. Repeat fro the other mod.
4. Open your new esps along with the other esp with TES4Edit.
5. Once the files have loaded, right click in the file list area and select create merged patch.
You should now have a file that contains the changes you made to both esps.
6. Right click on each record and select Change FormID. Change them all to an index for the new esp. (You do not want them to have the same index as the esps to be patched yet.)
7. Right click on the file header and remove the two esps you just created as masters.
8. Close TES4edit.
9. Open it back up, load your newest esp. The esps you want to patch should load too if you've created the merged patch correctly.
10. Now right click on each record and change its formid to match the esp it came from.

That should do the trick.
User avatar
kat no x
 
Posts: 3247
Joined: Mon Apr 16, 2007 5:39 pm

Post » Fri May 27, 2011 7:33 am

Can I skip steps 1 - 5 since I already have an esp with the merged scripts?

Aw crap. My head is starting to spin.
User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Fri May 27, 2011 4:06 pm

Alright, I can follow your instructions. The only problem is the merging. The way the scripts are, they have to be merged. So if I copy one scripts' contents in one plugin, the other plugin uses an identically named script. So when they go to be merged, the one overwrites the other. See what I'm saying?
User avatar
FABIAN RUIZ
 
Posts: 3495
Joined: Mon Oct 15, 2007 11:13 am

Post » Fri May 27, 2011 9:30 am

Alright, I can follow your instructions. The only problem is the merging. The way the scripts are, they have to be merged. So if I copy one scripts' contents in one plugin, the other plugin uses an identically named script. So when they go to be merged, the one overwrites the other. See what I'm saying?


I think so.
Since you have one script to replace two and you cannot actually merge the scripts directly, I would look at making three scripts instead.
One each to modify the esp scripts to do nothing and the third to combine the two.

Maybe a better method would be to merge both esps with Gecko. Make your changes, then use TES4Edit to add masters and clean out unneeded duplications.

Good Luck
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Fri May 27, 2011 8:57 am

Ah to heck with it. I'll just load Cats & Rats before OOO. I like Harvest Containers better than more rats running around anyway.
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am


Return to IV - Oblivion