Script variable question

Post » Wed May 18, 2011 5:14 am

Can you reference a script variable from one esp to another? An esp, not an esm. I've done that, and m,y script isn't doing what it is supposed to, which tells me you can't.
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am

Post » Wed May 18, 2011 1:32 am

Not unless one is a master to the other.

But there is a work around.

Create a new variable in the esp script you are writing, make it the same type as the var you want to check.

Find the quest name and variable in the other esp script you want to reference.

In your script add a line:

RunScriptLine "set myvar to that.var"

Then you can run your script using the same value as that.var.
User avatar
Kate Norris
 
Posts: 3373
Joined: Mon Nov 27, 2006 6:12 pm

Post » Wed May 18, 2011 5:23 am

Thanks!
User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Wed May 18, 2011 4:20 am

Maybe you can help me with something, aellis. I'm trying to make torches brighter in certain places. But the script isn't working. It's real simple. Here's what I have, maybe you know why it isn't working.

RunScriptLine "set Cave to LocationType.Type"if Cave == 2	Torch02.SetLightRadius 2592endif


It's supposed to be brighter in caves and mines. Can I use "Torch02" here as I did, or do I need to make it different? scruggsywuggsy said that Torch02 is a base object and not a reference so I couldn't disable it, but he didn't say anything about using it in the SetLightRadius function.
User avatar
Beth Belcher
 
Posts: 3393
Joined: Tue Jun 13, 2006 1:39 pm

Post » Wed May 18, 2011 4:32 am

Well, if it works the way most things work in Oblivion scripting, and according to the wiki and docs, I'd say using SetLightRadius on a torch base object should work. Maybe you will have to unequip and reequip it for changes to take effect, but that should be all about it.
I'd try both ways of using the function also though. So if "Torch02.SetLightRadius radius" doesn't seem to work, try "SetLightRadius radius Torch02" which is the usual way for giving base objects as parameters. I can't try anything of this myself currently, else I'd have it done and got my facts straight before even considering to answer, but according to the syntax that should do what's intended.
User avatar
dav
 
Posts: 3338
Joined: Mon Jul 30, 2007 3:46 pm

Post » Tue May 17, 2011 5:05 pm

As said above try equipping/unequipping the torch and if push comes to shove, then try disabling/enabling the torch.
User avatar
Gill Mackin
 
Posts: 3384
Joined: Sat Dec 16, 2006 9:58 pm

Post » Tue May 17, 2011 5:41 pm

It's working now, with the help of Drake and scruggsy. Thanks.
User avatar
Sierra Ritsuka
 
Posts: 3506
Joined: Mon Dec 11, 2006 7:56 am


Return to IV - Oblivion