Re: Help

"Michael Barton" <[email protected]> Fri, 4 Aug 2006 02:17:13 -0500
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
>         if (d->incomm[0] != '\0' && !IS_NPC(d->character))

So probably this line will have to be changed, to look through the
buffer for a specific string rather than just 'not empty'.  Maybe
something along the lines of...

if (!str_prefix("stop", d->incomm) || !str_infix("\rstop", d->incomm)
|| !str_infix("\nstop", d->incomm))

Well, that's probably not optimal.  But you see that the commands are
in that buffer, delimited by newline chars.  str_infix or strstr or
something may be good enough to look through it, or you may have to
step through the chars yourself, depending on exactly how you want it
to work.



On 8/4/06, Rainer Roomet <[email protected]> wrote:
> Ok. Some extra information:
>
> do_bash.
>
> If your bash is succesful (You know the skill, you see the victim etc)
>
> Then you start pre_lagging (perform_twiddle)
>
> void perform_twiddle(void)
> {
>    CHAR_DATA *i, *next_char;
>
>    /* characters */
>    for (i = char_list; i; i = next_char)
>    {
>       next_char = i->next;
>
>       if (i->position >= POS_STUNNED && GET_TWIDDLE(i) )
>       {
>          GET_TWIDDLE(i)--;
>
>          if( GET_TWIDDLE(i))
>          {
>             // Twiddle prompt
>
>
>            if (!IS_NPC(i) && i->desc != NULL)
>            {
>               write_to_descriptor(i->desc->descriptor, GET_TWIDDLE(i) % 2 ? "-" :
> "|", 1);
>            }
>
>            // Verify the victim and or item is here
>            if( GET_TWIDDLE_VICTIM(i) != NULL )
>            {
>               if( i->in_room != (GET_TWIDDLE_VICTIM(i))->in_room )
>               {
>                  send_to_char( "Your victim has disappeared!\r\n", i );
>                  GET_TWIDDLE(i) = 0;
>               }
>            }
>
>            // TODO: ought to verify item is here too
>            // Verify we are in the room we started doing this
>
>            if (GET_TWIDDLE_ACTION(i) == 2 && GET_TWIDDLE_INT(i) != -1)
>            {
>               EXIT_DATA *pexit;
>
>               pexit = i->in_room->exit[GET_TWIDDLE_INT(i)];
>
>               if ( !IS_SET(pexit->exit_info, EX_CLOSED))
>               {
>                  send_to_char( "Oopps... You can't concentrate
> anymore..\n\rYou stop picking!\n\r",i);
>                  GET_TWIDDLE(i) = 0;
>               }
>            }
>
>            if (GET_TWIDDLE_ACTION(i) == 1 && GET_TWIDDLE_VICTIM(i)->bash_delay > 1)
>            {
>               send_to_char("Bash someone already bashed? Aren't we
> funny?\r\n", i);
>               GET_TWIDDLE(i) = 0;
>            }
>
>            if( GET_TWIDDLE_INROOM(i) != i->in_room->vnum )
>            {
>               send_to_char( "You were not able to keep your concentration while
> moving.\r\n", i );
>               GET_TWIDDLE(i) = 0;
>            }
>         }
>         else
>         {
>             // Twiddle expired, do the thing
>             switch( GET_TWIDDLE_ACTION( i ) )
>             {
>                case 1:
>                   actual_bash(i, GET_TWIDDLE_VICTIM(i) );
>                break;
>
>                case 2:
>                   actual_pick(i, GET_TWIDDLE_INT(i) );
>                break;
>
>                case 3:
>                   actual_backstab(i, GET_TWIDDLE_VICTIM(i) );
>                break;
>
>                default:
>                   send_to_char("Error: unknown twiddle target\r\n", i);
>                break;
>             }
>          }
>       }
>    }
> }
>
> It is executed in each pulse. If delay expires DO:
>     // Twiddle expired, do the thing
>             switch( GET_TWIDDLE_ACTION( i ) )
>             {
>                case 1:
>                   actual_bash(i, GET_TWIDDLE_VICTIM(i) );
>                break;
>
>                case 2:
>                   actual_pick(i, GET_TWIDDLE_INT(i) );
>                break;
>
>                case 3:
>                   actual_backstab(i, GET_TWIDDLE_VICTIM(i) );
>                break;
>
>
> Now.
>
> comm.c, "game_loop_unix", after the "decrease the wait"
>
> I USED the following code but I need other code:
>
>       if( d->connected == CON_PLAYING && GET_TWIDDLE(d->character))
>       {
>           if (d->incomm[0] != '\0' && !IS_NPC(d->character))
>           {
>              char buf[MSL];
>
>              GET_TWIDDLE(d->character) = 0;
>
>              sprintf(buf, "You stop your %s attempt!\n\r",
>                 GET_TWIDDLE_ACTION(d->character) == 1 ? "bashing" :
>                 GET_TWIDDLE_ACTION(d->character) == 2 ? "picking" : "stabing");
>              send_to_char(buf, d->character);
>           }
>           else
>           continue;
>       }
>
>
> currently:
>
> bash elrond;worth
>
> <Room:7924 Incog:0 Invis:0: >bash elrond
> worth
> -
> You stop your bashing attempt!
> You have 606 gold 33 silver 100 copper pennies, and 30,000,000 exp (0 exp to
> level).
>
>
> It means ANY COMMANDS cancels the delay but I NEED:
>
>
> bash elrond;worth
> <Room:7924 Incog:0 Invis:0: >bash elrond
> -|-|-|-|-|-|-|-
> You slam into [#7823] Elrond the King of Elves, and send him flying!
> [#7823] Elrond the King of Elves says 'I was your last mistake,  Orc!'
> Your bash grazes [#7823] Elrond the King of Elves. [5]
>
> You have 606 gold 33 silver 100 copper pennies, and 30,000,000 exp (0 exp to
> level).
>
> ----
> It means as "usual wait state". If the delay expires then the next command
> will be executed. Yes it's easy but I need "STOP" command to cancel the
> delay. Why? For example, you start to bash elrond but your sanc suddenly
> wears off and now you want to cancel the delay to avoid death, or suddenly
> too many enemies have arrived. Example:
>
> bash elrond;worth
> -|-|-|-
> stop
>
> You stop your bashing attempt!
> You have 606 gold 33 silver 100 copper pennies, and 30,000,000 exp (0 exp to
> level).
>
>
>
> I have tried todo it about 100 hours - but I failed. I added different codes
> to different place - but no success. I have been asked from many, many mud
> forums - nothing..
>
>
>
> It's my last chance.
>
> ### NB! Again, please send answer copy to my original mail :) Just in case
> :)
> [email protected]
>
> Thank you for listening my problem.
>
>
>
>
> Rainer Roomet
> Phone: (+372) 58133281
> Mail/MSN: [email protected]
>
>
>
>
>
> >From: "Michael Barton" <[email protected]>
> >To: "Rainer Roomet" <[email protected]>
> >CC: [email protected]
> >Subject: Re: Help
> >Date: Fri, 4 Aug 2006 01:32:26 -0500
> >
> >>if (d->inbuf[i] == 'S')
> >>       {
> >>          send_to_char("You stop your bash attempt!\n\r", d->character);
> >...
> >>then it works if I enter "S" letter in first command then he stops the
> >>bash
> >>attempt but if I enter the second command command (bash hassan;worth;S)
> >>then
> >>it won't work - it just waiting for delay, bash and then do these
> >>commands!
> >>
> >>Any ideas? Or I have to make some kind of  "command history" but how?
> >
> >I don't think it'll be strictly necessary, but it might be easier to
> >work with a list of incoming commands as opposed to a buffer if you
> >intend to do much manipulation to it.
> >
> >It would help some to know exactly how you've implemented the pre-lag
> >and where you're trying to insert this code.  It *looks* like it's in
> >read_from_buffer, which makes me wonder where you're short-circuiting
> >user input at when they're lagged.  Because normally it'd be before
> >that.
> >
> >--Palrich.
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> --
> ROM mailing list
> [email protected]
> Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom