Checking what a mob is doing in another room.

For builders to discuss and ask building questions.
Post Reply
User avatar
Duranamir
Sword Grand Master
Sword Grand Master
Posts: 740
Joined: Thu Nov 27, 2003 11:58 am
Location: Skull port

Checking what a mob is doing in another room.

Post by Duranamir » Wed Jul 11, 2007 12:43 pm

Is there a way to check what a mob is doing while it is another room from the checking program ?

For example

I want to check before using an MPTRANSFER PROGRAM whether the mob i am going to transfer is currently fighting. Otherwise i might transfer a mob out of combat which might be a bad idea.

Duranamir
Dalvyn
Sword Grand Master
Sword Grand Master
Posts: 4708
Joined: Tue Jul 15, 2003 9:26 pm
Location: House of Wonder, Waterdeep

Post by Dalvyn » Wed Jul 11, 2007 1:32 pm

Yes, you can perform checks in other rooms, by simply moving the mob to those other rooms.

For example, let's say that I have a farmer mob in room 1000, and two rooms named "fields" (1001 and 1002). Let's assume that item 1009 is a scarecrow. The farmer asks the PC to place/drop a scarecrow in each of the two fields. It could use a program like this:

Code: Select all

>greet_prog 100~
sayto $n Are you done?
~
>speech_prog yes aye~
mpgoto 1001
if ovnumhere(1009) > 0
  mpgoto 1002
  if ovnumhere(1009) > 0
    mpgoto 1000
    sayto $n Congratulations, you did it!
  else
    mpgoto 1000
    sayto $n Liar!
  endif
else
  mpgoto 1000
  sayto $n Liar!
endif
~
(no way to use "and" here)

That one works because it's a mob prog and we just make the mob move. What about object and room progs though?

They work too... because objects and room programs are actually performed by the supermob (i.e., the supermob comes to the room and runs the program); you can thus use the mpgoto commands in those cases too.

The only problem you might encounter, in the case of an object prog, is that you might not know where to have the supermob 'mpgoto' back at the end, because the object can be moved and used in any room. That's generally easy enough to find a workaround though (and you can always use mpgoto $n if you have no other solution).
Image
Post Reply