1
SCI Syntax Help / Re: Cursor Hot Spot
« on: March 20, 2007, 08:32:35 PM »Quote
There must be some code in the template game that converts a mouse click into a MoveTo motion for the ego.pre-SCI companion, I found it the hard way... ie simply reading through all the likely scripts.
It's found in USER and looks something like this:
Code: [Select]
(method (handleEvent pEvent)
(var direction)
(if( not (super:handleEvent(pEvent)) )
(switch( (send pEvent:type) )
(case evMOUSEBUTTON
// Make sure it's the left button
(if(not (& (send pEvent:modifiers) emRIGHT_BUTTON)
and (User:controls) )
(self:
setMotion(
MoveTo
(send pEvent:x)
(send pEvent:y)
)
)
(User:prevDir(CENTER))
(send pEvent:claimed(TRUE))
)
)
(case evJOYSTICK
= direction (send pEvent:message)
(if( (== direction (User:prevDir)) and (IsObject(mover)))
= direction CENTER
)
(User:prevDir(direction))
(self:setDirection(direction))
(send pEvent:claimed(TRUE))
)
)
)
return(send pEvent:claimed)
)/[code]
- I've never tried editing it yet - at least not successfully, but then I've not had my head in SCI code for a very long time, I'm a little rusty.[/code]