Jump to content
  • 1

i got error when applying custom commands.


Frost Diver

Question


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  177
  • Reputation:   6
  • Joined:  10/22/18
  • Last Seen:  

Hi, as title mentioned above, im trying to apply custom commands which is @mapmoblist and @whosell.

but I got this error (refer picture). how to fix that?

or, if anyone got a whole atcommands.c file with @mapmoblist and @whosell working, mind to share the files with me? im much appreciated.

thanks in advance for your kindness.

 

Untitled.jpg

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

1 hour ago, vilkhl said:

1. is it possible for @mapmoblist only update the current mob on the map that is not including the one is died? eg : I use the command at prt_fild04. let's say I've killed a vocal in the map, then if I use the command again, vocal will not display on bottom chat until next respawn.

woot, just now @Radian also told me the same thing, now I have to double check
you are right, somehow the permanent monster spawn script does let the *getmapunits script command catch the dead monsters as still being alive
have to make Hp check this time

// pre-re/mobs/fields/prontera.txt
//==================================================
// prt_fild07 - Prontera Field 
//==================================================
prt_fild07,0,0	monster	Rocker	1052,80
prt_fild07,0,0	monster	Poporing	1031,30
prt_fild07,0,0	monster	Vocal	1088,1,1800000,1200000
prt_fild07,225,110,5,5	monster	Black Mushroom	1084,3,360000,180000

-	script	sdjflsdf	-1,{
OnInit:
	bindatcmd "mapmoblist", strnpcinfo(0)+"::Onaaa";
	end;
Onaaa:
	if ( .@atcmd_numparameters ) {
		if ( getmapusers(.@atcmd_parameters$) == -1 ) {
			dispbottom "Map not exist";
			end;
		}
		.@map$ = .@atcmd_parameters$;
	}
	else
		.@map$ = strcharinfo(3);
	.@size = getmapunits( BL_MOB, .@map$, .@bl );
	freeloop true;
	for ( .@i = 0; .@i < .@size; ++.@i ) {
		.@string$ = rid2name(.@bl[.@i]);
		if ( !getd(".@"+ .@string$) ) {
			.@mobname$[.@c] = .@string$;
			getunitdata .@bl[.@i], .@unitdata;
			.@mobx[.@c] = .@unitdata[UMOB_X];
			.@moby[.@c] = .@unitdata[UMOB_Y];
			.@mobhp[.@c] = .@unitdata[UMOB_HP];
			.@mobmaxhp[.@c] = .@unitdata[UMOB_MAXHP];
			++.@c;
		}
		setd ".@"+ .@string$, getd(".@"+ .@string$) +1;
	}
	dispbottom " === These are monsters in "+ .@map$ +" ===";
	for ( .@i = 0; .@i < .@c; ++.@i )
		if ( getd(".@"+ .@mobname$[.@i]) > 1 || .@mobhp[.@i] )
			dispbottom ( ++.@j )+". "+ .@mobname$[.@i] +" : "+ getd(".@"+ .@mobname$[.@i])+"x";
	if ( getgmlevel() < 99 ) end; // admin only access, lucky you mention it so I make extra checks
	dispbottom " === Location of unique monsters === ";
	for ( .@i = 0; .@i < .@c; ++.@i )
		if ( getd(".@"+ .@mobname$[.@i]) == 1 && .@mobhp[.@i] )
			dispbottom .@mobname$[.@i] +" --> X = "+ .@mobx[.@i] +" Y = "+ .@moby[.@i] +" | Hp left = "+ .@mobhp[.@i] +"/"+ .@mobmaxhp[.@i];
	end;
}

 

1 hour ago, vilkhl said:

2. how to make @whosell search for vending items only? not cash items.

then I have to take a look at the @whosell source code seriously =/
I was actually joking when I only use @whosell on the *searchstore script command

hmm ... cash items means item type 18 ... means only look for items not IT_CASH type
... and I probably not going to do it, I think searchstore features is complete ... isn't it ?

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

Show the code of the commands. I'm not sure if I may fix it, but I may help better if you did.

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  177
  • Reputation:   6
  • Joined:  10/22/18
  • Last Seen:  

8 hours ago, n0tttt said:

Show the code of the commands. I'm not sure if I may fix it, but I may help better if you did.

@whosell at this thread : 

@mapmoblist at this thread : 

and this is my original atcommand.c file

 

atcommand.cpp

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

Hmm. well i think you can just use the *searchstore.
You can use it to buy directly from it too or disable them to buy and click on it to show who sell it on the map
P.S Don't worry if you have extended vending implemented. it will still cost bronze coin when they buy from a bronze coin shop.

image.thumb.png.e496d815b63b08be4fe1d21a579f86f8.png

Edited by Haruka Mayumi
  • Love 1
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

mapmoblist

static int count_mob(struct block_list *bl, va_list ap) // [FE]
{
   struct mob_data *md = (struct mob_data*)bl;
   short id = va_arg(ap, short);
   if (md->class_ == id)
       return 1;
   return 0;
}

