sizenine Posted March 16, 2012 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 149 Reputation: 12 Joined: 02/17/12 Last Seen: January 25, 2018 Share Posted March 16, 2012 (edited) I'm getting this error: npc.c:784: undefined reference to `aMallocA' from applying this diff by ToastOfDoom.. can anyone help me solve this? http://www.eathena.w...howtopic=272578 Here is part of the src that shows line 784 in npc.c: +int do_atcmd_event (struct map_session_data* sd, const char* command, const char* message, const char* eventname) +{ + struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname); + struct npc_data *nd; + struct script_state *st; + int i = 0, j = 0, k = 0; + char *temp; + temp = (char*)aMallocA(strlen(message) + 1); + + nullpo_ret(sd); + + if( ev == NULL || (nd = ev->nd) == NULL ) + { + ShowError("npc_event: event not found [%s]n", eventname); + return 0; Edited March 16, 2012 by sizenine Quote Link to comment Share on other sites More sharing options...
ngek202 Posted March 16, 2012 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 530 Reputation: 33 Joined: 01/17/12 Last Seen: August 16, 2017 Share Posted March 16, 2012 replace aMallocA with aMalloc 1 Quote Link to comment Share on other sites More sharing options...
sizenine Posted March 16, 2012 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 149 Reputation: 12 Joined: 02/17/12 Last Seen: January 25, 2018 Author Share Posted March 16, 2012 Thanks that seems to have worked but now I found a possible glitch... I've written somewhat of a small script to add a requirement for Emperium when using the command @guild: - script atcmd_sample_inject -1,{ OnInit: bindatcmd("guild", "atcmd_sample_inject::OnAtCmd"); end; OnAtCmd: if (.@atcmd_command$ == "$guild") { end; } if(countitem(714) < 1) { dispbottom "You need the necessary item to create a Guild."; } else { useatcmd "@guild " + .@atcmd_parameters$[0]; } end; } After implementing that script, the @guild command works fine with the item requirement. However, when I try to use #guild <charname> <guildname>, the map server will receive a crash signal. Is there something wrong with my script? Or is this a flaw in the diff? Quote Link to comment Share on other sites More sharing options...
Derceto Posted March 16, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 43 Reputation: 2 Joined: 01/17/12 Last Seen: February 15, 2014 Share Posted March 16, 2012 (edited) Probably has something to do with attached player when checking and "useatcmd"-ing, probably null reference in useatcmd. Put some console debug writers in that function and see what you get. My guess is that it doesn't check whether <charname> is actually a character. Edited March 16, 2012 by Derceto Quote Link to comment Share on other sites More sharing options...
sizenine Posted March 16, 2012 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 149 Reputation: 12 Joined: 02/17/12 Last Seen: January 25, 2018 Author Share Posted March 16, 2012 Probably has something to do with attached player when checking and "useatcmd"-ing, probably null reference in useatcmd. Put some console debug writers in that function and see what you get. My guess is that it doesn't check whether <charname> is actually a character. Sorry I'm not too familiar with console debug writers".. but I've tried it on actual existing char names and it still crashes the server. Quote Link to comment Share on other sites More sharing options...
Derceto Posted March 16, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 43 Reputation: 2 Joined: 01/17/12 Last Seen: February 15, 2014 Share Posted March 16, 2012 I mean, find the function "useatcmd" and fill it with ShowInfo() watches to see what happens when it crashes Quote Link to comment Share on other sites More sharing options...
sizenine Posted March 16, 2012 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 149 Reputation: 12 Joined: 02/17/12 Last Seen: January 25, 2018 Author Share Posted March 16, 2012 (edited) so i just stick a bunch of "ShowInfo()" between the code lines? BUILDIN_FUNC(useatcmd) { TBL_PC dummy_sd; ShowInfo(); TBL_PC* sd; ShowInfo(); int fd; ShowInfo(); const char* cmd; ShowInfo(); cmd = script_getstr(st,2); if (st->rid) { ShowInfo(); sd = script_rid2sd(st); ShowInfo(); fd = sd->fd; ShowInfo(); } else { //Use a dummy character. ShowInfo(); sd = &dummy_sd; fd = 0; ShowInfo(); memset(&dummy_sd, 0, sizeof(TBL_PC)); ShowInfo(); if (st->oid) { ShowInfo(); struct block_list* bl = map_id2bl(st->oid); ShowInfo(); memcpy(&dummy_sd.bl, bl, sizeof(struct block_list)); ShowInfo(); if (bl->type == BL_NPC) ShowInfo(); safestrncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH); ShowInfo(); } ShowInfo(); } // compatibility with previous implementation (deprecated!) if(cmd[0] != atcommand_symbol) { ShowInfo(); cmd += strlen(sd->status.name); ShowInfo(); while(*cmd != atcommand_symbol && *cmd != 0) ShowInfo(); cmd++; } ShowInfo(); is_atcommand(fd, sd, cmd, 2); ShowInfo(); return 0; } lol... like that? i dont know what im doing obviously. Edited March 16, 2012 by sizenine Quote Link to comment Share on other sites More sharing options...
Derceto Posted March 16, 2012 Group: Members Topic Count: 1 Topics Per Day: 0.00 Content Count: 43 Reputation: 2 Joined: 01/17/12 Last Seen: February 15, 2014 Share Posted March 16, 2012 (edited) showinfo() is an extension (remake) of printf(). syntax: showinfo(formatString, ...) Normally you would write ShowInfo("useatcmd: somevariable = %d n", somevariable); for integers. For floating point you use "%f" instead of "%d", for strings "%s". But if you're asking it this far, I suppose you won't know what to do after that anyway. Wait for someone less lazy than me come by. Edited March 16, 2012 by Derceto 1 Quote Link to comment Share on other sites More sharing options...
sizenine Posted March 16, 2012 Group: Members Topic Count: 37 Topics Per Day: 0.01 Content Count: 149 Reputation: 12 Joined: 02/17/12 Last Seen: January 25, 2018 Author Share Posted March 16, 2012 oh i see.. i know what printf() is but yeah i probably wouldn't know what the values mean and how to fix it even if i printed out the results.. Quote Link to comment Share on other sites More sharing options...
Legato Posted April 26, 2012 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 87 Reputation: 1 Joined: 11/20/11 Last Seen: September 10, 2013 Share Posted April 26, 2012 Hello.. I didn't want to open another thread because, my concern is also about the atcommand events mod. I get this error when I try to use #command. What I added is just this line if( .@atcmd_command$ == "#testshop") { end; } Here's what's written on npc.c line 782 nullpo_ret(sd); npc.c int do_atcmd_event (struct map_session_data* sd, const char* command, const char* message, const char* eventname) { struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname); struct npc_data *nd; struct script_state *st; int i = 0, j = 0, k = 0; char *temp; temp = (char*)aMalloc(strlen(message) + 1); nullpo_ret(sd); if( ev == NULL || (nd = ev->nd) == NULL ) { ShowError("npc_event: event not found [%s]\n", eventname); return 0; } Quote Link to comment Share on other sites More sharing options...
Lighta Posted April 27, 2012 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 737 Reputation: 216 Joined: 11/29/11 Last Seen: December 20, 2020 Share Posted April 27, 2012 Quite hard to understand the issues here, not so familiar with Toasty diff to get an idea. Anyway gdb would help on the matter, you may have some info here : http://rathena.org/wiki/GDB Or all you guys need to do is : gdb -ex run map-server_sql Than also run the 2 other part : ./login-server_sql ./char-server_sql With this will have a better view of what may wrong when crashing. (use "bt full" when this append to have a more consistent report) Quote Link to comment Share on other sites More sharing options...
Question
sizenine
I'm getting this error:
npc.c:784: undefined reference to `aMallocA'
from applying this diff by ToastOfDoom.. can anyone help me solve this?
http://www.eathena.w...howtopic=272578
Here is part of the src that shows line 784 in npc.c:
Edited by sizenineLink to comment
Share on other sites
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.