Jump to content

Accessing properties from one script to another.


Recommended Posts

Without using a quest. Is this possible?

 

I have an activator situated in a cell that I use to track certain data and I want another activator to access those properties and use them in a menu(message box). The only problem I'm having is that the script lives on the base object, but all the data tracking is on the reference of that object. I could use a quest, however as I'm using this 'tracker' for all dungeon cells, I wish to avoid writing out 150+ functions and properties.

 

something like..

 

; activator that wants to access script from other activator
....
DataTrackerScript property DTScript auto
 
Function foo()
    someMessage.Show(DTScript.someVar)
EndFunction

 

I'm certain it's not that simple as someVar will point to the base object's value and not the reference's.

Edited by AnishaDawn
Link to comment
Share on other sites

It depends on what your DTScript extends. If it extends ObjectReference, when filling the property in the creation kit you would choose a specific reference in a cell and would access that specific references script. In this case, someVar could be different if there are multiple object references with the script attached.

 

If however DTScript extends activator, when filling the property you would choose the activator form it's attached to. In this case, it gets someVar from the base activator form. Also, in this case, if you change someVar, it will change someVar on each objectreference in game of that activator.

Link to comment
Share on other sites

Actually, I think the way I've gone about this is all wrong. From my tests today, I don't need an Xmarker as a tracker and then another object to handle menu stuff. I can just simply use a physical object to collect data and allow it to display this data. Furthermore the former method mentioned cannot be done anyway, I've tried setting the object as a property and then cast to its script but the compiler says the functions on the script don't exist indicating I can't do that. Thanks for you help though.

Link to comment
Share on other sites

No problem. You should be able to access any script and it's properties as long as you know what you're looking for. Note that your variables have to be set up as properties. So if in your DataTrackerScript you have:

 

Int someVar

 

You can't access that, but if you have

 

Int Property someVar Auto

 

You can access that.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...