• 1
vilkhl

i got error when applying custom commands.

Question

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

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0
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 ( [email protected]_numparameters ) {
		if ( getmapusers([email protected]_parameters$) == -1 ) {
			dispbottom "Map not exist";
			end;
		}
		[email protected]$ = [email protected]_parameters$;
	}
	else
		[email protected]$ = strcharinfo(3);
	[email protected] = getmapunits( BL_MOB, [email protected]$, [email protected] );
	freeloop true;
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		if ( !getd("[email protected]"+ [email protected]$) ) {
			[email protected]$[[email protected]] = [email protected]$;
			getunitdata [email protected][[email protected]], [email protected];
			[email protected][[email protected]] = [email protected][UMOB_X];
			[email protected][[email protected]] = [email protected][UMOB_Y];
			[email protected][[email protected]] = [email protected][UMOB_HP];
			[email protected][[email protected]] = [email protected][UMOB_MAXHP];
			[email protected];
		}
		setd "[email protected]"+ [email protected]$, getd("[email protected]"+ [email protected]$) +1;
	}
	dispbottom " === These are monsters in "+ [email protected]$ +" ===";
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] )
		if ( getd("[email protected]"+ [email protected]$[[email protected]]) > 1 || [email protected][[email protected]] )
			dispbottom ( [email protected] )+". "+ [email protected]$[[email protected]] +" : "+ getd("[email protected]"+ [email protected]$[[email protected]])+"x";
	if ( getgmlevel() < 99 ) end; // admin only access, lucky you mention it so I make extra checks
	dispbottom " === Location of unique monsters === ";
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] )
		if ( getd("[email protected]"+ [email protected]$[[email protected]]) == 1 && [email protected][[email protected]] )
			dispbottom [email protected]$[[email protected]] +" --> X = "+ [email protected][[email protected]] +" Y = "+ [email protected][[email protected]] +" | Hp left = "+ [email protected][[email protected]] +"/"+ [email protected][[email protected]];
	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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0
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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0
-	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 ( [email protected]_numparameters ) {
		if ( getmapusers([email protected]_parameters$) == -1 ) {
			dispbottom "Map not exist";
			end;
		}
		[email protected]$ = [email protected]_parameters$;
	}
	else
		[email protected]$ = strcharinfo(3);
	[email protected] = getmapunits( BL_MOB, [email protected]$, [email protected] );
	freeloop true;
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		if ( !getd("[email protected]"+ [email protected]$) )
			[email protected]$[[email protected]++] = [email protected]$;
		setd "[email protected]"+ [email protected]$, getd("[email protected]"+ [email protected]$) +1;
	}
	dispbottom " === These are monsters in "+ [email protected]$ +" ===";
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] )
		dispbottom ( [email protected] +1 )+". "+ [email protected]$[[email protected]] +" : "+ getd("[email protected]"+ [email protected]$[[email protected]])+"x";
	end;
}

 

screen2019rAthena002.jpg

  • Upvote 1
  • Love 1
  • MVP 1

Share this post


Link to post
Share on other sites
  • 0
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

Share this post


Link to post
Share on other sites
  • 0
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 ( [email protected]_numparameters ) {
		if ( getmapusers([email protected]_parameters$) == -1 ) {
			dispbottom "Map not exist";
			end;
		}
		[email protected]$ = [email protected]_parameters$;
	}
	else
		[email protected]$ = strcharinfo(3);
	[email protected] = getmapunits( BL_MOB, [email protected]$, [email protected] );
	freeloop true;
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		if ( !getd("[email protected]"+ [email protected]$) )
			[email protected]$[[email protected]++] = [email protected]$;
		setd "[email protected]"+ [email protected]$, getd("[email protected]"+ [email protected]$) +1;
	}
	dispbottom " === These are monsters in "+ [email protected]$ +" ===";
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected] )
		dispbottom ( [email protected] +1 )+". "+ [email protected]$[[email protected]] +" : "+ getd("[email protected]"+ [email protected]$[[email protected]])+"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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now