Hi, I am trying to do the following: * Make an object that can be built in workshop mode and that adds a menu to the workshop terminal if it is hooked up. This works. * When the menu item is clicked on the linked terminal, loop through all workshops and check how many items of a certain type exist in all workshops. * Display the number as a notification. My script compiles but when I exectue the menu point in the terminal nothing happens. Then, after a long time (like sleeping in a bed, leaving the settlement etc) it executes. Can someone explain what's wrong? Here is my script fragment:
WorkshopScript[] allWorkshops = WorkshopParent.Workshops as WorkshopScript[]
debug.notification("Starting script.")
int total = 0
int i = 0
int ccount = 0
while (i < allWorkshops.Length)
WorkshopScript curWS = allWorkshops[i]
;how many items are stored here?
ccount = curWS.GetItemCount(Item)
;add number to the total count
total += ccount
i+=1
endWhile
debug.notification("Total number is " + total)
Game.GetPlayer().AddItem(Item,1)