Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Help with code mod

Help with code mod

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Corey   (54 posts)  Bio
Date Wed 19 Dec 2007 07:33 AM (UTC)
Message
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
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #1 on Wed 19 Dec 2007 01:41 PM (UTC)
Message
i am guessing he meant do_disable as in:

DECLARE_DO_FUN( do_disable );

for tables.c he is talking about similar declarations, do a search for do_goto or something similar, there should be two entries, add do_disable to the appropriate spots.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #2 on Wed 19 Dec 2007 02:06 PM (UTC)
Message
You do not need to do tables.c if you're using FUSS with dynamic tables.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Corey   (54 posts)  Bio
Date Reply #3 on Thu 20 Dec 2007 07:43 PM (UTC)
Message
it's not working or compiling, can someone mod this mod for smaugfuss 1.8 lua in cygwin for me?
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #4 on Fri 21 Dec 2007 05:09 AM (UTC)
Message
an easier suggestion is to post the errors you get when compiling so we can provide you the necessary info to fix your code.
Top

Posted by Corey   (54 posts)  Bio
Date Reply #5 on Fri 21 Dec 2007 05:13 AM (UTC)
Message
thought of that, can't figure out how to capture the errors to a file. I am a dos person and more won't capture in cygwin tcsh.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Fri 21 Dec 2007 05:31 AM (UTC)
Message
Cygwin runs in a "dos" window, the output of which can be copied to the clipboard. Use the system menu (top left corner) and find the Edit -> Mark command. Then drag over the relevant part to select it and then hit <enter> to copy the selected text to the clipboard.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Corey   (54 posts)  Bio
Date Reply #7 on Fri 21 Dec 2007 03:49 PM (UTC)
Message
this is all it would give me:

/cygdrive/c/sfuss/src/mud_prog.c:3260: undefined reference to `call_lua_num(char
_data*, char const*, int)'
o/mud_prog.o: In function `_Z18oprog_drop_triggerP9char_dataP8obj_data':
/cygdrive/c/sfuss/src/mud_prog.c:3276: undefined reference to `call_lua_num(char
_data*, char const*, int)'
o/reset.o: In function `_Z10reset_areaP9area_data':
/cygdrive/c/sfuss/src/reset.c:897: undefined reference to `call_mud_lua(char con
st*, char const*)'
o/save.o: In function `_Z13save_char_objP9char_data':
/cygdrive/c/sfuss/src/save.c:236: undefined reference to `call_lua(char_data*, c
har const*, char const*)'
o/shops.o: In function `do_buy':
/cygdrive/c/sfuss/src/shops.c:578: undefined reference to `call_lua_mob_num(char
_data*, char const*, int, int)'
o/update.o: In function `_Z11char_updatev':
/cygdrive/c/sfuss/src/update.c:844: undefined reference to `call_lua(char_data*,
char const*, char const*)'
o/update.o: In function `_Z14hallucinationsP9char_data':
/cygdrive/c/sfuss/src/update.c:1875: undefined reference to `call_lua_num(char_d
ata*, char const*, int)'
collect2: ld returned 1 exit status
make[1]: *** [smaug] Error 1
make: *** [all] Error 2

C:\sfuss\src>
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #8 on Fri 21 Dec 2007 04:33 PM (UTC)
Message
Doesn't look like it has anything to do with the snippet.

Can you post those lines?

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Corey   (54 posts)  Bio
Date Reply #9 on Fri 21 Dec 2007 06:34 PM (UTC)
Message
Which lines?
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #10 on Fri 21 Dec 2007 08:44 PM (UTC)
Message
what is the very first error you see when you compile
Top

Posted by Corey   (54 posts)  Bio
Date Reply #11 on Fri 21 Dec 2007 10:18 PM (UTC)
Message
this is all I can copy, it only lets me copy whats in the window.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #12 on Fri 21 Dec 2007 10:50 PM (UTC)
Message
You need to take charge of your output or you will not get very far. If you can't see all the error messages how can you fix them?

In Cygwin you can set the number of lines to be saved in the output window, you can also drag and resize it (in fact this applies to any Dos window).

Another approach is to tell make to "page" the compiler output. For example:


 make 2>&1 | less


This will send stderr (the error messages) to stdout (normal output) and then send all of that to the "less" program which stops after a screenfull.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #13 on Fri 21 Dec 2007 10:52 PM (UTC)
Message
However from what I can see of your error messages, they are nothing to do with the snippet, but are something to do with the Lua code either not compiling, or not being linked in. Have you changed the Makefile? Perhaps the lines to link in the Lua parts have gone missing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Corey   (54 posts)  Bio
Date Reply #14 on Fri 21 Dec 2007 11:27 PM (UTC)
Message
ok, I got it to compile, it seems it only sees lowercase file names and my editor, quickedit seems to save files in uppercase in nt. so the compiler can't see any file I edited. boy, this stuff just gets funner ever day....
so, it compiles, disable don't work, all I get is HUH? HUH?
big surprise here...
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


65,339 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.