~~Server~~ message appears twice

Discussion in 'Server and Client Scripting' started by Maribel Hearn, Jul 3, 2013.

  1. Maribel Hearn

    Maribel Hearn Scripter Developer Developer

    Joined:
    Sep 9, 2012
    Messages:
    33
    Likes Received:
    26
    PO Trainer Name:
    Maribel Hearn
    I have tried to make a script to make a message by ~~Server~~ appear in only the main channel instead of all channels, using the following script in beforeNewMessage:

    Code (text):
    1. if (message.substr(0, 12) == "~~Server~~: "){
    2.     sys.stopEvent();
    3.     sys.sendHtmlAll("<font color='orange'><timestamp/><b>~~Server~~:</b></font> " + message.slice(12), 0);
    4.     return;
    5. }
    However, the event appears not to be stopped even with sys.stopEvent() there. The message posted by ~~Server~~ appears twice. Of the two, the first message is the one that is supposed to appear. The second message appears in all channels and ~~Server~~ has bot colour in it. I have no idea how this message can appear while the event has stopped. There should only be the first message, which is posted in my main channel. I tried removing my client scripts, but nothing changed. Does anyone know what is going wrong? And if so, please tell me how to make the ~~Server~~ messages appear in my main channel instead of all. It's really annoying to have the messages appear in private channels.

    Also, the messages sent by ~~Server~~ do not appear in the server window without this script. That is strange to me, as they always did in previous versions of PO.
     
    Last edited: Jul 3, 2013
  2. Fuzzysqurl

    Fuzzysqurl baa baa mareep I do what I want Server Owner Developer I do what I want Server Owner Developer

    Joined:
    Sep 12, 2012
    Messages:
    2,096
    Likes Received:
    967
    You'll find a bit more help with your problem under Server and Client scripting, since that's what this pertains to. (I have no idea what I'm doing so bear with me if I sound stupid and uninformed) There might be an event or something that you're missing or a check that didn't properly check or something.

    Anyway, this post is just letting you know your thread was relocated.
     
    Last edited: Jul 4, 2013
  3. ArchZombie

    ArchZombie Member

    Joined:
    Aug 1, 2012
    Messages:
    65
    Likes Received:
    0
    PO Trainer Name:
    ArchZombie0x
    The sys.stopEvent stops the message being printed on the console, not the broadcast that prints that message AND sends it to players. Maybe we should add a beforeServerMessage event for this?
     
  4. Maribel Hearn

    Maribel Hearn Scripter Developer Developer

    Joined:
    Sep 9, 2012
    Messages:
    33
    Likes Received:
    26
    PO Trainer Name:
    Maribel Hearn
    So it is impossible to stop a server message from being sent? Wow, that sucks... I badly want my server messages in one channel. :( BeforeServerMessage should indeed be added.
     
  5. ArchZombie

    ArchZombie Member

    Joined:
    Aug 1, 2012
    Messages:
    65
    Likes Received:
    0
    PO Trainer Name:
    ArchZombie0x
    At the moment yes, I'll go ahead and look into fixing that though :)

    EDIT:

    https://github.com/po-devs/pokemon-online/pull/306
    Check status to see if mainlined :)

    EDIT2: Inn the mean time you could clone my repository, but you'll need to compile it yourself.
     
    Last edited: Jul 3, 2013
  6. Maribel Hearn

    Maribel Hearn Scripter Developer Developer

    Joined:
    Sep 9, 2012
    Messages:
    33
    Likes Received:
    26
    PO Trainer Name:
    Maribel Hearn
    Okay, thanks!