Working on new command

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Working on new command

pizza29965
I was working on a command called florgan, and part of this involves getting everything
displayed to any one person.  It would take everything displayed to one person and display it
to another, so if I am in the client, and I logon as say Smellicus, and I also logon as Norred,
then I use the florgan on Smellicus, Norred and Smellicus will see the same thing, or I mean
that I will see the same thing in both clients.  Of course there would be a little difference,
one line saying basically "You are being controlled by Norred" or "You are controlling
Smellicus".

It would be nice if you could get back to me on this quickly.

Reply | Threaded
Open this post in threaded view
|

Re: Working on new command

Geoff Hollis
There are about a bazillion ways you can handle input/output  
rerouting. Good suggestions have already been offered (imo the best  
being, just dig around and do it the "obvious" way if you're new to  
NM). If you want to take advantage of nakedmud's features, I'd suggest:

1. store a reference to whom you are redirecting to/from
2. make a new input handler that reroutes all of your input to that  
character (calling do_cmd in C, or ch.act() in Python)
3. make a command that pushes the new input handler onto a socket's  
input stack
4. add this at line 346 in inform.c (already included in next version  
of NakedMud):
     hookRun("char_receive_text", hookBuildInfo("ch str", ch, buf));
5. Write a hook that triggers off of char_receive_text, and copies  
the output to the SOCKET of all characters redirecting to/from the  
one in the char_receive_text hook. It has to be directly to the  
SOCKET, or else two characters redirecting to/from each other will  
get stuck in an infinite loop.
6. Write a hook that triggers off of char_from_game, that unassigns  
any references to that character from step 1
7. Optimize when you have lots of players.

This should all be implementable in either Python or C, as a stand-
alone module (or part of a bigger module, if you intend it to be)

On Sep 11, 2008, at 6:59 PM, pizza29965 wrote:

> I was working on a command called florgan, and part of this  
> involves getting everything
> displayed to any one person. It would take everything displayed to  
> one person and display it
> to another, so if I am in the client, and I logon as say Smellicus,  
> and I also logon as Norred,
> then I use the florgan on Smellicus, Norred and Smellicus will see  
> the same thing, or I mean
> that I will see the same thing in both clients. Of course there  
> would be a little difference,
> one line saying basically "You are being controlled by Norred" or  
> "You are controlling
> Smellicus".
>
> It would be nice if you could get back to me on this quickly.
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Working on new command

Geoff Hollis
Whoops, guess I should have read Kaylus' email fully before I sent  
mine. He basically said everything I did. The only thing I added was  
the input handler part (though, I like his approach better).

On Sep 17, 2008, at 9:30 PM, Geoff Hollis wrote:

>
> There are about a bazillion ways you can handle input/output  
> rerouting. Good suggestions have already been offered (imo the best  
> being, just dig around and do it the "obvious" way if you're new to  
> NM). If you want to take advantage of nakedmud's features, I'd  
> suggest:
>
> 1. store a reference to whom you are redirecting to/from
> 2. make a new input handler that reroutes all of your input to that  
> character (calling do_cmd in C, or ch.act() in Python)
> 3. make a command that pushes the new input handler onto a socket's  
> input stack
> 4. add this at line 346 in inform.c (already included in next  
> version of NakedMud):
>     hookRun("char_receive_text", hookBuildInfo("ch str", ch, buf));
> 5. Write a hook that triggers off of char_receive_text, and copies  
> the output to the SOCKET of all characters redirecting to/from the  
> one in the char_receive_text hook. It has to be directly to the  
> SOCKET, or else two characters redirecting to/from each other will  
> get stuck in an infinite loop.
> 6. Write a hook that triggers off of char_from_game, that unassigns  
> any references to that character from step 1
> 7. Optimize when you have lots of players.
>
> This should all be implementable in either Python or C, as a stand-
> alone module (or part of a bigger module, if you intend it to be)
>
> On Sep 11, 2008, at 6:59 PM, pizza29965 wrote:
>
>> I was working on a command called florgan, and part of this  
>> involves getting everything
>> displayed to any one person. It would take everything displayed to  
>> one person and display it
>> to another, so if I am in the client, and I logon as say  
>> Smellicus, and I also logon as Norred,
>> then I use the florgan on Smellicus, Norred and Smellicus will see  
>> the same thing, or I mean
>> that I will see the same thing in both clients. Of course there  
>> would be a little difference,
>> one line saying basically "You are being controlled by Norred" or  
>> "You are controlling
>> Smellicus".
>>
>> It would be nice if you could get back to me on this quickly.
>>
>>
>
>
>