is there a way to call a command with a (string) variable as

Post » Sun May 01, 2011 2:30 pm

So could I do something like :
string_var markershort numshort a1;a1 takes a valueset num to a1set marker to sv_Construct "UDUNmarker"let marker := marker + $nummarker.moveto player

User avatar
Mélida Brunet
 
Posts: 3440
Joined: Thu Mar 29, 2007 2:45 am

Post » Mon May 02, 2011 4:02 am

Assuming "UDUNmarker" id part of the EditorID, the answer is NO, because only the CS know them. The game itself would not know what a UDUNmarker01 is.

But you could create an array with all your markers and use the array index

Let MyMarkers := ar_construct arrayLet MyMarkers[0] := UDUNmarker01Let MyMarkers[1] := UDUNmarker02Let MyMarkers[2] := UDUNmarker03Let MyMarkers[3] := UDUNmarker04


And then

let marker := MyMarkers[a1] marker.moveto player

User avatar
R.I.P
 
Posts: 3370
Joined: Sat Dec 01, 2007 8:11 pm

Post » Mon May 02, 2011 1:24 am

at QQuix : how did you know I only had four ? :D

Thanks a lot :)

I do not really understand how is this different from the other one - is marker :
let marker := MyMarkers[a1]marker.moveto player

a string again or something else ??
in other words should I declare it like
ref marker


edit : and can this (the array defs (Let MyMarkers ....)) run to the top part of the string (in the variable definition section) - or must they be repeated in the gammode/menumode etc blocks ?
User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Sun May 01, 2011 10:44 pm

"Let MyMarkers[0] := UDUNmarker01" places the FormID of UDUNmarker01 in the array entry 0, the same way "Set MyRef to UDUNmarker01" places the FormID of the object in a ref variable. In both cases, the compiler translates " UDUNmarker01" into FormID 0xXXXXXXXX.

Yes, marker must be a ref var, so "let marker := MyMarkers[a1]" is the same as "Set marker to UDUNmarker01", but without the object being hardcoded in the script.

The array must be initialized only once, like in a typical DoOnce kind of IF at the beginning of the gamemode block.
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Mon May 02, 2011 3:50 am

:cake: :bowdown:

PS : I seem unable to accept the fact that variables cannot be initialized in Oblivion. I really forget this every other day.

If I am not exhausting you - is this correct :
If eval ((choice == numOfActivators*2 + 1) || (choice == 8))	set choosing to 0

y/n :D
User avatar
Katie Pollard
 
Posts: 3460
Joined: Thu Nov 09, 2006 11:23 pm

Post » Sun May 01, 2011 11:32 pm

PS : I seem unable to accept the fact that variables cannot be initialized in Oblivion. I really forget this every other day.

??? Wouldn't it be variables must be initialized ?

y/n :D

Looks good.
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Sun May 01, 2011 5:38 pm

:) thanks
I mean the doOnce thing (meaning an if check running every time) instead of

short num=3Let MyMarkers := ar_construct arrayLet MyMarkers[0] := UDUNmarker01

in the top part of the script
User avatar
adame
 
Posts: 3454
Joined: Wed Aug 29, 2007 2:57 am


Return to IV - Oblivion