A resource function I'm not taking credit for considering it is combination of info I've read all day long. Also I wanna use arrays now to cut down on the army of elseifs I use and Ginness Book world record contenders for the longest If statement ever made.
OK
Bool Function GetCurrentLocationArray(Location[] akLocationArray, Location akCurrentLocation)Int iIndex = 0 While iIndex < akLocationArray.Length if akLocationArray[iIndex] == akCurrentLocation ;if the current location matches any locations in the index. return true else ;Keeps counting til the location is found. iIndex += 1 endif EndWhile ;Location not found. return falseEndFunction
Basically, I sought out arrays because checking a current location against many possible locations would be tiresome to type out. I needed my spell for teleporting prisoners in my mod to check the location bards are in, and run the rest of the code if they are not in a certain location. In this case, my array contains all the inns(their location forms) that have bards.
It doesn't include checking for child locations.
It works will with GetCurrentLocation(), though I haven't tested with IsInLocation() and that has an additional check for child locations.