ID:176075
![]() Feb 17 2003, 4:35 pm
|
|
How could i make it so soemthing is locked to the players x plus one and y plus three?
|
![]() Feb 17 2003, 6:31 pm
|
|
<code>mob/player var/obj/myobj mob/player/Move() .=..() if (.) myobj.loc=locate(x+1,y+3,z)</code>
|
. is the default return value, so at the end of a proc, it automatically does "return ." without having you do it. ..() is the default action for the proc (or the parent, so ..() in mob/enemy/ugly/Move() would call mob/enemy/Move()). Move() returns a 1 or a 0 if it succeeds or fails.
|
Koolguy900095 wrote:
How could i make it so soemthing is locked to the players x plus one and y plus three? Just to be clear, would this item need to be on the map or is it something meant more for the screen display? Screen objects are much easier to manage. Lummox JR |
SSChicken wrote:
...what does .=..() do? As I understand it, you could think of it as a short cut way of saying: 'Go do what the default Move() proc is designed to do then come back here and do the code below too.' This provides a nice way of adding more functionality to a BYOND pre-made command or proc(). You may also see the reverse layout: mob/player/Move() // do some code here // at the top .=..() ... which is like saying 'do the code above first, *then* perform the default behavior of the standard Move() proc. Can be very handy when used right. |