OK. Some times ago I ask how to do visible delays. But almost all cannot
catch idea. Now I made snippet for this. If anyone interested, use it :)
Very useful :))))
Visible WAIT_STATE code by Ranka the Implementor of Arion
[telnet://irc.nohik.ee 4242] ([EMAIL PROTECTED]).
- credits -
You may use this code when you give me about $1000, my
name have to marked in each help file and also I need
full access into your MUD! It was joke :)
You may use this code however you wish. Build more into it,
give it to friend or to your dog, or I don't know. I don't
need any credits or help files. Only thing what I want -
when you found bug, typo or something like that. Just
mail to me at: [EMAIL PROTECTED] or come to
telnet://irc.nohik.ee on port 4242 and contact with
Ranka.
- notes -
This code hasn't well tested. And it may include some bugs,
if you found any bug, please send mail to me at:
[EMAIL PROTECTED] or come to telnet://irc.nohik.ee 4242
and contact with Ranka.
P.S. BEFORE INSTALLING ALWAYS MAKE A BACKUP!!!!!!!!!!!!!!!!!!!!
- explanation -
using this code, you can see your delays as 'points',
for example:
cast 'armor'
You begin to utter some strange incantations...
You are already armored.
...... <----- this is delay
The High Priest says '.. about 'the Elendil Sword' then talk to me.'
..... <--- this is delay
And always you can turn these 'points' off and to get usual ROM delay
mood.
- installing -
Open the file:
-- merc.h --
------------
Find following lines:
#define PLR_AUTOSAC (F)
#define PLR_AUTOGOLD (G)
#define PLR_AUTOSPLIT (H)
And add following:
#define PLR_WAIT (I)
if it is done. Savd and close the MERC.H
========================================
Now open the file act_info.c!
----------------
-- act_info.c --
----------------
At the end of the file add following:
/*
* command for showing delays
*/
void do_delay( CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
one_argument( argument, arg );
if (IS_NPC(ch))
return;
if (arg[0] == '\0')
{
if (IS_SET(ch->act, PLR_WAIT))
{
send_to_char("Delay display is now OFF.\n\r", ch);
REMOVE_BIT(ch->act, PLR_WAIT);
}
else
{
send_to_char("Delay display is now ON.\n\r", ch);
SET_BIT(ch->act, PLR_WAIT);
}
}
if ( !str_cmp( arg, "on" ))
{
send_to_char("Delay display is now ON.\n\r", ch);
SET_BIT(ch->act, PLR_WAIT);
return;
}
else if ( !str_cmp( arg, "off" ))
{
send_to_char("Delay display is now OFF.\n\r", ch);
REMOVE_BIT(ch->act, PLR_WAIT);
return;
}
else if ( !str_cmp( arg, "status" ))
{
send_to_char("Your delay status is currently", ch);
if (IS_SET(ch->act, PLR_WAIT))
send_to_char(" ON.\n\r", ch);
else
send_to_char(" OFF.\n\r", ch);
return;
}
}
Close the act_info.c and open comm.c
===========================
Open file:
------------
-- comm.c --
------------
in function, "void game_loop_unix( int control )",
there find following lines:
if (d->character != NULL && d->character->wait > 0)
{
--d->character->wait;
continue;
}
REPLACE previous lines with following:
if ( d->character != NULL && d->character->wait > 0 )
{
if (d->character->position != POS_FIGHTING
&& IS_SET(d->character->act, PLR_WAIT))
{
if (d->character->wait == 1)
send_to_char("\n\r\n\r", d->character);
--d->character->wait;
send_to_char(".", d->character);
continue;
}
else
{
--d->character->wait;
continue;
}
}
Now find function, "bool process_output( DESCRIPTOR_DATA *d, bool fPrompt
)".
There find following lines:
if (!IS_SET (ch->comm, COMM_COMPACT))
write_to_buffer (d, "\n\r", 2);
REPLACE these lines with following:
if (!IS_SET(ch->comm, COMM_COMPACT) )
{
if (ch->wait <= 0 || ch->fighting != NULL || !IS_SET(ch->act, PLR_WAIT))
write_to_buffer( d, "\n\r", 2 );
}
Now find function, "void bust_a_prompt( CHAR_DATA *ch )"
and find following lines:
point = buf;
str = ch->prompt;
After these lines add following:
if (ch->wait > 0 && ch->fighting == NULL && IS_SET(ch->act, PLR_WAIT))
return;
Now find function,
"void write_to_buffer( DESCRIPTOR_DATA *d, const char *txt, int length )",
there find:
/*
* Initial \n\r if needed.
*/
if (d->outtop == 0 && !d->fcommand)
{
d->outbuf[0] = '\n';
d->outbuf[1] = '\r';
d->outtop = 2;
}
And REPLACE it with:
/*
* Initial \n\r if needed.
*/
if ( d->outtop == 0 && !d->fcommand )
{
if (d->character != NULL
&& (d->character->wait <= 0 || d->character->fighting != NULL))
{
d->outbuf[0] = '\n';
d->outbuf[1] = '\r';
d->outtop = 2;
}
}
================================================
-----------------------
-- comm.c or nanny.c --
-----------------------
/* If you have file 'nanny.c' open it, if not then open comm.c */
Now find:
sprintf (buf, "the %s", title_table[ch->class][ch->level]
[ch->sex == SEX_FEMALE ? 1 : 0]);
set_title (ch, buf);
And add before or after it following lines:
SET_BIT(ch->act, PLR_WAIT);
/* it sets WAIT displaying ON, when new character enters the game,
You may turn it off, 'SET_BIT(ch->act, PLR_WAIT)' or remove it. */
====================================================================
--------------
-- interp.c --
--------------
Add new command, 'do_delay' at the end of the command list.
{ "delay", do_delay, POS_DEAD, 0, LOG_NORMAL, 1 },
=====================================================================
--------------
-- interp.h --
--------------
Add new command, 'do_delay' somewhere in interp.h,
DECLARE_DO_FUN( do_delay );
/***********************************************************************/
/* Now 'make clean' and recompile. It should be work, but if You have */
/* some problems, found typos, bugs, ideas or if you hate me, then */
/* feel free to mail me at: [EMAIL PROTECTED] */
/* */
/* Thanks for using my Snippet. */
/* Rainer Roomet. */
/* The Lost Lands of Arion */
/* telnet://irc.nohik.ee 4242 */
/* [EMAIL PROTECTED] */
/* */
/* 30.05.2004. */
/*************************************************************************
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail