Jump to content
  • 0

No PlayBGM command


GreenMagic793

Question


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  157
  • Reputation:   18
  • Joined:  08/18/15
  • Last Seen:  

Hey guys,

 

I'm using an outdated client that doesn't have the PlayBGM or PlayBGMall commands. I really, really need these commands for my server, so what do I need to edit in source to add these? Any help is greatly appreciated! Thank you.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  265
  • Reputation:   95
  • Joined:  09/30/14
  • Last Seen:  

Uh, you should be able to copy the snippets directly from an up to date script.c

I'll add the code blocks to this post shortly. Though I don't see how this is client related, I imagine you meant outdated source files.

 

https://github.com/rathena/rathena/blob/master/src/map/script.c

/*==========================================
 * Play a BGM on a single client [Rikter/Yommy]
 *------------------------------------------*/
BUILDIN_FUNC(playBGM)
{
	struct map_session_data* sd;

	if( ( sd = script_rid2sd(st) ) != NULL ) {
		clif_playBGM(sd, script_getstr(st,2));
	}
	return SCRIPT_CMD_SUCCESS;
}

static int playBGM_sub(struct block_list* bl,va_list ap)
{
	const char* name = va_arg(ap,const char*);
	clif_playBGM(BL_CAST(BL_PC, bl), name);
	return 0;
}

static int playBGM_foreachpc_sub(struct map_session_data* sd, va_list args)
{
	const char* name = va_arg(args, const char*);
	clif_playBGM(sd, name);
	return 0;
}

/*==========================================
 * Play a BGM on multiple client [Rikter/Yommy]
 *------------------------------------------*/
BUILDIN_FUNC(playBGMall)
{
	const char* name;
	name = script_getstr(st,2);

	if( script_hasdata(st,7) ) {// specified part of map
		const char* mapname = script_getstr(st,3);
		int x0 = script_getnum(st,4);
		int y0 = script_getnum(st,5);
		int x1 = script_getnum(st,6);
		int y1 = script_getnum(st,7);

		map_foreachinarea(playBGM_sub, map_mapname2mapid(mapname), x0, y0, x1, y1, BL_PC, name);
	}
	else if( script_hasdata(st,3) ) {// entire map
		const char* mapname = script_getstr(st,3);

		map_foreachinmap(playBGM_sub, map_mapname2mapid(mapname), BL_PC, name);
	}
	else {// entire server
		map_foreachpc(&playBGM_foreachpc_sub, name);
	}
	return SCRIPT_CMD_SUCCESS;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

Don't forget the def's

BUILDIN_DEF(playBGM,"s"),
BUILDIN_DEF(playBGMall,"s?????"),
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  265
  • Reputation:   95
  • Joined:  09/30/14
  • Last Seen:  

I always forget the defs.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  157
  • Reputation:   18
  • Joined:  08/18/15
  • Last Seen:  

Thanks for your replies guys.

 

I'm having a little trouble though. I opened up script.c and added the blocks of code you uploaded Moriarty, and then I added the defs that Nova mentioned. I reloaded everything but the command still doesn't appear to be recognized by the server. Is it as simple as cutting and pasting what you guys posted in my script.c or am I missing something? Is there something more I need to do to get the server to recognize my changes to the source?

 

Thanks again.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

It needs to be in the right location, there is the place for the defs. The funcs can be almost anywhere.

By reloading everything, what do you mean? You need to recompile your build.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  157
  • Reputation:   18
  • Joined:  08/18/15
  • Last Seen:  

When you say a place for the defs, do you mean a very particular location or can I just paste them right where all the other defs are in any spot?

 

Also, here's the thing. I'm actually using eAthena TXT server software from 2008 for various reasons of my own, but since I'm using a very simple TXT server that doesn't even use SQL, do I still need to recompile the server? I've heard a lot about this but until now I've never needed to do it, so I'm confused on what recompiling actually is and how to do it.

 

Thanks for your continued help.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   13
  • Joined:  06/20/12
  • Last Seen:  

Anywhere within all the other defs.

And being TXT or SQL doesn't matter, every time you change something on your source code, you need to recompile again.

 

Recompile is the action of creating the executables ( login-server.exe, map-server.exe, char-server.exe ), if you don't recompile, you will run the exe with the outdated code.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  157
  • Reputation:   18
  • Joined:  08/18/15
  • Last Seen:  

Okay great, that answered all my questions. So I guess I just need to recompile and then my code should work? At least, in theory (fingers crossed).

 

Thanks for the help.

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...