Spinner385 Posted August 11, 2012 Share Posted August 11, 2012 So my hotkeys mod has been going fairly well. The problem now is my script is so huge it is slow when things get hot. I want to be able to split my script into a setup and use sctipts. The problem is it is highly dependent on several arrays that are properties. Does anyone have any experience with making an array readable between two scripts? I have tried parent/child relationship to no avail. I tried importing one script to the other. I even looked into having the function return said array, this would work but I need it to return several arrays not just one. Any help on this would be GREATLY appreciated. Link to comment Share on other sites More sharing options...
Sjogga Posted August 12, 2012 Share Posted August 12, 2012 (edited) So my hotkeys mod has been going fairly well. The problem now is my script is so huge it is slow when things get hot. I want to be able to split my script into a setup and use sctipts. The problem is it is highly dependent on several arrays that are properties. Does anyone have any experience with making an array readable between two scripts? I have tried parent/child relationship to no avail. I tried importing one script to the other. I even looked into having the function return said array, this would work but I need it to return several arrays not just one. Any help on this would be GREATLY appreciated. You could do something like this: scriptname propertyHolderScript extend ObjectReference Int Property Value auto scriptname intWriter extends ActiveMagicEffect ObjectReference Property propertyHolder auto event oneffectstart(actor target, actor caster) (propertyHolder as propertyHolderScript).Value = utility.randomint(1,10) endEvent scriptname intReader extends ActiveMagicEffect ObjectReference Property propertyHolder auto event oneffectstart(actor target, actor caster) int i = (propertyHolder as PropertyHolderScript).Value debug.messagebox("Writer script set the value to: " + i) endEvent Basically, you create a custom activator to attach the propertyHolderScript to. You can then access its properties by sending in this activator as an ObjectReference property, and type casting it as the script name. It's very handy. You can also use a Quest instead of an activator, though I prefer the latter. Only downside is that you have to place the activator somewhere in the world. Edited August 12, 2012 by Sjogga Link to comment Share on other sites More sharing options...
Spinner385 Posted August 12, 2012 Author Share Posted August 12, 2012 (edited) OMG you are amazing. I haven't tested it but this looks like the ticket. EDIT: I did a simple test and it works like a charm! Kudos times a million. Expect to see a big thank you on my mod page if this helps speed up my script. Edited August 12, 2012 by Spinner385 Link to comment Share on other sites More sharing options...
Spinner385 Posted August 12, 2012 Author Share Posted August 12, 2012 (edited) Question is still open.. While i tested and it works fine with single variables, arrays are another story. Although it does appear I can return a single element of an array. This may be functional but terribly inefficient. I am experimenting. Until then can anyone else help. BTW I don't regret the Kudos, this is a great idea. Thank you for sharing! Edited August 12, 2012 by Spinner385 Link to comment Share on other sites More sharing options...
Spinner385 Posted August 12, 2012 Author Share Posted August 12, 2012 (edited) Sorry to keep responding to my own post but I got it to work! Using Sjogga's idea, I created my own find functions and was able to run it with separate scripts. It is much more responsive. Sjogga I love you man! Edited August 12, 2012 by Spinner385 Link to comment Share on other sites More sharing options...
Sjogga Posted August 12, 2012 Share Posted August 12, 2012 Glad I could help. Also, if you hadn't noticed, you can access functions in the "property-script" as well. Link to comment Share on other sites More sharing options...
Recommended Posts