Script callbacks

Moderator: NADEO

User avatar
Eole
Nadeo
Nadeo
Posts: 1216
Joined: 26 Apr 2011, 21:08

Script callbacks

Post by Eole » 12 Apr 2013, 17:15

The list of XmlRpc callbacks and methods available in the Nadeo scripts is now on GitHub :
https://doc.maniaplanet.com/dedicated-s ... pc-scripts
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!

kremsy
Posts: 1720
Joined: 21 Jul 2011, 09:51

Re: Script callbacks

Post by kremsy » 12 Apr 2013, 19:46

Thanks!
Lukas alias Kremsy, Developer of:
ManiaControl: http://www.maniacontrol.com
ParagonLeague: http://league.paragon-esports.com
MPAseco: http://mpaseco.org
ManiaViewer: http://www.maniaviewer.com

User avatar
Jojo_44
Posts: 500
Joined: 12 Jul 2010, 15:58
Location: Germany->Bavaria
Contact:

Re: Script callbacks

Post by Jojo_44 » 12 Apr 2013, 22:21

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
Image
my english sounds very unfriendly but it isn´t ;)

User avatar
steeffeen
Translator
Translator
Posts: 2472
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: Script callbacks

Post by steeffeen » 12 Apr 2013, 22:32

i guess that's not the case because shootmania is so customizable that it's different in every mode
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks

    User avatar
    Jojo_44
    Posts: 500
    Joined: 12 Jul 2010, 15:58
    Location: Germany->Bavaria
    Contact:

    Re: Script callbacks

    Post by Jojo_44 » 13 Apr 2013, 11:36

    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
    Image
    my english sounds very unfriendly but it isn´t ;)

    kremsy
    Posts: 1720
    Joined: 21 Jul 2011, 09:51

    Re: Script callbacks

    Post by kremsy » 13 Apr 2013, 12:58

    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?
    Lukas alias Kremsy, Developer of:
    ManiaControl: http://www.maniacontrol.com
    ParagonLeague: http://league.paragon-esports.com
    MPAseco: http://mpaseco.org
    ManiaViewer: http://www.maniaviewer.com

    User avatar
    Jojo_44
    Posts: 500
    Joined: 12 Jul 2010, 15:58
    Location: Germany->Bavaria
    Contact:

    Re: Script callbacks

    Post by Jojo_44 » 13 Apr 2013, 15:08

    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
    Image
    my english sounds very unfriendly but it isn´t ;)

    kremsy
    Posts: 1720
    Joined: 21 Jul 2011, 09:51

    Re: Script callbacks

    Post by kremsy » 17 Apr 2013, 21:05

    Can you make the BeginMap callback earlier, just when people see the game, not when the Match is starting.
    Lukas alias Kremsy, Developer of:
    ManiaControl: http://www.maniacontrol.com
    ParagonLeague: http://league.paragon-esports.com
    MPAseco: http://mpaseco.org
    ManiaViewer: http://www.maniaviewer.com

    User avatar
    Eole
    Nadeo
    Nadeo
    Posts: 1216
    Joined: 26 Apr 2011, 21:08

    Re: Script callbacks

    Post by Eole » 18 Apr 2013, 09:19

    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
    
    Contribute to the ManiaPlanet documentation on GitHub
    A question about ManiaScript? Ask it here!

    kremsy
    Posts: 1720
    Joined: 21 Jul 2011, 09:51

    Re: Script callbacks

    Post by kremsy » 18 Apr 2013, 15:15

    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.
    Lukas alias Kremsy, Developer of:
    ManiaControl: http://www.maniacontrol.com
    ParagonLeague: http://league.paragon-esports.com
    MPAseco: http://mpaseco.org
    ManiaViewer: http://www.maniaviewer.com

    Post Reply

    Return to “Dedicated Server”

    Who is online

    Users browsing this forum: No registered users and 1 guest