Jump to content
  • 0

Announce with a sound


Question

Posted

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;
	}

23 answers to this question

Recommended Posts

Posted

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

Posted

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

Posted

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?

Posted (edited)

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
Posted (edited)

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
Posted

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;
	}
Posted (edited)

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
Posted

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.

Posted (edited)

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
Posted

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.

Posted

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.

Posted

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.

Posted (edited)

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
Posted

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

Posted

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;
}
Posted (edited)

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...