Dori Posted May 28, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Share Posted May 28, 2015 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; } Quote Link to comment Share on other sites More sharing options...
-1 Emistry Posted June 6, 2015 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted June 6, 2015 OnBroadcast: announce strcharinfo(0)+": "+ .@broadcast_message$,bc_all; addrid(0); soundeffectall .sfx$,0; end; you can try this. Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 (edited) Guess you have to add the map name to your soundeffect. For example: soundeffectall "beep.wav",0,"prontera"; Edited May 28, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
Dori Posted May 28, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Author Share Posted May 28, 2015 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.. Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 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 Quote Link to comment Share on other sites More sharing options...
Dori Posted May 28, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Author Share Posted May 28, 2015 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? Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 replace your soundeffectall by these two lines Quote Link to comment Share on other sites More sharing options...
Dori Posted May 28, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Author Share Posted May 28, 2015 (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 May 28, 2015 by Phenex Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 (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 May 28, 2015 by Kurofly 1 Quote Link to comment Share on other sites More sharing options...
Dori Posted May 28, 2015 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 332 Reputation: 15 Joined: 12/11/11 Last Seen: August 8, 2017 Author Share Posted May 28, 2015 Thank you so much for your help Quote Link to comment Share on other sites More sharing options...
Elysium Posted May 28, 2015 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 164 Reputation: 17 Joined: 03/15/12 Last Seen: October 24, 2020 Share Posted May 28, 2015 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; } Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 could you please show me the error? Quote Link to comment Share on other sites More sharing options...
Elysium Posted May 28, 2015 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 164 Reputation: 17 Joined: 03/15/12 Last Seen: October 24, 2020 Share Posted May 28, 2015 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 Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 (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 May 28, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
Elysium Posted May 28, 2015 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 164 Reputation: 17 Joined: 03/15/12 Last Seen: October 24, 2020 Share Posted May 28, 2015 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. Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 (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 May 28, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
Elysium Posted May 28, 2015 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 164 Reputation: 17 Joined: 03/15/12 Last Seen: October 24, 2020 Share Posted May 28, 2015 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. Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 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. Quote Link to comment Share on other sites More sharing options...
Elysium Posted May 28, 2015 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 164 Reputation: 17 Joined: 03/15/12 Last Seen: October 24, 2020 Share Posted May 28, 2015 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. Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 28, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 28, 2015 (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 May 28, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
Elysium Posted May 28, 2015 Group: Members Topic Count: 41 Topics Per Day: 0.01 Content Count: 164 Reputation: 17 Joined: 03/15/12 Last Seen: October 24, 2020 Share Posted May 28, 2015 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 Quote Link to comment Share on other sites More sharing options...
15peaces Posted May 31, 2015 Group: Members Topic Count: 2 Topics Per Day: 0.00 Content Count: 143 Reputation: 8 Joined: 02/11/13 Last Seen: 17 hours ago Share Posted May 31, 2015 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; } Quote Link to comment Share on other sites More sharing options...
Kurofly Posted May 31, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted May 31, 2015 Does it work in all maps? I thought soundeffectall could only work on one map >< That's way simplier then, thank you for sharing Quote Link to comment Share on other sites More sharing options...
Kurofly Posted June 6, 2015 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 283 Reputation: 31 Joined: 07/08/14 Last Seen: January 15, 2022 Share Posted June 6, 2015 (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 June 6, 2015 by Kurofly Quote Link to comment Share on other sites More sharing options...
Question
Dori
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:
Link to comment
Share on other sites
23 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.