Sci newbie

Lancelot How can i let a character guard a room like in walk around it all the time.
Nychold The easy answer is:

(send theGuard:setMotion(Wander))

or

(Guard:setMotion(Wander))

where theGuard is a pointer and Guard is an instance, or something like that. I forget the technical terminology. ^_^ However, when I tried to set up it, I noticed a small issue. You'll want to set up the looper as well:

(send theGuard:setCycle(Walker))
(Guard:setCycle(Walker))

Otherwise, he "floats". XD

The more difficult answer involves writing your own "wander" class, but that's a bit beyond my scope at the moment. ^_~
cloudee1 Hey I was thinkin about your question and with wander the guard is going to go all over the screen, you could set up a changestate method and set it up so that he'll walk to one point before he walks to another point and so on.

or, a simpler but but more fun approach...

set up a method doit that goes something like
if guard on control colour red then setmotion walk to xy1, else if guard on control colour green then setmotion walk to xy2
now add the two colours to your pictures each surrounding the appropriate set of xy
when init the guard be sure to set him on one of the two colors, and he should just truck back and forth.
Lancelot Thanks that did it.
I had the problem by using the wander method.
Robin_Gravel Here a scrip with wander is used:


/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 32)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(use "wander")
/******************************************************************************/
(instance public rm032 of Rm
(properties
picture scriptNumber
north 35
east 33
south 0
west 0
)
(method (init)
(super:init())
(self:setScript(RoomScript))

(switch(gPreviousRoomNumber)
(case north
(send gEgo:
posn(120 173)
loop(2)
)
)
)
SetUpEgo()
(send gEgo:init())
(robot:init()setCycle(Walk)setMotion(Wander))
)
)
)
/******************************************************************************/
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if(Said(look>'))
(if(Said('[/*,!*]'))
Print("Empty room")
)
)
)
)
(instance robot of Act
(properties
x 240
y 183
view 79
xStep 5
yStep 5
)
)


Robin Gravel
Nychold There is also a DPath class (which I found after I had finished a Path class) which allows you to add points (x,y) to a List, and then those points get cycled through. Unfortunately, I didn't see a way to pause the actor, which I'm currently working on. You may want to look into using this class, as well. :)