question on a object

0 views
Skip to first unread message

johnny

unread,
Dec 20, 2009, 5:55:13 PM12/20/09
to moo-...@googlegroups.com
Hay all i was wondering something. Im not sure how i can set the code right to make this work but ehre is whati did. I created a holster for guns to be put in but on the verb holster this none none on the gun im not sure how to make it move a gun to the holster the person is wearing. I no how to do like this:moveto(number of object); but not sure how to make it go to any of the kids of the generic holster? Can you help me? Thanks.
Come join us on argon
107thezone.com
port 9350
Play a game with lots of fun.

Luke-Jr

unread,
Dec 20, 2009, 5:59:50 PM12/20/09
to moo-...@googlegroups.com
On Sunday 20 December 2009 04:55:13 pm johnny wrote:
> Hay all i was wondering something. Im not sure how i can set the code right
> to make this work but ehre is whati did. I created a holster for guns to
> be put in but on the verb holster this none none on the gun im not sure
> how to make it move a gun to the holster the person is wearing. I no how
> to do like this:moveto(number of object); but not sure how to make it go
> to any of the kids of the generic holster? Can you help me? Thanks. Come

holster = $failed_match;
for o in (player.contents)
if (o:isa($holster))
holster = o;
break;
endif
endfor
if (holster == $failed_match)
return player:tell("You aren't wearing a holster!");
endif
...

johnny

unread,
Dec 20, 2009, 6:30:28 PM12/20/09
to moo-...@googlegroups.com
Ok got the code to compile fine but its now saying line 3 verb not found.
Whaqt am i doing rong i made the verb holster on the generic gun called
holster this none none

Come join us on argon
107thezone.com
port 9350
Play a game with lots of fun.

> --
>
> You received this message because you are subscribed to the Google Groups
> "MOO Talk" group.
> To post to this group, send email to MOO-...@googlegroups.com.
> To unsubscribe from this group, send email to
> MOO-talk+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/MOO-talk?hl=en.
>
>


--------------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.427 / Virus Database: 270.14.116/2578 - Release Date: 12/20/09
19:35:00

Daniel Jung

unread,
Dec 20, 2009, 7:57:58 PM12/20/09
to moo-...@googlegroups.com
johnny wrote:
> Ok got the code to compile fine but its now saying line 3 verb not found.
maybe Luke has the :isa() verb on root, thus applying to all objects.
This is not recommended, because every programmer may write his own
:isa() verb and returning arbitrary answers to calls. You should use the
object utility version.

$object_utils:isa(what, parent)

Good luck:
- Daniel

Luke-Jr

unread,
Dec 20, 2009, 8:16:13 PM12/20/09
to moo-...@googlegroups.com
On Sunday 20 December 2009 06:57:58 pm Daniel Jung wrote:
> johnny wrote:
> > Ok got the code to compile fine but its now saying line 3 verb not found.
>
> maybe Luke has the :isa() verb on root, thus applying to all objects.

No, I just wrote it like that because that's where isa belongs.

> This is not recommended, because every programmer may write his own

Nonsense.

@program #0:isa
return $object_utils:isa(this, @args);
.

> :isa() verb and returning arbitrary answers to calls. You should use the
> object utility version.
>
> $object_utils:isa(what, parent)

Except then programmers cannot override it to be isa($beverage) even without
inheriting from your $beverage.

michael munson

unread,
Dec 21, 2009, 4:35:04 AM12/21/09
to moo-...@googlegroups.com
@create $thing named screw up ISA calls to all descendants,blah
@verb blah:isa this none this rxd
@program blah:isa
return 1;
.

Luke-Jr

unread,
Dec 21, 2009, 1:37:39 PM12/21/09
to moo-...@googlegroups.com
On Monday 21 December 2009 03:35:04 am michael munson wrote:
> @create $thing named screw up ISA calls to all descendants,blah
> @verb blah:isa this none this rxd
> @program blah:isa
> return 1;
> .

Yes, that is a by-design feature that programmers can do that.

Tim van Dijen

unread,
Dec 21, 2009, 1:42:55 PM12/21/09
to moo-...@googlegroups.com
Op 21-12-2009 19:37, Luke-Jr schreef:
> --
>

It is possible to 'block' that behaviour by setting the verb on root -o
or +b (a non-standard verb-flag, patches available on SourceForge).

Goblin

Luke-Jr

unread,
Dec 21, 2009, 2:34:44 PM12/21/09
to moo-...@googlegroups.com
On Monday 21 December 2009 12:42:55 pm Tim van Dijen wrote:
> Op 21-12-2009 19:37, Luke-Jr schreef:
> > On Monday 21 December 2009 03:35:04 am michael munson wrote:
> >> @create $thing named screw up ISA calls to all descendants,blah
> >> @verb blah:isa this none this rxd
> >> @program blah:isa
> >> return 1;
> >> .
> >
> > Yes, that is a by-design feature that programmers can do that.
>
> It is possible to 'block' that behaviour by setting the verb on root -o
> or +b (a non-standard verb-flag, patches available on SourceForge).

Both '-o' and '+b' are non-standard flags, and flawed in concept.
object:isa(parent) is for checking an object's type, not for security.
If you need a non-overridable verb, call it on a specific object, such as:
$object_utils:isa(key, $secured_parent);

But really, there is no reason to insist beverages inherit from your specific
Generic Pepsi... Even better, in fact, would be a verb dobj:can('autorecycle')
returning 1 for objects that are autorecycle-able...

Reply all
Reply to author
Forward
0 new messages