6
« on: March 09, 2003, 11:43:02 AM »
I decided to post the whole script. So i added in the (if(not (send part so that you can see why it says bracket needed. If i was to leave that part out the script works fine. And i put in that part just like it is in the tutorial...if your not really sure what i mean just ask and ill give a better description.
(instance public rm001 of Rm
(properties
picture scriptNumber
// Set up the rooms to go to/come from here
north 0
east 0
south 0
west 0
)
(method (init)
(if(not (send gEgo:has(INV_KEY)))
(theKey:
init()
setCycle(Fwd)
)
// same in every script, starts things up
(super:init())
(self:setScript(RoomScript))
// Check which room ego came from and position it
(switch(gPreviousRoomNumber)
/******************************************************
* Put the cases here for the rooms ego can come from *
******************************************************/ /*
(case north
(send gEgo:
posn(210 110)
loop(2)
)
)*/
// Set up ego's position if it hasn't come from any room
(default
(send gEgo:
posn(150 130)
loop(1)
)
)
)
// Set up the ego
SetUpEgo()
(send gEgo:init())
/****************************************
* Set up the room's music to play here *
****************************************/ /*
(send gTheMusic:
prevSignal(0)
stop()
number(scriptNumber)
loop(-1)
play()
)*/
/**************************************************
* Add the rest of your initialization stuff here *
**************************************************/
)
)
/******************************************************************************/
(instance RoomScript of Script
(properties)
(method (handleEvent pEvent)
(super:handleEvent(pEvent))
/*****************************************
* Handle the possible said phrases here *
*****************************************/
(if(Said('look'))
Print("You are in an empty room")
)(else
(if(Said('take/key'))
(if(send gEgo:has(INV_KEY))
Print("You already have it!")
)(else
(if(send gEgo:inRect(150 150 170 170))
Print("O.K.")
(send gEgo:get(INV_KEY))
(theKey:hide())
)(else
Print("You're not close enough!")
)
)
)
)
)
)
(instance theKey of Prop
(properties
view 400
x 160
y 160
))
/**************************************************************