Jump to content

OBSE undefned variable array


SonOfCronus

Recommended Posts

I keep getting the error:

Unknown variable npc[0] for parameter variable

Script outline

array_var npcs
....
MessageBoxEX "Select NPC|%n|%n|%n|Cancel" npcs[0] npcs[1] npcs[2]
...

If I use the following

MessageBoxEX "Select NPC|%n|%n|%n|Cancel" (ref)npcs[0] (ref)npcs[1] (ref)npcs[2]

the error goes away but it does not work. I am trying to tell it the type but I do not know how.

 

Link to comment
Share on other sites

IIf memory serves, format strings don't always accept array elements as vars.

 

Try loading the references into ref vars

ref ref0
ref ref1
ref ref2
. . .
let ref0 := npcs[0]
let ref1 := npcs[1]
let ref2 := npcs[2]
MessageBoxEX "Select NPC|%n|%n|%n|Cancel" ref0 ref1 ref2

btw, (ref)npcs[2] is not an acceptable syntax for Oblivion scripts

Edited by QQuix
Link to comment
Share on other sites

IIf memory serves, format strings don't always accept array elements as vars.

 

Try loading the references into ref vars

ref ref0
ref ref1
ref ref2
. . .
let ref0 := npcs[0]
let ref1 := npcs[1]
let ref2 := npcs[2]
MessageBoxEX "Select NPC|%n|%n|%n|Cancel" ref0 ref1 ref2

btw, (ref)npcs[2] is not an acceptable syntax for Oblivion scripts

 

I changed my whole code to use arrays thinking it would be more efficient and clean and now I have to go back. :sick:

 

Thanks

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...