Difference between revisions of "User:Terra Nova2"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Terra Nova2
imported>Terra Nova2
Line 1: Line 1:
Testing 1 2 3...
 
 
Long function that doesn't work because missing "pieces".
 
<source lang="papyrus">
Location Function GetParentLocation(ObjectReference akRef)
;==============================DOCUMENTATION ON THIS FUNCTION===================================================================
 
; ==============================================================================================================================
Int i = 0
Int iHold = 0
Int iWorldSpaceHold = 0
Int iWorldSpaceLoc = 0
Int iNoParent = 0
Int iGetWorldSpace = 0
Int iIndex = City.Length
Int iHoldIndex = Hold.Length
Int iWorldSpaceLocIndex = WorldSpaceLoc.Length
Int iWorldSpaceHoldIndex = WorldSpaceHold.Length
Int iNoParentIndex = NoParent.Length
Int iGetWorldSpaceIndex = GetWorldSpaces.Length
 
;debug.notification("Name of my location." +akRef.GetCurrentLocation().GetName() as string)
 
IF akRef.GetCurrentLocation() != none ; Check if our cell has a locaiton.
if !akRef.isInInterior() && akRef.GetWorldSpace() == Tamriel ; We're outside and in the Tamriel worldspace.
debug.trace("We're checking for the parent in an exterior.")
While i < iIndex
if City[i] == akRef.GetCurrentLocation() ; Check if our location matches a city.
debug.trace("Storing the index" + i)
Int iSameLocation = i
While iHold < iHoldIndex
debug.trace("We're checking holds.")
if Hold[iHold].isChild(City[iSameLocation])
debug.trace("We're returning the hold that is contained in index" + iHold + "and is" +Hold[iHold].Getname())
return Hold[iHold]
endif
debug.trace("Incrementing through the hold locations" + Hold[iHold].GetName() + "hold.")
iHold += 1
EndWhile
endif
debug.trace("Incrementing through the cities." + i)
i += 1
EndWhile
elseif akRef.IsInInterior() ; We're inside an interior
debug.trace("We're in an interior")
While iHold < iHoldIndex
if Hold[iHold].isChild(akRef.GetCurrentLocation())
debug.trace("Returning_" +Hold[iHold].Getname()+ "hold" + "_for this interior at Index_" +iHold)
return Hold[iHold]
endif
debug.trace("Incrementing through the holds" +Hold[iHold].GetName()+ "hold.")
iHold += 1
EndWhile
elseif akRef.GetWorldSpace() != Tamriel ; We're not in Kansas anymore Dorothy.
debug.trace("We're not in Kansas anymore. Dorothy")
 
While iGetWorldSpace < iGetWorldSpaceIndex
if akRef.GetWorldSpace() == GetWorldSpaces[iGetWorldSpace]
Int StoreWorldSpace = iGetWorldSpace
if
While iWorldSpaceLoc < iWorldSpaceLocIndex
if WorldSpaceLoc[iWorldSpaceLoc] == akRef.GetCurrentLocation()
debug.trace("Returning Tamriel")
return TamrielLocation
endif
debug.trace(WorldSpaceLoc[iWorldSpaceLoc].GetName() +"at index_" +iWorldSpaceLoc+ "_is not the parent.")
iWorldSpaceLoc += 1
EndWhile
 
While iWorldSpaceHold < iWorldSpaceHoldIndex
if WorldSpaceHold[iWorldSpaceHold] == akRef.GetCurrentLocation()
debug.trace("Storing the location_"+WorldSpaceHold[iWorldSpaceHold].GetName()+ "_at index_" +iWorldSpaceHold)
Int iWorldSpaceIndex = iWorldSpaceHold
While iHold < iHoldIndex
debug.trace("Checking holds..")
if Hold[iHold].isChild(WorldSpaceHold[iWorldSpaceIndex])
debug.trace("Retuning the_"+Hold[iHold].GetName()+"hold.")
return Hold[iHold]
endif
debug.trace("Incrementing though the holds_"+Hold[iHold].Getname()+ "_of index_" +iHold)
iHold += 1
EndWhile
endif
debug.trace("Incrementing through the worldspace location index_"+iWorldSpaceHold)
iWorldSpaceHold += 1
EndWhile
 
While iNoParentIndex
iNoParentIndex -= 1
if NoParent[iNoParentIndex] == akRef.GetCurrentLocation()
debug.notification("This location has no assigned parent.")
return none
endif
EndWhile
 
if akRef.GetCurrentLocation() == KatariahLocation
While i < iIndex
if City[i].isChild(KatariahLocation)
Int iKatParent
While iHold < iHoldIndex
if Hold[iHold].isChild(City[iKatParent])
return Hold[iHold]
endif
iHold += 1
EndWhile
endif
i += 1
EndWhile
endif
endif
else
debug.notification("This cell has no assigned location.")
return none
endif
debug.notification("No parents found for any location.")
return none ; return none if no parents are found.
EndFunction
</source>

Revision as of 12:24, 8 April 2016


