[Server Scripting] Script changes for next update

Discussion in 'Server and Client Scripting' started by coyotte508, Feb 19, 2012.

  1. Manectric-Rang

    Manectric-Rang Unown-Ç ftw

    Joined:
    Mar 21, 2012
    Messages:
    60
    Likes Received:
    0
    afterBattleEnded: function(winner, loser, result, battleid,team1,team2)
    beforeBattleMatchup : function(src,dest,clauses,rated,team1,team2)

    team1 and team2 always return undefined. Every other parameter works fine (winner returns the correct id, etc). Case is correct; if case were wrong, scripts would not run...
     
  2. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    Are both players teams valid?
     
  3. Manectric-Rang

    Manectric-Rang Unown-Ç ftw

    Joined:
    Mar 21, 2012
    Messages:
    60
    Likes Received:
    0
    Is it possible to finish a battle with two invalid teams?

    Of course they are valid.
     
  4. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    bool beforeBattleMatchup(intsrc,intdest,constChallengeInfo&desc);
    void afterBattleEnded(intwinner,intloser,intdesc,intbattleid);
    Neither return team, despite what's being said in this thread.
    Which is actually what

    said
    Also it is possible, a challenge cup match doesn't need a valid team
     
    Last edited by a moderator: Apr 4, 2014
  5. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    ChallengeInfo is a struct. If you look down, there is:
    evaluate(myscript.property("beforeBattleMatchup").call(myscript, QScriptValueList() << src << dest << c.clauses << c.rated << c.mode));

    while in beforeChallengeIssued:
    evaluate(myscript.property("beforeChallengeIssued").call(myscript, QScriptValueList() << src << dest << c.clauses << c.rated << c.mode << c.team << c.desttier));

    Player team id and opponent tier can be passed, but are unused in the code.

    For afterBattleEnded, there is no team id code.
     
    Last edited by a moderator: Apr 4, 2014
  6. Barry Palmer

    Barry Palmer Banned

    Joined:
    Aug 15, 2012
    Messages:
    3
    Likes Received:
    0
    When i copy paste it nothing happens ??
     
  7. Manectric-Rang

    Manectric-Rang Unown-Ç ftw

    Joined:
    Mar 21, 2012
    Messages:
    60
    Likes Received:
    0
    Well, I'll try something else.


    Why sys.item() can no longer return berries? sys.item(sys.itemNum("Lum Berry")) returns undefined. So does sys.item(8008).
     
  8. Crystal Moogle

    Crystal Moogle Ayaya~ Administrator Administrator

    Joined:
    Jul 19, 2010
    Messages:
    3,205
    Likes Received:
    531
    PO Trainer Name:
    Hanako
    Really? Before return Lum Berry for me
    (18:05:10) Got from eval: Lum Berry (client)
    (18:05:22) Got from eval: Lum Berry (server)
    Both client side and server side scripts.
     
  9. Manectric-Rang

    Manectric-Rang Unown-Ç ftw

    Joined:
    Mar 21, 2012
    Messages:
    60
    Likes Received:
    0
    (19:19:32) sys.item(8008) --> undefined
    (19:19:34) sys.item(8) --> Expert Belt
    (19:19:42) sys.item(8008) --> undefined
    (19:19:43) sys.item(8) --> Cinta Xperto

    I did not test it in client side, but it also returns undefined for me. Last two lines are from client scripts. First ones, from server scripts. The function works correctly for other items.

    EDIT: sys.changePokeItem does not work either if the item is a berry. sys.changePokeItem(src, 0, 0, 8008) does not work; sys.changePokeItem(src, 0, 0, 15) does.

    EDIT again: I updated my Pokémon Online to last version (v2.0.05d), and this works fine finally. However, server.exe crashes every time sys.tier is used...
     
    Last edited: Aug 21, 2012
  10. Tallgeese

    Tallgeese New Member

    Joined:
    Jul 31, 2012
    Messages:
    6
    Likes Received:
    0
    That is what I was referring to. Apologies for not being clear and making the distinction.

    You can get around afterBattleEnded not giving you the teams by saving them while in beforeBattleStarted via saveVal (and then removeVal'ing when you are done with them), but that seems cumbersome.

    It would also be nice if beforeBattleStarted could actually be stoppable, because unless I am severely missing something, there is no way to stop the fight via scripts if something is wrong with the second player's team, only the first (the challenger). Mainly since you don't get it until beforeBattleStarted.
     
  11. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    You should use beforeChallengeIssued and beforeMatchup to cancel battles.
     
  12. Tallgeese

    Tallgeese New Member

    Joined:
    Jul 31, 2012
    Messages:
    6
    Likes Received:
    0
    I am aware of that. However, those won't tell you both teams. You can only check the challenger's team, not the team of the person challenged.

    beforeBattleMatchup also currently does not let scripts look at the first player's team. See previous posts on the subject.
     
  13. Lamperi

    Lamperi I see what you did there

    Joined:
    Apr 25, 2010
    Messages:
    2,647
    Likes Received:
    11
    You should validate the team in afterTeamChange/afterLogIn and beforeTierChange then.
     
  14. TheUnknownOne

    TheUnknownOne Member

    Joined:
    Mar 28, 2011
    Messages:
    988
    Likes Received:
    3
    No.. just no. Store them in variables, not in the registry.