How to run functions from TPTMulti?

  • BrianTheEngineer
    18th Jun 2020 Member 0 Permalink

    I want to implement a button that basically syncs my screen onto the current room. I have seen another script, made by jacob1, sync to the game by adding a custom command but I want to use a button as it is much more convenient for me to press if I am tuning Wifi using a script or using PROP.

  • jacob1
    18th Jun 2020 Developer 0 Permalink
    tptmp exposes very few things. If you look through the script, you'll see that nearly everything is local. Chat commands are one of the few exceptions, which is why I was able to add a custom client command.

    For some unusual reason, I made TPTMP.con.socket exposed publicly. This means you can send data through the socket from a button you create this way. I can't guarantee this feature will always be here, but for now if you really want to get into the tptmp protocol this is the only option. But it's likely to break stuff if you are handling the socket instead of letting tptmp do it.
  • BrianTheEngineer
    18th Jun 2020 Member 0 Permalink

    So I can't do it without seriously breaking the game?

  • jacob1
    18th Jun 2020 Developer 0 Permalink
    If you know what you are doing, you could send the "sync" byte over the socket, without breaking the game.
    If you do end up sending wrong data, you'll probably get disconnected from the server for sending invalid stuff.
  • BrianTheEngineer
    18th Jun 2020 Member 0 Permalink

    Are there any plans to make global functions to allow players to create scripts such as mine without having to directly communicate to the socket?

     

    I feel this would help players fine-tune TPTMulti to their own needs without needing to directly edit the TPTMulti file.

    Edited once by BrianTheEngineer. Last: 18th Jun 2020
  • jacob1
    18th Jun 2020 Developer 0 Permalink
    Not really. tptmp is meant to handle all syncing itself, and the server will ignore any custom commands or protocols it doesn't recognize. There are very limited uses for creating hooks into this.

    I could expose the sync command at some point though.