Jump to content
  • 0

Announce with a sound


Dori

Question


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

I have this auto announce script and I want to add a sound effect when it announces, but the sound effect is not working.

This is the script:

-	script	News	-1,{
OnInit:
	set .Time,30;  // Announce every x Seconds.
	setarray .News$[0], // Random Message to be Announced
		"Message 1",
		"Message 2",
		"Message 3";
	while(1)
	{
		soundeffectall "beep.wav",0;
		announce .News$[ rand( getarraysize( .News$ ) ) ],bc_all,0xffb9f3;
		sleep ( .Time * 1000 );
		}
		end;
	}
Link to comment
Share on other sites

23 answers to this question

Recommended Posts

  • -1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

	OnBroadcast:
		announce strcharinfo(0)+": "+ .@broadcast_message$,bc_all;
		addrid(0);
		soundeffectall .sfx$,0;
		end;

you can try this.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Guess you have to add the map name to your soundeffect.

For example:

soundeffectall "beep.wav",0,"prontera";
Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

Guess you have to add the map name to your soundeffect.

For example:

soundeffectall "beep.wav",0,"prontera";

But that would be a pain in the ass...

I want the sound to play in all maps..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

then try this:

query_sql ("SELECT DISTINCT `last_map` FROM `ragnarok`.`char` WHERE `online` = '1'",.@maps$);
for (.@i = 0 ; .@i < getarraysize(.@maps$) ; .@i++) soundeffectall "beep.wav",0,.@maps$[.@i];

it will play your soundeffect in all maps where there is at least one player.

 

Didn't test it tough

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

then try this:

query_sql ("SELECT DISTINCT `last_map` FROM `ragnarok`.`char` WHERE `online` = '1'",.@maps$);
for (.@i = 0 ; .@i < getarraysize(.@maps$) ; .@i++) soundeffectall "beep.wav",0,.@maps$[.@i];
it will play your soundeffect in all maps where there is at least one player.

 

Didn't test it tough

Where exactly do I put that in the script?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

replace your soundeffectall by these two lines

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

Oh ok so I did do it right..but it didn't work. it gave me debugs.

Could you tell me how to get this work with @kami?

announce .News$[ rand( getarraysize( .News$ ) ) ],bc_all,0xffb9f3;
Edited by Phenex
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

the script works fine for me but I doon't have the beep.wav file ^^

atcommand "@kamic ffb9f3 "+.News$[ rand( getarraysize( .News$ ) ) ];

A player must be attached to the script.

Edited by Kurofly
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  332
  • Reputation:   15
  • Joined:  12/11/11
  • Last Seen:  

Thank you so much for your help :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

then try this:

query_sql ("SELECT DISTINCT `last_map` FROM `ragnarok`.`char` WHERE `online` = '1'",.@maps$);
for (.@i = 0 ; .@i < getarraysize(.@maps$) ; .@i++) soundeffectall "beep.wav",0,.@maps$[.@i];

it will play your soundeffect in all maps where there is at least one player.

 

Didn't test it tough

 

 

query_sql ("SELECT DISTINCT `last_map` FROM `ragnarok`.`char` WHERE `online` = '1'",.@maps$);

i got confuse on this part why i got,

 DB:Error how to fix this?

 

Thanks in Advance.

-	script	News	-1,{
OnInit:
	set .Time,30;  // Announce every x Seconds.
	setarray .News$[0], // Random Message to be Announced
		"Message 1",
		"Message 2",
		"Message 3";
	while(1)
	{
		query_sql ("SELECT DISTINCT `last_map` FROM `ragnarok`.`char` WHERE `online` = '1'",.@maps$);
		for (.@i = 0 ; .@i < getarraysize(.@maps$) ; .@i++) soundeffectall "voice_man5.wav",0,.@maps$[.@i];
		announce .News$[ rand( getarraysize( .News$ ) ) ],bc_all,0xffb9f3;
		sleep ( .Time * 1000 );
		}
		end;
	}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

could you please show me the error?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

could you please show me the error?

 

okay, here's the screenshot. i don't understand why i got many errors, every annoucement.

http://imgur.com/pdpQJlC

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

well someone here had the same problem.

He solved it with these:

Check the char_athena and map_athena.conf the IP is probably wrong. Remember to uncomment or remove //.