ACMD_FUNC(mapmoblist) // [FE]
{
   char temp[100];
   bool mob_searched[MAX_MOB_DB];
   bool mob_mvp[MAX_MOB_DB]; // Store mvp data..
   struct s_mapiterator* it;
   unsigned short count = 0, i, mapindex = 0;
   int m = 0;

   memset(mob_searched, 0, MAX_MOB_DB);
   memset(mob_mvp, 0, MAX_MOB_DB);

   if (message && *message) {
       // Player input map name, search mob list for that map
       mapindex = mapindex_name2id(message);
       if (!mapindex) {
           clif_displaymessage(fd, "Map not found");
           return -1;
       }
       m = map_mapindex2mapid(mapindex);
   } else {
       // Player doesn't input map name, search mob list in player current map
       mapindex = sd->mapindex;
       m = sd->bl.m;
   }

   clif_displaymessage(fd, "--------Monster List--------");

   sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex));
   clif_displaymessage(fd, temp);

   clif_displaymessage(fd, "Monsters: ");

   //Looping and search for mobs
   it = mapit_geteachmob();
   while (true) {
       TBL_MOB* md = (TBL_MOB*)mapit_next(it);
       if (md == NULL)
           break;

       if (md->bl.m != m || md->status.hp <= 0)
           continue;
       if (mob_searched[md->mob_id] == true)
           continue; // Already found, skip it
       if (mob_db(md->mob_id)->mexp) {
           mob_searched[md->mob_id] = true;
           mob_mvp[md->mob_id] = true; // Save id for later
           continue; // It's MVP!
       }

       mob_searched[md->mob_id] = true;
       count = map_foreachinmap(count_mob, m, BL_MOB, md->class_);

       sprintf(temp, " %s[%d] : %d", mob_db(md->mob_id)->jname, md->mob_id, count);

       clif_displaymessage(fd, temp);
   }
   mapit_free(it);

   clif_displaymessage(fd, "MVP: ");

   // Looping again and search for mvp, not sure if this is the best way..
   for (i = 1000; i < MAX_MOB_DB; i++) { //First monster start at 1001 (Scorpion)
       if (mob_mvp[i] == true) {
           count = map_foreachinmap(count_mob, m, BL_MOB, i);
           sprintf(temp, " %s[%d] : %d", mob_db(i)->jname, i, count);
           clif_displaymessage(fd, temp);
       }
   }

   return 0;
}

Hope it works.

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

-	script	sdjflsdf	-1,{
OnInit:
	bindatcmd "whosell", strnpcinfo(0)+"::Onbbb";
	bindatcmd "mapmoblist", strnpcinfo(0)+"::Onaaa";
	end;
Onbbb:
	searchstores 999, 1; // yeah I'm so cheap XD
	end;
Onaaa:
	if ( .@atcmd_numparameters ) {
		if ( getmapusers(.@atcmd_parameters$) == -1 ) {
			dispbottom "Map not exist";
			end;
		}
		.@map$ = .@atcmd_parameters$;
	}
	else
		.@map$ = strcharinfo(3);
	.@size = getmapunits( BL_MOB, .@map$, .@bl );
	freeloop true;
	for ( .@i = 0; .@i < .@size; ++.@i ) {
		.@string$ = rid2name(.@bl[.@i]);
		if ( !getd(".@"+ .@string$) )
			.@mobname$[.@c++] = .@string$;
		setd ".@"+ .@string$, getd(".@"+ .@string$) +1;
	}
	dispbottom " === These are monsters in "+ .@map$ +" ===";
	for ( .@i = 0; .@i < .@c; ++.@i )
		dispbottom ( .@i +1 )+". "+ .@mobname$[.@i] +" : "+ getd(".@"+ .@mobname$[.@i])+"x";
	end;
}

 

screen2019rAthena002.jpg

  • Upvote 1
  • Love 1
  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  177
  • Reputation:   6
  • Joined:  10/22/18
  • Last Seen:  

7 hours ago, n0tttt said:

mapmoblist


static int count_mob(struct block_list *bl, va_list ap) // [FE]
{
   struct mob_data *md = (struct mob_data*)bl;
   short id = va_arg(ap, short);
   if (md->class_ == id)
       return 1;
   return 0;
}

