Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: -Bendarr- on June 20, 2009, 06:01:07 pm

Title: The possible repercussions of OnPlayerSpeak
Post by: -Bendarr- on June 20, 2009, 06:01:07 pm
I've recently been adding some scripts to my server, and have COMPLETELY avoided using any "OnPlayerSpeak" scripts. All of the commands I've made (and DorkeyDear has made, his are better than mine) have been OnCommand and OnPlayerCommand, because the thought of a constant monitor for every time a person says something (people spam a LOT) has made me question the effect that that would have on my clan server, where eats/lag/etc are a big problem, and must be avoided (in R/S CTF eats are a huge problem).

I use an EnEsCe server which is so far the best server I've ever had to keep eats at bay, and I want to keep it this way. When I play in gathers, NA servers and Euro servers, I've noticed HUGE eat problems and bad lag due to the scripts required for a gather to run.

What do you guys think. I'm only assuming things, to be cautious, but a few !commands would be nice to have.
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: Hacktank on June 20, 2009, 06:13:49 pm
You are being to cautious, if you have if text=blah in your onplayerspeak and it does not equal blah then nothing is done so it uses no cpu whatsoever.
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: -Bendarr- on June 20, 2009, 06:18:34 pm
But it must monitor the chat to check IF the text = !command

So as long as you have something in OnPlayerSpeak, it IS being monitored...
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: Hacktank on June 20, 2009, 06:37:00 pm
It is always being monitored anyway by the core game, the script just adds to what it looks for.
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: chrisgbk on June 20, 2009, 07:15:35 pm
You are being to cautious, if you have if text=blah in your onplayerspeak and it does not equal blah then nothing is done so it uses no cpu whatsoever.

It doesn't use no CPU; the act of checking for the match consumes CPU time.

But it should be a minimal effect, there should be no adverse reactions to adding checks for commands.
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: croat1gamer on June 21, 2009, 12:18:19 am
The lag is caused due to the obvious thing that you play in NA and Euro gathers, where one of them isnt your local gather, so the lag is caused by you. Imo at least.
And dont use wireless.
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: EnEsCe on June 21, 2009, 01:04:35 am
All OnPlayerSpeak calls are forced to run in a thread, so no matter what you do in OnPlayerSpeak, it will not cause server lag... Even if you put in a sleep().
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: Gizd on June 21, 2009, 09:05:50 am
All OnPlayerSpeak calls are forced to run in a thread, so no matter what you do in OnPlayerSpeak, it will not cause server lag... Even if you put in a sleep().
Why don't you thread all functions/procedures so people will be able to use  sleep()?
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: ~Niko~ on June 21, 2009, 10:17:38 am
I simply don't understand why scripts use !blah texts to make things. Just use OnPlayerCommand, and per example, if  a player in a gather does !nuubia to change the map, the console should show a message like "this lamer has voted nuubia". Would be that some kind of solution?
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: EnEsCe on June 21, 2009, 10:19:29 am
All OnPlayerSpeak calls are forced to run in a thread, so no matter what you do in OnPlayerSpeak, it will not cause server lag... Even if you put in a sleep().
Why don't you thread all functions/procedures so people will be able to use  sleep()?
Because threads can't have return values.......
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: Gizd on June 21, 2009, 10:24:33 am
I simply don't understand why scripts use !blah texts to make things. Just use OnPlayerCommand, and per example, if  a player in a gather does !nuubia to change the map, the console should show a message like "this lamer has voted nuubia". Would be that some kind of solution?
Newbies don't know how to use commands...


Is AppOnIdle threaded? It has no return value.
Title: Re: The possible repercussions of OnPlayerSpeak
Post by: ~Niko~ on June 21, 2009, 10:35:11 am
Newbies shouldn't play in private servers. They play in pubs where there's no need to type slashes, only to die.