I am trying to add a mod to my mud which uses smaugfuss 1.8 lua in cygwin.
Syntax
------
Disable <command> -- Toggles the command from disabled or enabled.
Disable -- Views list of disabled commands
Installation
------------
1.) Copy the following code (do_disable) into your source (preferably act_wiz.c):
void do_disable( CHAR_DATA *ch, char *argument )
{
CMDTYPE *command;
CMDTYPE *cmd;
char arg1[MAX_INPUT_LENGTH];
int hash, cnt;
smash_tilde( argument );
argument = one_argument( argument, arg1 );
set_char_color( AT_IMMORT, ch );
if ( arg1[0] == '\0' )
{
send_to_char( "Disable what command?\n\r&WCommands currently disabled:&D\n\r", ch );
for ( cnt = hash = 0; hash < 126; hash++ )
for ( cmd = command_hash[hash]; cmd; cmd = cmd->next )
{
if ( IS_SET( cmd->flags, CMD_FLAG_DISABLED ) )
ch_printf(ch, "&w%s&D\n\r", cmd->name );
}
return;
}
command = find_command( arg1 );
if ( !command )
{
send_to_char( "No such command.\n\r", ch );
return;
}
if ( !str_cmp( command->name, "disable" ) )
{
send_to_char( "Ha! No.\n\r", ch );
return;
}
if ( command->level > get_trust(ch) )
{
send_to_char( "You cannot touch this command.\n\r", ch );
return;
}
if ( IS_SET( command->flags, CMD_FLAG_DISABLED ) )
{
ch_printf( ch, "The command '%s' is no longer disabled.\n\r", command->name );
REMOVE_BIT( command->flags, CMD_FLAG_DISABLED );
save_commands();
return;
}
else if ( !IS_SET( command->flags, CMD_FLAG_DISABLED ) )
{
ch_printf( ch, "The command '%s' is now disabled.\n\r", command->name );
SET_BIT( command->flags, CMD_FLAG_DISABLED );
save_commands();
return;
}
}
2.) In mud.h, find these lines:
#define CMD_FLAG_POSSESS BV00
#define CMD_FLAG_POLYMORPHED BV01
#define CMD_WATCH BV02 /* FB */
And below them, add this:
#define CMD_FLAG_DISABLED BV03
3.) In interp.c, find this line:
buf = check_cmd_flags ( ch, cmd );
Before that, add these lines:
if ( IS_SET( cmd->flags, CMD_FLAG_DISABLED ) )
{
send_to_char( "That command is currently disabled.\n\r", ch );
return;
}
4.) Add the appropriate line to mud.h for do_pecho and the 2 lines to tables.c.
5.) Make clean, make and hotboot/reboot the MUD. Use cedit to create the command.
I am having some problems thou, number 4, I can't find the routine do_pecho in my code, and what 2 lines? I guess this is written for someone who knows the code pretty well.
so, will/can someone smaugfuss 1.8 lua-fy this code mod for me? please.
thanks,
Corey
Syntax
------
Disable <command> -- Toggles the command from disabled or enabled.
Disable -- Views list of disabled commands
Installation
------------
1.) Copy the following code (do_disable) into your source (preferably act_wiz.c):
void do_disable( CHAR_DATA *ch, char *argument )
{
CMDTYPE *command;
CMDTYPE *cmd;
char arg1[MAX_INPUT_LENGTH];
int hash, cnt;
smash_tilde( argument );
argument = one_argument( argument, arg1 );
set_char_color( AT_IMMORT, ch );
if ( arg1[0] == '\0' )
{
send_to_char( "Disable what command?\n\r&WCommands currently disabled:&D\n\r", ch );
for ( cnt = hash = 0; hash < 126; hash++ )
for ( cmd = command_hash[hash]; cmd; cmd = cmd->next )
{
if ( IS_SET( cmd->flags, CMD_FLAG_DISABLED ) )
ch_printf(ch, "&w%s&D\n\r", cmd->name );
}
return;
}
command = find_command( arg1 );
if ( !command )
{
send_to_char( "No such command.\n\r", ch );
return;
}
if ( !str_cmp( command->name, "disable" ) )
{
send_to_char( "Ha! No.\n\r", ch );
return;
}
if ( command->level > get_trust(ch) )
{
send_to_char( "You cannot touch this command.\n\r", ch );
return;
}
if ( IS_SET( command->flags, CMD_FLAG_DISABLED ) )
{
ch_printf( ch, "The command '%s' is no longer disabled.\n\r", command->name );
REMOVE_BIT( command->flags, CMD_FLAG_DISABLED );
save_commands();
return;
}
else if ( !IS_SET( command->flags, CMD_FLAG_DISABLED ) )
{
ch_printf( ch, "The command '%s' is now disabled.\n\r", command->name );
SET_BIT( command->flags, CMD_FLAG_DISABLED );
save_commands();
return;
}
}
2.) In mud.h, find these lines:
#define CMD_FLAG_POSSESS BV00
#define CMD_FLAG_POLYMORPHED BV01
#define CMD_WATCH BV02 /* FB */
And below them, add this:
#define CMD_FLAG_DISABLED BV03
3.) In interp.c, find this line:
buf = check_cmd_flags ( ch, cmd );
Before that, add these lines:
if ( IS_SET( cmd->flags, CMD_FLAG_DISABLED ) )
{
send_to_char( "That command is currently disabled.\n\r", ch );
return;
}
4.) Add the appropriate line to mud.h for do_pecho and the 2 lines to tables.c.
5.) Make clean, make and hotboot/reboot the MUD. Use cedit to create the command.
I am having some problems thou, number 4, I can't find the routine do_pecho in my code, and what 2 lines? I guess this is written for someone who knows the code pretty well.
so, will/can someone smaugfuss 1.8 lua-fy this code mod for me? please.
thanks,
Corey