Page 1 of 10

Script callbacks

Posted: 12 Apr 2013, 17:15
by Eole
The list of XmlRpc callbacks and methods available in the Nadeo scripts is now on GitHub :
https://doc.maniaplanet.com/dedicated-s ... pc-scripts

Re: Script callbacks

Posted: 12 Apr 2013, 19:46
by kremsy
Thanks!

Re: Script callbacks

Posted: 12 Apr 2013, 22:21
by Jojo_44
Yeah thanks :thumbsup:

I would like to see the common script callbacks as own callbacks from the dedicated server. Not going over the "Mainaplanet.ModeScriptCallbackArray" callback. Shouldn´t it be possible to use the normal "ManiaPlanet.BeginMatch/BeginMap" callbacks for this ?

best regards, Jojo

Re: Script callbacks

Posted: 12 Apr 2013, 22:32
by steeffeen
i guess that's not the case because shootmania is so customizable that it's different in every mode

Re: Script callbacks

Posted: 13 Apr 2013, 11:36
by Jojo_44
steeffeen wrote:i guess that's not the case because shootmania is so customizable that it's different in every mode
The common script callbacks are in every mode (except elite to keep backwards compatibility), so in fact they are some kind of a standard. The current way is just a bit bad to handle for servercontrollers because every SM Plugin in fact needs to register for the "Mainaplanet.ModeScriptCallbackArray" callback from the server and then check with many if´s/switch statements what callback was called. In terms of performance just bad.

regards, Jojo

Re: Script callbacks

Posted: 13 Apr 2013, 12:58
by kremsy
Jojo_44 wrote:
steeffeen wrote:i guess that's not the case because shootmania is so customizable that it's different in every mode
The common script callbacks are in every mode (except elite to keep backwards compatibility), so in fact they are some kind of a standard. The current way is just a bit bad to handle for servercontrollers because every SM Plugin in fact needs to register for the "Mainaplanet.ModeScriptCallbackArray" callback from the server and then check with many if´s/switch statements what callback was called. In terms of performance just bad.

regards, Jojo
You think one switch statement makes a bad performance?

Re: Script callbacks

Posted: 13 Apr 2013, 15:08
by Jojo_44
kremsy wrote:
Jojo_44 wrote:
steeffeen wrote:i guess that's not the case because shootmania is so customizable that it's different in every mode
The common script callbacks are in every mode (except elite to keep backwards compatibility), so in fact they are some kind of a standard. The current way is just a bit bad to handle for servercontrollers because every SM Plugin in fact needs to register for the "Mainaplanet.ModeScriptCallbackArray" callback from the server and then check with many if´s/switch statements what callback was called. In terms of performance just bad.

regards, Jojo
You think one switch statement makes a bad performance?
No ofc not. Look:

Let´s say you want a function to be called when the Map ends. So in Xaseco2 (tm2) f.e. you register this function to be called when the callback "ManiaPlanet.EndMap" is called from the server. If you want the same for shootmania (f.e. in mpaseco) you register for the callback "Mainaplanet.ModeScriptCallbackArray" and check if the param1 is "MapEnd". But here it comes: "Mainaplanet.ModeScriptCallbackArray" is called also for every other single callback from SM Scripts which Eole posted. So your function is also triggered for "onShoot" f.e. too even if you just want "EndMap". So your function is in my view unnecessarily often called. You can now come and say: well a function call + a if statement are not that hard in terms of performance but remember how often the onShoot callback is called f.e. (+ all others) and you may have 10 functions or more registered for "Mainaplanet.ModeScriptCallbackArray". So you have hundreds of functions calls for nothing.

regards, Jojo

Re: Script callbacks

Posted: 17 Apr 2013, 21:05
by kremsy
Can you make the BeginMap callback earlier, just when people see the game, not when the Match is starting.

Re: Script callbacks

Posted: 18 Apr 2013, 09:19
by Eole
The callback is sent once all players have loaded the map. I can call it earlier but then, it's not certain that all players will have complete the transition from the previous map.

There will be a new callback for Royal in the next update, giving the login of the round winner. It's sent just before the LibXmlRpc_EndRound callback:

Code: Select all

Name: "Royal_RoundWinner"
Data: An array with the login of the player who won the round
example: ["Login"]
Note: This callback is sent just before the end of the round, when the round winner is determined

Re: Script callbacks

Posted: 18 Apr 2013, 15:15
by kremsy
Eole wrote:The callback is sent once all players have loaded the map. I can call it earlier but then, it's not certain that all players will have complete the transition from the previous map.

There will be a new callback for Royal in the next update, giving the login of the round winner. It's sent just before the LibXmlRpc_EndRound callback:

Code: Select all

Name: "Royal_RoundWinner"
Data: An array with the login of the player who won the round
example: ["Login"]
Note: This callback is sent just before the end of the round, when the round winner is determined
I think it doesn't matter if the players have completed their transition or not. I think the callback should come when about 30-50% of Players have loaded the new map.