parent
7568d43c56
commit
ae341f973a
4 changed files with 43 additions and 0 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@ |
||||
scriptName critterPerch extends objectReference |
||||
{simple script to allow perches to be reserved} |
||||
|
||||
bool property reserved auto hidden |
||||
{should this object be invalidated for searches?} |
||||
objectReference property incoming auto hidden |
||||
{reference which has reserved me, and is assume to be incoming} |
@ -0,0 +1,36 @@ |
||||
Scriptname Custom Hidden |
||||
import objectReference |
||||
|
||||
|
||||
|
||||
;This function takes in an ObjectReference and counts the number of linked refs that are in a linked Ref chain. |
||||
int Function countLinks(objectReference currentLink) global |
||||
;Don't use this on a loop of linked refs. |
||||
int numPorts = 0 |
||||
while(currentLink) ; && (numPorts < 100)) ;runs until currentLink is None. |
||||
currentLink = currentLink.getLinkedRef() |
||||
numPorts = numPorts + 1 |
||||
endWhile |
||||
if numPorts < 100 |
||||
return numPorts |
||||
else |
||||
; debug.trace( "Too many links, or the linked refs are arranged in a loop." ) |
||||
return 0 |
||||
endif |
||||
endFunction |
||||
|
||||
;This function returns the Nth objectReference in a linked ref chain. |
||||
;The root link in the chain is 1 |
||||
objectReference Function goToLink(int linkNum, objectReference startRef ) global |
||||
int linkIndex = 1 |
||||
while(linkNum != linkIndex ) |
||||
linkIndex = linkIndex + 1 |
||||
objectReference nextRef = startRef.getLinkedRef() |
||||
if nextRef |
||||
startRef = nextRef |
||||
else |
||||
; debug.trace( "Tried to access None link in custom.GoToLink()" ) |
||||
endif |
||||
endWhile |
||||
return startRef |
||||
endFunction |
Loading…
Reference in new issue