| 05-16-2004, 11:35 PM | #1 |
Argh, how the heck do I do this. I need a string database that hold multiple string arrays, and I need to be able to access each array and one of their elements at any given time. Something like Code:
StringDatabase[WantedArray][WantedArrayElement] How on earth would I organize something like that? |
| 05-17-2004, 01:07 AM | #2 |
Use gamecache with the name of the wanted array as category and the number of the element converted to string in the last field. |
| 05-17-2004, 08:21 AM | #3 | |
Quote:
Something like this should work: function storage takes nothing returns gamecache return InitGameCache("storage.w3v") endfunction function StoreStringArray takes string value, integer first, integer second returns nothing call StoreString(storage(), I2S(first), I2S(second), value) endfunction function RetrieveStringArray takes integer first, integer second returns string return GetStoredString(storage(), I2S(first), I2S(second)) endfunction // StoreStringArray(<valuetobestored>, first array, second array) // String = RetrieveStringArray(first array, second array) Not Tested |
| 05-17-2004, 08:54 AM | #4 |
That will work perfect Andy, thanks. |
| 05-18-2004, 04:44 PM | #5 |
An alternative, but somewhat limited why to do it, could be to use a string array as a 2D string array. Code:
globals integer LENGTH = 42 string array theStrings endglobals function set takes string value, integer arrayNum, integer pos returns nothing set theStrings[arrayNum*LENGTH + pos] endfunction function get takes integer arrayNum, integer pos returns string return theStrings[arrayNum*LENGTH + pos] endfunction |
