Re: timers

From: Zerin (dapiner@yahoo.com)
Date: 12/07/01


Micken wrote:
----
.... my mud i need to have a timer between
commands inputted during a fight. so you input a command, and anything you
input after that that has been declared a fight command will not go through
until the given time has elapsed. i hope to make these timers go as fast as
0.5 seconts.
----

I would (in my strange mind) set a play struct for last command time useing
either mud time or real time, or set it in ticks.  Then in heartbeat call a
function
to increase the struct in time (if you used ticks) or use the time call
from anywhere
like if (time < blah) then blah! or if you used a tick system:

--mailer code --  NOT RESOBILE IF IT DOES ANYTHING OR DOESNT!!
In the function/commands add this:
if (GET_FIGHTTICK(ch) < (insert value here))
{
   send_to_char("You are currently in the middle of something and BLAH!",
ch);
   return;
}

Then in the main function of that
GET_FIGHTTICK(ch) = (insert value here);

in heartbeat
every second or so call a function that increases if it .5 seconds make
sure you got
a fast server...

then somewhere else like fight.c  (this is from my newbie channel snippet)

void check_fight_blah(void)
{
  struct char_data *i, *next_char;

  /* characters */
  for (i = character_list; i; i = next_char) {
    next_char = i->next;

 if (conditions go here)
{
  send_to_char("Automatic Newbie Help: Test Message! a\r\n", i);
  GET_FIGHTTICK(ch) -= (amount that it would go when this function
  is called);   // I think it is -= not sure :/
 }
}
}
--mailer code --

I'm sorry bout the possible format of this, i'm not used to codeing in so
many lines :P

That would give you a basic layout for a on tick system.  You can add stuff
to interp.c
and more to improve on it.  I hope this is what you spoke of, and hope it
somewhat right
cause I don't have MSVC to color all the functions to make it all pretty
(dang outlook!)

If you need more help on this subject then feel free to email me.  If this
doesn't work then,
well :P


Zerin
"The bard that could"

P.S. The part where you said "Declared a fight command" you would just edit
interpter.c
where it parses the command array aka: the master list.  Should be hard,
just add like
( "testing" , do_testing, POS_FIGHTING, 0, 0, 1)
then add all the checks in there for it to know if it should ignore the
command look down
where it says "You are fighting for your life!" and put something in there
(but not in the case)



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/24/03 PDT