sHash
Download for sHash: https://github.com/QCPolmer/AdventureGameStudio_sHash/blob/master/sHash.scm?raw=true (https://github.com/QCPolmer/AdventureGameStudio_sHash/blob/master/sHash.scm?raw=true)
sHash is a simple module that allows a string to act like a dictionary.
It works like this:
someString = sHashSet( someString , "key1", "subject"); // adds key ''key1" to string
sHashGet( someString , "key1"); // gets ''subject"
someString = sHashRemove( someString , "key1"); // Removes "key1"
This can take strings, ints, and floats ( sHashSetFloat, sHashSetInt, etc. )
Also, here is another, similar script:
sList
Download for sList: https://github.com/QCPolmer/AdventureGameStudio_sHash/blob/master/sList.scm?raw=true (https://github.com/QCPolmer/AdventureGameStudio_sHash/blob/master/sList.scm?raw=true)
This is similar to the above, but it allows strings to act like lists.
Here is how to use it:
someString = sListInsertItem( someString, "ListName", "Text To Add", 0); // adds Text To Add
sListGetItem( someString, "ListName", 0); // fetches "Text To Add"
someString = sListRemoveItems( someString, "ListName", 0, 1); // removes list item 0
and, best of all, the sList can be shuffled with a single function.
someString = sListShuffle( someString, "ListName");
These two scripts work together fairly well ( they can be nested ).
The one exception is if a key name or list name is inside a sList or sHash with the same key or listname.
In those cases, it starts botching up.
EG:someString = sHashSet( someString , "key1", "subject"); // adds key "key1" to string
someOtherString = sHashSet( someOtherString , "key1", someString ); // getting "key1" will be a problem
A list of all functions can be found on the github page:
https://github.com/QCPolmer/AdventureGameStudio_sHash (https://github.com/QCPolmer/AdventureGameStudio_sHash)
Both scripts are under MIT license.
Enjoy!
( written in AGS 3.3.0 )