Long function that doesn't work because missing "pieces".

Location Function GetParentLocation(ObjectReference akRef)
;==============================DOCUMENTATION ON THIS FUNCTION===================================================================

; ==============================================================================================================================
 Int i = 0
 Int iHold = 0
 Int iWorldSpaceHold = 0
 Int iWorldSpaceLoc = 0
 Int iNoParent = 0
 Int iGetWorldSpace = 0
 Int iIndex = City.Length
 Int iHoldIndex = Hold.Length
 Int iWorldSpaceLocIndex = WorldSpaceLoc.Length
 Int iWorldSpaceHoldIndex = WorldSpaceHold.Length
 Int iNoParentIndex = NoParent.Length
 Int iGetWorldSpaceIndex = GetWorldSpaces.Length

 ;debug.notification("Name of my location." +akRef.GetCurrentLocation().GetName() as string)

IF akRef.GetCurrentLocation() != none ; Check if our cell has a locaiton.
	if !akRef.isInInterior() && akRef.GetWorldSpace() == Tamriel ; We're outside and in the Tamriel worldspace.
		debug.trace("We're checking for the parent in an exterior.")
		While i < iIndex
			if City[i] == akRef.GetCurrentLocation() ; Check if our location matches a city.
				debug.trace("Storing the index" + i)
				Int iSameLocation = i
				While iHold < iHoldIndex
					debug.trace("We're checking holds.")
					if Hold[iHold].isChild(City[iSameLocation])
						debug.trace("We're returning the hold that is contained in index" + iHold + "and is" +Hold[iHold].Getname())
						return Hold[iHold]
					endif
					debug.trace("Incrementing through the hold locations" + Hold[iHold].GetName() + "hold.")
					iHold += 1
				EndWhile
			endif
			debug.trace("Incrementing through the cities." + i)
			i += 1
		EndWhile
	elseif akRef.IsInInterior() ; We're inside an interior
		debug.trace("We're in an interior")
		While iHold < iHoldIndex
			if Hold[iHold].isChild(akRef.GetCurrentLocation())
				debug.trace("Returning_" +Hold[iHold].Getname()+ "hold" + "_for this interior at Index_" +iHold)
				return Hold[iHold]
			endif
			debug.trace("Incrementing through the holds" +Hold[iHold].GetName()+ "hold.")
			iHold += 1
		EndWhile
	elseif akRef.GetWorldSpace() != Tamriel ; We're not in Kansas anymore Dorothy.
		debug.trace("We're not in Kansas anymore. Dorothy")

		While iGetWorldSpace < iGetWorldSpaceIndex
			if akRef.GetWorldSpace() == GetWorldSpaces[iGetWorldSpace]
				Int StoreWorldSpace = iGetWorldSpace
				if 
		While iWorldSpaceLoc < iWorldSpaceLocIndex
			if WorldSpaceLoc[iWorldSpaceLoc] == akRef.GetCurrentLocation()
				debug.trace("Returning Tamriel")
				return TamrielLocation
			endif
			debug.trace(WorldSpaceLoc[iWorldSpaceLoc].GetName() +"at index_" +iWorldSpaceLoc+ "_is not the parent.")
			iWorldSpaceLoc += 1
		EndWhile

		While iWorldSpaceHold < iWorldSpaceHoldIndex
			if WorldSpaceHold[iWorldSpaceHold] == akRef.GetCurrentLocation()
				debug.trace("Storing the location_"+WorldSpaceHold[iWorldSpaceHold].GetName()+ "_at index_" +iWorldSpaceHold)
				Int iWorldSpaceIndex = iWorldSpaceHold
				While iHold < iHoldIndex
					debug.trace("Checking holds..")
					if Hold[iHold].isChild(WorldSpaceHold[iWorldSpaceIndex])
						debug.trace("Retuning the_"+Hold[iHold].GetName()+"hold.")
						return Hold[iHold]
					endif
					debug.trace("Incrementing though the holds_"+Hold[iHold].Getname()+ "_of index_" +iHold)
					iHold += 1
				EndWhile
			endif
			debug.trace("Incrementing through the worldspace location index_"+iWorldSpaceHold)
			iWorldSpaceHold += 1
		EndWhile

		While iNoParentIndex
			iNoParentIndex -= 1
			if NoParent[iNoParentIndex] == akRef.GetCurrentLocation()
				debug.notification("This location has no assigned parent.")
				return none
			endif
		EndWhile

		if akRef.GetCurrentLocation() == KatariahLocation
			While i < iIndex
				if City[i].isChild(KatariahLocation)
					Int iKatParent
					While iHold < iHoldIndex
						if Hold[iHold].isChild(City[iKatParent])
							return Hold[iHold]
						endif
						iHold += 1
					EndWhile
				endif
				i += 1
			EndWhile
		endif
	endif	 
else
	debug.notification("This cell has no assigned location.")
	return none
endif
debug.notification("No parents found for any location.")
return none ; return none if no parents are found.
EndFunction