and

You will be putting the Router IP. To see what it is, right click on the Internet Connection at the lower right of your taskbar, then Status. You will see your Ip there.

 

Can't help you more than that ^^ Good luck.

 

have a look at this one too: Go to your inter_athena.conf. You must put the correct IP,userid,passwd and db name for Char,Map,Login and log.

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

well someone here had the same problem.

He solved it with these:

Check the char_athena and map_athena.conf the IP is probably wrong. Remember to uncomment or remove //.

and

You will be putting the Router IP. To see what it is, right click on the Internet Connection at the lower right of your taskbar, then Status. You will see your Ip there.

 

Can't help you more than that ^^ Good luck.

 

have a look at this one too: Go to your inter_athena.conf. You must put the correct IP,userid,passwd and db name for Char,Map,Login and log.

 

No there's no problem with my test server, the only main problem is the script. SQL part. if you don't mind kindly check it and also with the map-serv.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

I tried it already and I don't have any problem.

Have you ever used the 'query_sql' command before? If yes did you also have errors?

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

I tried it already and I don't have any problem.

Have you ever used the 'query_sql' command before? If yes did you also have errors?

 

Can i ask for your script here? after i test i'll check everything.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

i copied and pasted the one you put in this topic so we have exactly the same script.

Plus your errors say 'acces denied' so the problem is not related to the command itself but more to your configuration.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

i copied and pasted the one you put in this topic so we have exactly the same script.

Plus your errors say 'acces denied' so the problem is not related to the command itself but more to your configuration.

 

I guess, i finally found out the error.

query_sql ("SELECT DISTINCT `last_map` FROM `ragnarok`.`char` WHERE `online` = '1'",.@maps$);

to:

query_sql ("SELECT `last_map` FROM `char` WHERE `online` = '1'",.@maps$);

Anyways, thank you for the respond.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

If you remove the disctinct please consider using this:

query_sql ("SELECT `last_map` FROM `char` WHERE `online` = '1'",.@maps$);
for (.@i = 0 ; .@i < getarraysize(.@maps) ; .@i++)
	for (.@j = .@i+1 ; .@j < getarraysize(.@maps$) ; .@j++)
		if (.@maps$[.@i] == .@maps$[.@j]) deletearray .@maps$[.@j],1;

It will delete duplicates.

 

If you keep it like this, the soundeffect will play as many times as there are players on a map.

For example if 10 players are in cap the soundeffect will play 10 times.

Edited by Kurofly
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.01
  • Content Count:  164
  • Reputation:   16
  • Joined:  03/15/12
  • Last Seen:  

If you remove the disctinct please consider using this:

query_sql ("SELECT `last_map` FROM `char` WHERE `online` = '1'",.@maps$);
for (.@i = 0 ; .@i < getarraysize(.@maps) ; .@i++)
	for (.@j = .@i+1 ; .@j < getarraysize(.@maps$) ; .@j++)
		if (.@maps$[.@i] == .@maps$[.@j]) deletearray .@maps$[.@j],1;

It will delete duplicates.

 

If you keep it like this, the soundeffect will play as many times as there are players on a map.

For example if 10 players are in cap the soundeffect will play 10 times.

 

Oh i see, i didn't know that, THANK you again @KuroFly :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  142
  • Reputation:   8
  • Joined:  02/11/13
  • Last Seen:  

I've made this for my server. It's not exactly what you want, but it works... Maybe it helps? xD

-	script	SoundBroadcast	-1,{
	end;

OnInit:
	set .sfx$,"se_cock_02.wav";
	bindatcmd "evbroadcast",strnpcinfo(0)+"::OnBroadcast",50,20;
	end;

OnBroadcast:
	if(.@atcmd_parameters$[0] == "")
		dispbottom "@evbroadcast: Usage: @evbroadcast [message]";
	else{
		soundeffectall .sfx$,0;
		announce strcharinfo(0)+": "+ .@atcmd_parameters$[0],bc_all;
	}
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

:huh: Does it work in all maps?

I thought soundeffectall  could only work on one map ><

 

 That's way simplier then, thank you for sharing  /no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Didn't think about it that's also way simplier.

Thanks emistry I never noticed there was an "all players" type in addrid, I'll probably make use of it.

Edited by Kurofly
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...