key001 Posted May 13, 2009 Share Posted May 13, 2009 I'm trying to pass data between 2 scripts, I tried using global variables but I didn't see any effect, so I guess I'm doing that wrong. I made 2 global variables in both esp's, and read/write them in both scripts, but there is no effect in game. So instead I'm using gamesettings to pass the data, like this: SetStringGameSettingEX "sXboxStart|n" and SetStringGameSettingEX "sXboxStart|m" in the 1st script and then accessing that data in the 2nd script like this set fcoll to GetStringGameSetting "sXboxStart"if (sv_Count "m" fcoll >0) <---- check if the letter 'm' is present lol message "blahblah..." set isNotFlying to 1 returnendif I assumed that those xbox variables aren't used.. anyway this works only half of the time and by checking the value of the variable sXboxStart in console i get either "n" or some garbage without a null-terminator instead of 'm'. So, the question is how should I pass the data between the scripts properly or if it can be done with globals, how do I do that? Link to comment Share on other sites More sharing options...
Vagrant0 Posted May 13, 2009 Share Posted May 13, 2009 I made 2 global variables in both esp's, and read/write them in both scripts, but there is no effect in game.This is part of the problem. Globals created in a mod can only be accessed by scripts in that mod. Essentially, what happens is form bashing, where you have 2 different form IDs (since they are different mods) with the same editor ID. The same rules of resources between mods apply to scripts and variables between mods. You cannot use one in the other, and if you create an object with the same name, it will create a conflict. What is happening is that each script is trying to use its own version of that variable instead of a single version. Using the existing globals is not a good idea since they may have undocumented uses internal to the game, or are being handled differently to further prevent converting PC mods for use with Xbox. That particular setting being used is a string, and cannot be used for scripting since scripting functions only work with shorts, longs, and floats. Without knowing more about why these two mods need to communicate to eachother, or what variables they're supposed to share, a possible solution cannot be offered. Link to comment Share on other sites More sharing options...
key001 Posted May 13, 2009 Author Share Posted May 13, 2009 I'm messing with Realistic Fatigue mod and Chingari & Ismelda demon race. For now I want to change the rate at which fatigue is drained in the RF script depending on whether the char is flying or not(0 or 1). The second thing is the flying script checks the collapse value (0 or 1) from RF and if the char collapses from fatigue the flying mode is turned off and the demon takes a dive. I used the xbox string because there are no unused numeric game settings and I don't know if it's easy to create a new one. Also, wrye bash can't merge these mods. Link to comment Share on other sites More sharing options...
Vagrant0 Posted May 13, 2009 Share Posted May 13, 2009 I used the xbox string because there are no unused numeric game settings and I don't know if it's easy to create a new one. Also, wrye bash can't merge these mods.Even if you used a global, a quest script, or any of the normal methods (tokens, abilities, ect.) you would still not be able to have the 2 mods talk to eachother since the thing being checked would be part of the mod. What you really need is something within the .esm that can be adjusted without totally screwing over the rest of the game (obviously). For this, we need to think unconventionally. Basically, you need something that you can either add items to to act as a trigger for the other script, or something you can adjust without impacting any other part of the game. One of the best ones in this case would likely be using CGZombie01REF as a holding container since it has no use past chargen, doesn't get disabled, is a container, and is persistent. If all you're needing to do is a simple true/false check, you can accomplish this by just adding/removing some misc item (like yarn01) to the zombie within the script that contains that action, and then have the related script check for that item in that container to know when it should be performed. As you are not making any direct changes to the creature, it should not cause any issues. For more complicated uses, you could simply add other, different items, change the quantities added, or in extreme cases, use the skills and stats as a numerical storage. You can't get floats using this method, but almost anything that you'd need to use a short for could be achieved in a similar manner. The tutorial dungeon, and most of the test cells have several persistent, non-respawning things, and should not be overlooked (does not need a name, just needs to be persistent). Link to comment Share on other sites More sharing options...
key001 Posted May 13, 2009 Author Share Posted May 13, 2009 Thanks for your help, Vagrant0 :) I found this http://cs.elderscrolls.com/constwiki/index...ecated_Settings so now I'm using fBribeBase and fBribeMult as binary values (I set it either to 3.0 or 0.0 and check if it's >2.9 and <3.1 or <0.1 b/c it's a float) and it works fine for now. At least good enough for personal use. Link to comment Share on other sites More sharing options...
Troy1010 Posted March 9, 2014 Share Posted March 9, 2014 (edited) You can always use TES4Edit to make one mod a master of the other, and use quest scripts. Then, if you wanted to change a variable in the master's quest script, then in the child's script, you'd use: set <master's quest name>.<variable name> to # .. I'm sure there are other ways to do it as well. Edited March 9, 2014 by Troy1010 Link to comment Share on other sites More sharing options...
Recommended Posts