Question about references in scripts

Post » Wed Jul 21, 2010 10:54 pm

If I'm writing a script and I want to enable/disable/activate {whatever} a specific item, what is the correct syntax for that? I've tried using %referencename%.enable (ex. - CastleDoorway01REF.enable) but it always tells me the reference can't be found, even if the "persistent reference" option is checked on that instance of the item. I went through several tutorials on the CS wiki, but most of them don't give examples of this. From the few that did, I thought that was the correct way to do it, but obviously I'm doing something wrong.
User avatar
Danger Mouse
 
Posts: 3393
Joined: Sat Oct 07, 2006 9:55 am

Post » Thu Jul 22, 2010 3:58 am

*bump*
User avatar
P PoLlo
 
Posts: 3408
Joined: Wed Oct 31, 2007 10:05 am

Post » Thu Jul 22, 2010 7:19 am

I skipped this last time for two reasons: 1) Usually someone more knowledgeable than me will answer and 2) That seems to be the right way to do it.

Anyway, if you drop an item, NPC, activator, whatever into the render window it will create a reference to it. If you then double click that reference (or right click it in the listing in the cell window and choose "edit") you should get a window of options for that reference. Choosing "persistent reference" in the checkboxes, and then giving it a Reference Editor ID in the top text box, i.e. "CastleDoorway01REF" should enable you to use "CastleDoorway01REF.enable" in a script without an error.

Just remember that it's the "reference editor ID" from this options window, and not the name of the base object that matters.

If that's what you've done, then there's something odd going on. You'll have to confirm the existence and spelling of the reference editor ID.
User avatar
Phillip Hamilton
 
Posts: 3457
Joined: Wed Oct 10, 2007 3:07 pm

Post » Thu Jul 22, 2010 6:19 am

I skipped this last time for two reasons: 1) Usually someone more knowledgeable than me will answer and 2) That seems to be the right way to do it.

Anyway, if you drop an item, NPC, activator, whatever into the render window it will create a reference to it. If you then double click that reference (or right click it in the listing in the cell window and choose "edit") you should get a window of options for that reference. Choosing "persistent reference" in the checkboxes, and then giving it a Reference Editor ID in the top text box, i.e. "CastleDoorway01REF" should enable you to use "CastleDoorway01REF.enable" in a script without an error.

Just remember that it's the "reference editor ID" from this options window, and not the name of the base object that matters.

If that's what you've done, then there's something odd going on. You'll have to confirm the existence and spelling of the reference editor ID.

Thanks Showler - I'll double check everything. It's a huge comfort just knowing that (at least mentally) I'm doing it right.
User avatar
naomi
 
Posts: 3400
Joined: Tue Jul 11, 2006 2:58 pm

Post » Thu Jul 22, 2010 6:36 am

Well, if I'm doing something wrong I can't figure it out. http://mods.omegacron.com/oblivion/scripterror1.jpg showing my reference, my script, and the error that's popping up. I've been staring at it so long it may be obvious to someone else and I'm just not seeing it.
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Thu Jul 22, 2010 5:44 am

You can't start reference variable names with a number. switch it to a letter and you'll be dandy.
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Thu Jul 22, 2010 9:27 am

Oh yeah. That error. I think Oblivion decides that anything starting with a number is a formid, rather than an editorid.
User avatar
matt oneil
 
Posts: 3383
Joined: Tue Oct 09, 2007 12:54 am

Post » Wed Jul 21, 2010 10:29 pm

meh, the editor's an idiot :P It will aways find new ways to baffle me with its eccentricities, but I've learned a fair few of them by now...
User avatar
Chenae Butler
 
Posts: 3485
Joined: Sat Feb 17, 2007 3:54 pm

Post » Wed Jul 21, 2010 7:07 pm

You can't start reference variable names with a number. switch it to a letter and you'll be dandy.

Yep, that was it. Does that only apply to references used in scripts? I used the same naming convention for 100+ references so far, but if it's an issue I might as well bite the bullet and change them all.

Either way - thanks a ton for pointing that out. I can't imagine I would've thought of that unless someone brought it up.
User avatar
Jynx Anthropic
 
Posts: 3352
Joined: Fri Sep 08, 2006 9:36 pm

Post » Wed Jul 21, 2010 8:47 pm

best to rename them i think. You might not have to but it's probably a good thing to do.
User avatar
Soraya Davy
 
Posts: 3377
Joined: Sat Aug 05, 2006 10:53 pm

Post » Thu Jul 22, 2010 9:07 am

Either way - thanks a ton for pointing that out. I can't imagine I would've thought of that unless someone brought it up.
That's a good example of why it's usually best to post a specific example of what's causing the problem, rather than a general one. The vagaries of Oblivion are baffling to the minds of mortals.
User avatar
Manny(BAKE)
 
Posts: 3407
Joined: Thu Oct 25, 2007 9:14 am

Post » Wed Jul 21, 2010 8:17 pm

You may want to use "a1" in the future, works great
User avatar
megan gleeson
 
Posts: 3493
Joined: Wed Feb 07, 2007 2:01 pm

Post » Wed Jul 21, 2010 9:21 pm

So it's okay to use numbers in the ref names though? As an example, the mod I'm working on I named a reference SWAS1, then the next one SWAS2.
User avatar
Jani Eayon
 
Posts: 3435
Joined: Sun Mar 25, 2007 12:19 pm

Post » Thu Jul 22, 2010 9:43 am

It''s just the first character that matters.
User avatar
Invasion's
 
Posts: 3546
Joined: Fri Aug 18, 2006 6:09 pm

Post » Thu Jul 22, 2010 5:46 am

It''s just the first character that matters.
I read once someplace by someone (maybe fluff) that the first 2-3 characters matter btw - I reserve first 4 to be letters to be on the safe side
User avatar
louise hamilton
 
Posts: 3412
Joined: Wed Jun 07, 2006 9:16 am

Post » Wed Jul 21, 2010 11:34 pm

I read once someplace by someone (maybe fluff) that the first 2-3 characters matter btw - I reserve first 4 to be letters to be on the safe side

Never had any problems with a1. I usually start with a1, then a mod tag (For my comeback of the Dawn mod it's COTD, for powerattack voicemod PAVM etc.) Ex: a1COTDMythicDawnDivider01
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm


Return to IV - Oblivion