This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Eggdrop crashes when i load the module ive written

Old posts that have not been replied to for several years.
Locked
t
techie

Eggdrop crashes when i load the module ive written

Post by techie »

Ive written a module (modified away.mod),
but when i load it,
eggdrop crashes.

it compiles fine..

here is the code:

Code: Select all

/*
 * Away.mod
 * Version 1.0
 * By Wcc
 * http://www.dawgtcl.com:81/
 * wcc@techmonkeys.org
 *
 * This module makes the bot go away on IRC.
 *
 * Copyright © 2000 - 2002 |DAWG| Scripting Group. All rights reserved.
 *
 */

#define MODULE_NAME "cocacola"
#define MAKING_AWAY
#define cocacola_MAJORV 1
#define cocacola_MINORV 0

#include "../module.h"
#include "../irc.mod/irc.h"
#include "../server.mod/server.h"
#include "../channels.mod/channels.h"
#include <stdlib.h>
#undef global

static Function *irc_funcs = NULL, *server_funcs = NULL, *channels_funcs = NULL;


static Function *global = NULL;

char *cocacola_start();

static int cocacola_expmem()
{
  return 0;
}

static void cocacola_report(int idx, int details)
{
  if (details)
    dprintf(idx, "CocaCola Mod Loaded\n");
}

static void cmd_view(char *nick, char *uhost, struct userrec *u, char *rest)
{
  if (!rest[0]) {
    dprintf(DP_SERVER, "PRIVMSG %s :http://home.no.net/sammot/user.cgi\n");
  }
  else {
    dprintf(DP_SERVER, "PRIVMSG %s :http://home.no.net/sammot/user.cgi?page=view&nick=%s\n", nick, rest);
  }
}

static cmd_t cocacola_msg[] =
{
  {"cocacola",     "",    (Function) cmd_view,       NULL},
  {NULL,        NULL,   NULL,                       NULL}
};

static char *cocacola_close()
{
  module_undepend(MODULE_NAME);
  rem_builtins(H_msg, cocacola_msg);
  return NULL;
}

static Function cocacola_table[] =
{
  (Function) cocacola_start,
  (Function) cocacola_close,
  (Function) cocacola_expmem,
  (Function) cocacola_report,
};

char *cocacola_start(Function *global_funcs)
{
  global = global_funcs;
  module_register(MODULE_NAME, cocacola_table, cocacola_MAJORV, cocacola_MINORV);
  add_builtins(H_msg, cocacola_msg);
  return NULL;
}
[/code]
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

The best way to figure out crash problems with modules is to use gdb.

First, make sure you compile eggdrop with debugguing enabled.

Then, when it crashes, you should have a core file in the bot's directory. Usually it's called core or core.pid. In that dir, type "gdb eggdrop core". It will tell you what code made the eggdrop crash.

And of course the obvious things: Are the necessary modules already loaded? What error message does it print when it crashes?
M
M0dj0

Post by M0dj0 »

Try to change

#define MAKING_AWAY

to

#define MAKING_COCACOLA

and see if that makes it.

If I remember correctly, I had the same problem with my module in the beginning. I think it has todo with the function tables or something.

stdragon: Thanx for that debug tip, gona try it when I get home.

// M0dj0
Locked