ACMD_FUNC(mapmoblist) // [FE]
{
   char temp[100];
   bool mob_searched[MAX_MOB_DB];
   bool mob_mvp[MAX_MOB_DB]; // Store mvp data..
   struct s_mapiterator* it;
   unsigned short count = 0, i, mapindex = 0;
   int m = 0;

   memset(mob_searched, 0, MAX_MOB_DB);
   memset(mob_mvp, 0, MAX_MOB_DB);

   if (message && *message) {
       // Player input map name, search mob list for that map
       mapindex = mapindex_name2id(message);
       if (!mapindex) {
           clif_displaymessage(fd, "Map not found");
           return -1;
       }
       m = map_mapindex2mapid(mapindex);
   } else {
       // Player doesn't input map name, search mob list in player current map
       mapindex = sd->mapindex;
       m = sd->bl.m;
   }

   clif_displaymessage(fd, "--------Monster List--------");

   sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex));
   clif_displaymessage(fd, temp);

   clif_displaymessage(fd, "Monsters: ");

   //Looping and search for mobs
   it = mapit_geteachmob();
   while (true) {
       TBL_MOB* md = (TBL_MOB*)mapit_next(it);
       if (md == NULL)
           break;

       if (md->bl.m != m || md->status.hp <= 0)
           continue;
       if (mob_searched[md->mob_id] == true)
           continue; // Already found, skip it
       if (mob_db(md->mob_id)->mexp) {
           mob_searched[md->mob_id] = true;
           mob_mvp[md->mob_id] = true; // Save id for later
           continue; // It's MVP!
       }

       mob_searched[md->mob_id] = true;
       count = map_foreachinmap(count_mob, m, BL_MOB, md->class_);

       sprintf(temp, " %s[%d] : %d", mob_db(md->mob_id)->jname, md->mob_id, count);

       clif_displaymessage(fd, temp);
   }
   mapit_free(it);

   clif_displaymessage(fd, "MVP: ");

   // Looping again and search for mvp, not sure if this is the best way..
   for (i = 1000; i < MAX_MOB_DB; i++) { //First monster start at 1001 (Scorpion)
       if (mob_mvp[i] == true) {
           count = map_foreachinmap(count_mob, m, BL_MOB, i);
           sprintf(temp, " %s[%d] : %d", mob_db(i)->jname, i, count);
           clif_displaymessage(fd, temp);
       }
   }

   return 0;
}

Hope it works.

thanks buddy! I'll try this out. if there's any issue,i'll update here later

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.02
  • Content Count:  177
  • Reputation:   6
  • Joined:  10/22/18
  • Last Seen:  

6 hours ago, AnnieRuru said:

-	script	sdjflsdf	-1,{
OnInit:
	bindatcmd "whosell", strnpcinfo(0)+"::Onbbb";
	bindatcmd "mapmoblist", strnpcinfo(0)+"::Onaaa";
	end;
Onbbb:
	searchstores 999, 1; // yeah I'm so cheap XD
	end;
Onaaa:
	if ( .@atcmd_numparameters ) {
		if ( getmapusers(.@atcmd_parameters$) == -1 ) {
			dispbottom "Map not exist";
			end;
		}
		.@map$ = .@atcmd_parameters$;
	}
	else
		.@map$ = strcharinfo(3);
	.@size = getmapunits( BL_MOB, .@map$, .@bl );
	freeloop true;
	for ( .@i = 0; .@i < .@size; ++.@i ) {
		.@string$ = rid2name(.@bl[.@i]);
		if ( !getd(".@"+ .@string$) )
			.@mobname$[.@c++] = .@string$;
		setd ".@"+ .@string$, getd(".@"+ .@string$) +1;
	}
	dispbottom " === These are monsters in "+ .@map$ +" ===";
	for ( .@i = 0; .@i < .@c; ++.@i )
		dispbottom ( .@i +1 )+". "+ .@mobname$[.@i] +" : "+ getd(".@"+ .@mobname$[.@i])+"x";
	end;
}

 

screen2019rAthena002.jpg

thanks a lot  Annie. the scripts worked. but got 2 questions :

1. is it possible for @mapmoblist only update the current mob on the map that is not including the one is died? eg : I use the command at prt_fild04. let's say I've killed a vocal in the map, then if I use the command again, vocal will not display on bottom chat until next respawn.

2. how to make @whosell search for vending items only? not cash items.

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  318
  • Topics Per Day:  0.07
  • Content Count:  925
  • Reputation:   32
  • Joined:  12/05/11
  • Last Seen:  

got update for @mapmoblist?

im trying now got error


 

Quote

atcommand.cpp:9417:11: error: 'mob_searched' was not declared in this scope
    memset(mob_searched, 0, MAX_MOB_DB);
           ^~~~~~~~~~~~
atcommand.cpp:9417:11: note: suggested alternative: 'hom_search'
    memset(mob_searched, 0, MAX_MOB_DB);
           ^~~~~~~~~~~~
           hom_search
atcommand.cpp:9418:11: error: 'mob_mvp' was not declared in this scope
    memset(mob_mvp, 0, MAX_MOB_DB);
           ^~~~~~~
atcommand.cpp:9418:11: note: suggested alternative: 'mob_db'
    memset(mob_mvp, 0, MAX_MOB_DB);
           ^~~~~~~
           mob_db
atcommand.cpp:9459:59: error: 'TBL_MOB {aka struct mob_data}' has no member name d 'class_'
        count = map_foreachinmap(count_mob, m, BL_MOB, md->class_);

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...