Easy way to add Variables?

Post » Sat May 28, 2011 2:24 pm

I have three Scripts: A, B, and C.
Each Script contains roughly 500 Variables. (It's actually several Scripts, grouped for ease of explaining)
A and B are unique, different numbers; C is intended to add up the results of A1 + B1, A2+B2, A3+B3, et cetera.

What I am wondering is, is there an easy way to make Oblivion do this, without sitting down and writing
Set [Variable] to ( [QuestA.Variable] + [QuestB.Variable] )

several hundred times?

The Variables line up in their own Scripts (so the Variable at Line 6 of Script A is the one that gets added to the Variable at Line 6 of Script B ), so I am hoping maybe there is someway to use that... This isn't really necessary, but the idea of having to sit there and do each one individually is not appealing...

Any suggestions would be great.
User avatar
CxvIII
 
Posts: 3329
Joined: Wed Sep 06, 2006 10:35 pm

Post » Sat May 28, 2011 5:36 pm

Arrays would be the first choice, but I suppose you have reasons for not using them.

I use Excel when I have to write many similar lines. You still have to write the variable names, but use formulas to build the lines.

Example: supposing cells on line 1, columns A-B-C-D-E:
[Variable] [Set ] [ to QuestA.] [ + QuestB.] [=B1&A1&C1&A1&D1&A1]
User avatar
Beat freak
 
Posts: 3403
Joined: Thu Dec 14, 2006 6:04 am

Post » Sat May 28, 2011 6:43 am

Make A, B and C OBSE arrays that are the same size. Then use

array_var iter...foreach iter <- QuestA.arrayA  let arrayC[iter["key"]] := iter["value"] + QuestB.arrayB[iter["key"]]loop


Otherwise, yeah, you'll need need to write out a couple hundred set lines (or use a macro to generate them).
User avatar
FLYBOYLEAK
 
Posts: 3440
Joined: Tue Oct 30, 2007 6:41 am

Post » Sat May 28, 2011 6:10 am

My main reason against Arrays is simply that I don't know HOW to build them...

I was hoping there'd be a Script Command, ala "Set Line1 to ( QuestRef.Line1 + QuestRef.Line2 )" kind of thing.

No matter, if it comes to it, I'll just do it in parts :)

Thanks for the help :)
User avatar
JUDY FIGHTS
 
Posts: 3420
Joined: Fri Jun 23, 2006 4:25 am

Post » Sat May 28, 2011 8:23 am

Yes, I wish there was a tutorial on Arrays with some working examples to recreate.

I am attempting my first Array script and it is scary. But in the end it will likely be much less confusing then it seems just starting out.

Then I will wonder why I did not try to learn them sooner!
User avatar
REVLUTIN
 
Posts: 3498
Joined: Tue Dec 26, 2006 8:44 pm


Return to IV - Oblivion