Assigning variables on declaration

Post » Sat Jun 18, 2011 12:56 am

I think everyone here has been nagged at least once, by having to declare variables and then assigning them.
While I do hate the extra typing, what really bothers me is having to do the classic: "doOnce" check on quest scripts, to assign fQuestDelayTime. I mean, come on....


scn blablablah  float fQuestDelayTime  BeginGameMode      if ( doOnce == 0 )          set fQuestDelayTime to 1          set doOnce to 1      endif  End


Does anyone know a way around this ?


interestingly, I found out that using := on the declaration is a legal operation e.g:

    float myFloatVar:=.5

sadly, it doesn't seem to work...
User avatar
Jeff Tingler
 
Posts: 3609
Joined: Sat Oct 13, 2007 7:55 pm

Post » Sat Jun 18, 2011 5:14 am

Nope.....not really.

One thing about the Oblivion scripting language is that it doesnt use classes.....unless OBSE has some funky new commands to make this faster its going ot have to be the doonce command after declaring your variables.
User avatar
Angel Torres
 
Posts: 3553
Joined: Thu Oct 25, 2007 7:08 am

Post » Sat Jun 18, 2011 3:31 pm

Instead of wasting space on a doonce variable (I never use it) you could use if GetGameLoaded to set fQuestDelayTime and any other variables. To initialize variables I just check an array for being empty or a variable that shouldn't be 0.
User avatar
Shirley BEltran
 
Posts: 3450
Joined: Wed Jul 26, 2006 4:14 pm


Return to IV - Oblivion