Posted at 11:15 PM on 2010-02-03 Report this post If you notice any problems, please post them here and I will fix them as quickly as possible.
Sunjammer
Posted at 07:39 AM on 2010-02-04 Report this post In MassStorage_FetchLocation you have the line:
int nPos = FindSubString(sVariableName, sVariableName);
It should be:
int nPos = FindSubString(sTokenString, sVariableName);
Craig Graff
Posted at 09:42 PM on 2010-02-04 Report this post Sunjammer said:
In MassStorage_FetchLocation you have the line: int nPos = FindSubString(sVariableName, sVariableName); It should be: int nPos = FindSubString(sTokenString, sVariableName);
Fixed.
Kyoma4
Posted at 08:10 AM on 2010-02-05 Report this post This looks great, I've been looking for a way to store a list of objects and I couldn't get an int[] variable to work from inside the .gda file. This looks like exactly the thing I need. Good work. *smile*
[edit] Got a question about the _TalGetStorageCache function. At the end there is this bit
[/edit]
-kyoma
Craig Graff
Posted at 11:05 AM on 2010-02-05 Report this post Kyoma4 said:
Got a question about the _TalGetStorageCache function. At the end there is this bit
-kyoma
Which bit is that?
Kyoma4
Posted at 05:20 AM on 2010-02-06 Report this post Woops sorry, forgot to post the rest. Um well there is the following block and I didn't quite understand what purpose it served. Mainly because it only runs if nCache is non-0, but what difference would there be between the standard, 0, cache and additional, non-0, caches? *unsure*
Posted at 01:45 PM on 2010-02-06 Report this post The base cache is used to store load information and keep track of the array of other cache placeables. It is also what holds the inventory of items which act as the means of locating a particular cache. Unlike all the other caches (of which there could be just one or many if people go crazy), the main cache placeable doesn't hold any of the effects for the user-made caches, since if it got overloaded the entire system would be slow.
Kyoma4
Posted at 12:19 PM on 2010-02-11 Report this post Have a question, or perhaps a request depending on the anwser. I'm storing several values (both integers and strings) in an array with StoreIntegerInArray and StoreStringInArray. Before I'm storing them I need to know they aren't already stored.
I found the FetchXXX functions but they seem to use an integer, as in, to be used to fetch whatever value is at that slot/index. Is there a way to 'search' an array for a value or should I just add something of my own?
Craig Graff
Posted at 04:52 PM on 2010-02-13 Report this post How big is the array? You could always use FetchIntegerArray and then GetIntArrayIndex to find if the value already exists in the array. This loops through each value in the array until it finds the one you specify and returns either the array index the value occupies or -1 if nothing is found. You could copy the code for GetIntArrayIndex for strings as well if it is a fairly small array. If the array is a bit larger you might be better off storing each value as the name of StoreInteger variable (with the same cache name as the array if you like) and have the value stored be the array slot. Then when you want to check if the value is in the array, just call FetchInteger(sArrayName, IntToString(nValue)) or FetchInteger(sArrayName, sValue). If you are a number of values at once, you would be using a combination of the MassStorage_* functions and the Fetch*Array and Store*Array functions (as opposed to StoreIntInArray or the other single variable functions), otherwise things will get slow.
Phaenan
Posted at 06:17 AM on 2010-03-02 Report this post Pfew, finally managed to get my head around the base concept. smilie
Cheers for sharing this. Really. I never thought of using effects to store "global" vars, even though I did use the SetEffectThingy in spells. Don't know why it didn't jumpstart my brain when I was looking for persistent arrays and went all my way building arrays from a bunch of localvars...
Anyhoo ! Nothing important because the function header is correct, but you have a typo on the FetchStringArray() implementation : http://img203.imageshack.us/img203/1819/typoq.png instead of string[] yada yada.
2 comments
Craig Graff
Posted at 11:15 PM on 2010-02-03
Report this post
If you notice any problems, please post them here and I will fix them as quickly as possible.
Sunjammer
Posted at 07:39 AM on 2010-02-04
Report this post
In MassStorage_FetchLocation you have the line:
int nPos = FindSubString(sVariableName, sVariableName);
It should be:
int nPos = FindSubString(sTokenString, sVariableName);
Craig Graff
Posted at 09:42 PM on 2010-02-04
Report this post
Sunjammer said:
In MassStorage_FetchLocation you have the line:
int nPos = FindSubString(sVariableName, sVariableName);
It should be:
int nPos = FindSubString(sTokenString, sVariableName);
Fixed.
Kyoma4
Posted at 08:10 AM on 2010-02-05
Report this post
This looks great, I've been looking for a way to store a list of objects and I couldn't get an int[] variable to work from inside the .gda file. This looks like exactly the thing I need. Good work. *smile*
[edit]
Got a question about the _TalGetStorageCache function. At the end there is this bit
[/edit]
-kyoma
Craig Graff
Posted at 11:05 AM on 2010-02-05
Report this post
Kyoma4 said:
Got a question about the _TalGetStorageCache function. At the end there is this bit
-kyoma
Which bit is that?
Kyoma4
Posted at 05:20 AM on 2010-02-06
Report this post
Woops sorry, forgot to post the rest. Um well there is the following block and I didn't quite understand what purpose it served. Mainly because it only runs if nCache is non-0, but what difference would there be between the standard, 0, cache and additional, non-0, caches? *unsure*
if (!nCache)
{
CreateItemOnObject(TAL_STORAGE_ITEM_RESOURCE, oStorage, 300, "", TRUE, FALSE);
StoreObjectInArray(TAL_STORAGE_ITEM_CACHE_TAG, oStorage, 0);
object oMainCache = _TalGetStorageCache(1);
StoreObjectInArray(TAL_STORAGE_ITEM_CACHE_TAG, oMainCache, 1);
#ifdef TALMUD_STORAGE_DEBUG_INTERNAL
PrintToLog("_TalGetStorageCache: storage cache inventory size: " + ToString(GetArraySize(GetItemsInInventory(oStorage))));
FetchObjectArray(TAL_STORAGE_ITEM_CACHE_TAG);
#endif
}
Craig Graff
Posted at 01:45 PM on 2010-02-06
Report this post
The base cache is used to store load information and keep track of the array of other cache placeables. It is also what holds the inventory of items which act as the means of locating a particular cache.
Unlike all the other caches (of which there could be just one or many if people go crazy), the main cache placeable doesn't hold any of the effects for the user-made caches, since if it got overloaded the entire system would be slow.
Kyoma4
Posted at 12:19 PM on 2010-02-11
Report this post
Have a question, or perhaps a request depending on the anwser. I'm storing several values (both integers and strings) in an array with StoreIntegerInArray and StoreStringInArray. Before I'm storing them I need to know they aren't already stored.
I found the FetchXXX functions but they seem to use an integer, as in, to be used to fetch whatever value is at that slot/index. Is there a way to 'search' an array for a value or should I just add something of my own?
Craig Graff
Posted at 04:52 PM on 2010-02-13
Report this post
How big is the array? You could always use FetchIntegerArray and then GetIntArrayIndex to find if the value already exists in the array. This loops through each value in the array until it finds the one you specify and returns either the array index the value occupies or -1 if nothing is found. You could copy the code for GetIntArrayIndex for strings as well if it is a fairly small array.
If the array is a bit larger you might be better off storing each value as the name of StoreInteger variable (with the same cache name as the array if you like) and have the value stored be the array slot. Then when you want to check if the value is in the array, just call FetchInteger(sArrayName, IntToString(nValue)) or FetchInteger(sArrayName, sValue).
If you are a number of values at once, you would be using a combination of the MassStorage_* functions and the Fetch*Array and Store*Array functions (as opposed to StoreIntInArray or the other single variable functions), otherwise things will get slow.
Phaenan
Posted at 06:17 AM on 2010-03-02
Report this post
Pfew, finally managed to get my head around the base concept. smilie
Cheers for sharing this. Really. I never thought of using effects to store "global" vars, even though I did use the SetEffectThingy in spells. Don't know why it didn't jumpstart my brain when I was looking for persistent arrays and went all my way building arrays from a bunch of localvars...
Anyhoo ! Nothing important because the function header is correct, but you have a typo on the FetchStringArray() implementation :
http://img203.imageshack.us/img203/1819/typoq.png
instead of string[] yada yada.