NexusComa2 Posted May 3, 2021 Share Posted May 3, 2021 (edited) This was used in a random generating dungeon mod I made years ago. This mod has an array setup that can handle 895 objects.To set an OBJ to an array you simply call Self.CellCache(Obj) ... The array function will keep track and just add the new one to the stack.In this case it is holding objects in the "mass array". But, this could be set up for any type. Function CellCache() to set an object to the mass array. Function ClearCache() remove/clean up mass array.(Gave a function you didn't need and forget the set up ... facepalm. Let me try that again.)Here is the whole thing ... ObjectReference[] Property o1 Auto Hidden ;* object cachesObjectReference[] Property o2 Auto Hidden ; 128 * 7 = 896 (895 max)ObjectReference[] Property o3 Auto HiddenObjectReference[] Property o4 Auto HiddenObjectReference[] Property o5 Auto HiddenObjectReference[] Property o6 Auto HiddenObjectReference[] Property o7 Auto HiddenInt oC = 0 ;objs ; cell/object (counter)Int[] o1 ;*refInt[] o2 ;*refInt[] o3 ;*refInt[] o4 ;*refInt[] o5 ;*refInt[] o6 ;*refInt[] o7 ;*refo1 =(New ObjectReference[128])o2 =(New ObjectReference[128])o3 =(New ObjectReference[128])o4 =(New ObjectReference[128])o5 =(New ObjectReference[128])o6 =(New ObjectReference[128])o7 =(New ObjectReference[128]);-----------------------Function CellCache(ObjectReference Obj)If(oC<(128))o1[oC]=(Obj)ElseIf(oC<(256))o2[oC-(128)]=(Obj)ElseIf(oC<(384))o3[oC-(256)]=(Obj)ElseIf(oC<(512))o4[oC-(384)]=(Obj)ElseIf(oC<(640))o5[oC-(512)]=(Obj)ElseIf(oC<(768))o6[oC-(640)]=(Obj)ElseIf(oC<(896))o7[oC-(768)]=(Obj)EndIfoC+=(1)EndFunction;-----------------------Function ClearCache()Int r0=(0);---r0=(o1.length)While(r0)r0-=(1)If(o1[r0])o1[r0].Delete()o1[r0]=(None)EndIfEndWhiler0=(o2.length)While(r0)r0-=(1)If(o2[r0])o2[r0].Delete()o2[r0]=(None)EndIfEndWhiler0=(o3.length)While(r0)r0-=(1)If(o3[r0])o3[r0].Delete()o3[r0]=(None)EndIfEndWhiler0=(o4.length)While(r0)r0-=(1)If(o4[r0])o4[r0].Delete()o4[r0]=(None)EndIfEndWhiler0=(o5.length)While(r0)r0-=(1)If(o5[r0])o5[r0].Delete()o5[r0]=(None)EndIfEndWhiler0=(o6.length)While(r0)r0-=(1)If(o6[r0])o6[r0].Delete()o6[r0]=(None)EndIfEndWhiler0=(o7.length)While(r0)r0-=(1)If(o7[r0])o7[r0].Delete()o7[r0]=(None)EndIfEndWhileUtility.Wait(1.0)EndFunctionSorry about the triple post ... drrr Edited May 3, 2021 by NexusComa2 Link to comment Share on other sites More sharing options...
NexusComa2 Posted May 3, 2021 Author Share Posted May 3, 2021 (edited) ... Edited May 3, 2021 by NexusComa2 Link to comment Share on other sites More sharing options...
NexusComa2 Posted May 3, 2021 Author Share Posted May 3, 2021 (edited) ... Edited May 3, 2021 by NexusComa2 Link to comment Share on other sites More sharing options...
Recommended Posts