Jump to content

Referencing an element in a WorkshopScript array doesn't seem to get the workshop ID


Recommended Posts

Assuming an array I've already cast "Workshops" as a WorkshopScript, that does seem to populate with a list of workshops, I'm trying to run a check on each one as follows:

int shopid = 0
while (shopid < Workshops.length)
     debug.traceandbox("Checking " + Workshops[shopid])
     if somecondition
          somefunction(Workshops[shopid])
     endif
     shopid += 1
     Utility.Wait(0.5)
endWhile

But it's not working, and the debug message shows "Checking [workshopscript" and the rest of the script doesn't get the ID of the workshop. It seems to follow the format of the examples in the wiki. What am I doing wrong?

 

Edit: actually I think I may be looking at a race condition and the weird debug message is a red herring, as far as functionality. Meanwhile if anyone knows why I'm getting [workshopscript instead of the actual ref ID like I was expecting, I'd love to hear it.

 

Edited edit: while I'd still like to know how to properly get the refID of a settlement into a debug message, you know what really helps in building an array? DECLARING THE ^&@?!!iING ARRAY

 

oh well.

 

For anyone having workshop troubles, or the morbidly curious: the "somefunction" above was taking a subset of Workshops and cramming it into its own dynamic array. Except, while I had defined the array in the Group section at the top of the script, I at no point actually declared it. Papyrus happily compiled my script despite it containing instructions to shove elements into an array that consisted of a black hole.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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