Get your own free workspace
View
 

NextActorInZone

Page history last edited by Gamemaster 3 years, 11 months ago

 

NextActorInZone

Usage:

                NextActorInZone(ActorHandle)

Description:

The NextActorInZone command returns a handle to the next actor in the same zone as the specified actor. This is useful to very quickly iterate through all actors in a single zone. Unlike NextActor, this command will loop infinitely through the actors in a zone, rather than returning 0 when the last actor is reached. Because of this you must check when you reach the original actor rather than when you reach 0.

See also FirstActorInZone.

Example:

                Function Main()
                        // Send a message to every human actor in the same zone as the player
                        Player = Actor()
                        Actor = NextActorInZone(Player)
                        If (Actor != Player)
                                .Loop
                                If (ActorIsHuman(Actor))
                                        Output(Actor, "Hello there!")
                                EndIf
                                Actor = NextActorInZone(Actor)
                                If (Actor != Player)
                                        GoTo(Loop)
                                EndIf
                        EndIf
                        Return()
                End Function

Comments (0)

You don't have permission to comment on this page.