• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[v16/v17/v18] Cable Club (Online Trades/Battles) [Abandonware]

1,403
Posts
10
Years
    • Seen Apr 29, 2024
    This has been sitting on my computer for idk, like 6 months or something. It does trades and battles via a server that you'll need to host. The title says [Abandonware], and that's accurate. I haven't touched Essentials for a long time, and I don't intend to use it again.

    [April 22, 2021] Vendily added v18 support and eggs are now tradeable.

    Credits to Khaikaa for commissioning it, and Vendily for porting to v18.

    There's two parts:
    1. a plug and play script for Essentials in cable_club.rb. I call mine CableClub and put it directly above Main. You need to edit the HOST and PORT constants at the top to be the address and port of your server.
    2. a Python3 server in cable_club.py. It needs your PBS files to run, by default it looks in the directory you run it from, but you can pass --pbs_dir to change that. You can also pass --host and --port or alter the HOST and PORT constants at the top.

    Connections are established via Trainer IDs, which can be found on the trainer card screen. Think of them as a bit like friend codes.

    For hosting the server you could try free-tier on Google Cloud. It shouldn't use much processing power (but I'd recommend setting up some sensible limits, because there's nothing in the protocol to stop somebody DDOSing it).

    https://www.mediafire.com/file/sj658t5py06o98r/cable_club.zip/file
     
    Last edited:
    2
    Posts
    3
    Years
    • Seen Mar 19, 2021
    I feel a bit ashamed that it took this long to share this. Sadly I've been very busy, and even forgot about it for some months. We were a bit unlucky that the newer version of pokemon essentials(v18) was launched just a few days after we stop working on it. I hope this helps anyone wanting to give online features to their games.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    So um... is there suppose to be an instruction manual for the set up?

    There's two parts:
    1. a plug and play script for Essentials in cable_club.rb. I call mine CableClub and put it directly above Main. You need to edit the HOST and PORT constants at the top to be the address and port of your server.
    2. a Python3 server in cable_club.py. It needs your PBS files to run, by default it looks in the directory you run it from, but you can pass --pbs_dir to change that. You can also pass --host and --port or alter the HOST and PORT constants at the top.

    You can test with "localhost" or "127.0.0.1" as the host if you run the server locally, i.e. on your PC, during development. But for setting up a publicly-available server you'll need more technical know-how. Like I say in the post, you could try a free-tier cloud hosting service for that.
     
    27
    Posts
    4
    Years
    • Seen Jul 19, 2023
    I'm getting the following error, when trying to start des script:
    Code:
    Traceback (most recent call last):
      File "E:\Testserver\cable_club.py", line 387, in <module>
        Server(args.host, args.port, args.pbs_dir).run()
      File "E:\Testserver\cable_club.py", line 18, in __init__
        self.valid_party = make_party_validator(pbs_dir)
      File "E:\Testserver\cable_club.py", line 302, in make_party_validator
        moves = {moves_by_name[m] for m in moves_.split(',')[1::2] if m}
      File "E:\Testserver\cable_club.py", line 302, in <setcomp>
        moves = {moves_by_name[m] for m in moves_.split(',')[1::2] if m}
    KeyError: 'LOVELYKISS'
    Don't know, what exactly that means, I'm not that familiar with Python, but realy would want to get it work, so is there someone who can help me?^^
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I'm getting the following error, when trying to start des script:
    Code:
    Traceback (most recent call last):
      File "E:\Testserver\cable_club.py", line 387, in <module>
        Server(args.host, args.port, args.pbs_dir).run()
      File "E:\Testserver\cable_club.py", line 18, in __init__
        self.valid_party = make_party_validator(pbs_dir)
      File "E:\Testserver\cable_club.py", line 302, in make_party_validator
        moves = {moves_by_name[m] for m in moves_.split(',')[1::2] if m}
      File "E:\Testserver\cable_club.py", line 302, in <setcomp>
        moves = {moves_by_name[m] for m in moves_.split(',')[1::2] if m}
    KeyError: 'LOVELYKISS'
    Don't know, what exactly that means, I'm not that familiar with Python, but realy would want to get it work, so is there someone who can help me?^^

    So make_party_validator is the thing that parses your PBS files and creates a data structure that can check that any Pokémon that are used online are actually valid (i.e. consistent with the PBS files). So your error seems to me like there's a move in your pokemon.txt (LOVELYKISS) that isn't in your moves.txt.
     
    27
    Posts
    4
    Years
    • Seen Jul 19, 2023
    So make_party_validator is the thing that parses your PBS files and creates a data structure that can check that any Pokémon that are used online are actually valid (i.e. consistent with the PBS files). So your error seems to me like there's a move in your pokemon.txt (LOVELYKISS) that isn't in your moves.txt.

    I checked that and the move is in both my files, pokemon.txt and moves.txt.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I checked that and the move is in both my files, pokemon.txt and moves.txt.

    I don't know then. This is the code that loads moves:
    Code:
        with io.open(os.path.join(pbs_dir, r'moves.txt'), 'r', encoding='utf-8-sig') as moves_pbs:
            for row in csv.reader(moves_pbs):
                if len(row) >= 2:
                    moves_by_name[row[1]] = int(row[0])
    moves_by_name doesn't contain LOVELYKISS as per the error. Perhaps you could add a print(moves_by_name) like so:
    Code:
                    moves_by_name[row[1]] = int(row[0])
    
        print(moves_by_name)
        with io.open(os.path.join(pbs_dir, r'items.txt'), 'r', encoding='utf-8-sig') as items_pbs:
    and check what moves are parsed. If it's empty, then I'd assume that your file isn't (effectively) a CSV file? Or is formatted differently to any PBS files I've seen out in the wild.
     
    27
    Posts
    4
    Years
    • Seen Jul 19, 2023
    So, now I got the server to work. But when I battle against another person, I have a few issues:
    1. When I use Mega Evolution, this is not visible for my opponent. I mega-evolve on my screen, but it will not mega evolve on my opponents screen.
    2. Sometimes, I get this Runtime Errors (see the screenshot).
    3. I had it one time, that I used a attack and the opponents Pokemon fainted, but at my opponents screen, he attacked first and my pokemon fainted. After this, we both had the message "Waiting..." and nothing happens on this point, until one of us closed the game, so that the connection closed.

    I realy dont know, why this happens. Trade works fine without any issue.
     

    Attachments

    • ErrorOnline.PNG
      ErrorOnline.PNG
      28.4 KB · Views: 27
    • ErrorOnline2.png
      ErrorOnline2.png
      77.6 KB · Views: 20
    Last edited:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    So, now I got the server to work. But when I battle against another person, I have a few issues:
    1. When I use Mega Evolution, this is not visible for my opponent. I mega-evolve on my screen, but it will not mega evolve on my opponents screen.
    2. Sometimes, I get this Runtime Errors (see the screenshot).
    3. I had it one time, that I used a attack and the opponents Pokemon fainted, but at my opponents screen, he attacked first and my pokemon fainted. After this, we both had the message "Waiting..." and nothing happens on this point, until one of us closed the game, so that the connection closed.

    I realy dont know, why this happens. Trade works fine without any issue.
    1. Ah. Yeah, I never checked (or even thought about) mega evolution. It probably doesn't get sent to the other client which would cause the battles to desync and eventually crash.
    2. I'm not sure. Sounds like your client was not expecting an attack, but your friend sent one. Maybe you thought their Pokémon fainted, but it didn't on their screen (i.e. a desync occurred sometime), and so when they chose their move your client was like "hey, I was expecting you to send in a Pokémon!"
    3. That's another desync. Basically it's caused by random numbers being generated in a different order on both clients. It shouldn't happen but, e.g. your mega evolution thing would do that because the turn order will be different on each client.
     
    27
    Posts
    4
    Years
    • Seen Jul 19, 2023
    1. Ah. Yeah, I never checked (or even thought about) mega evolution. It probably doesn't get sent to the other client which would cause the battles to desync and eventually crash.
    2. I'm not sure. Sounds like your client was not expecting an attack, but your friend sent one. Maybe you thought their Pokémon fainted, but it didn't on their screen (i.e. a desync occurred sometime), and so when they chose their move your client was like "hey, I was expecting you to send in a Pokémon!"
    3. That's another desync. Basically it's caused by random numbers being generated in a different order on both clients. It shouldn't happen but, e.g. your mega evolution thing would do that because the turn order will be different on each client.

    So basicly, Mega Evolution is the problem, hmm. Is there an easy way to fix this, or is this more complex?
     
    68
    Posts
    5
    Years
    • Seen Aug 25, 2023
    Hello, and excuse me... I'm getting a Syntax error in the line 16, and i don't understeand whats happening u.u.

    Script 'Server' line 16: SyntaxError occurred.

    The line 16 is: class Server:

    So... I don't know... I'm sorry if this a kind of basic question but I truly don't understeand and i really like the idead of online :(.

    Than
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    So basicly, Mega Evolution is the problem, hmm. Is there an easy way to fix this, or is this more complex?
    It's probably quite easy to fix if you're a relatively strong coder, you'd need to find the bit of code that's responsible for sending the choice (I think it might be pbDefaultChooseEnemyCommand, writer.sym(:choice) is the start of the sending code) and extend it to send both the choices and any mega evolution details. Then you'd need to update the parsing code in the same function (which starts @connection.update do |record|) to extract your mega evolution data, and set the appropriate information to make the mega evolution happen. This will probably be the same data that you read in the sending step.

    Hello, and excuse me... I'm getting a Syntax error in the line 16, and i don't understeand whats happening u.u.

    Script 'Server' line 16: SyntaxError occurred.

    The line 16 is: class Server:

    So... I don't know... I'm sorry if this a kind of basic question but I truly don't understeand and i really like the idead of online :(.

    Than
    I think you've copied the Python server code into RMXP. But what you needed to do was copy the Ruby code (in the cable_club.rb file) into RMXP, and use Python 3 to run the server.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    So basicly, Mega Evolution is the problem, hmm. Is there an easy way to fix this, or is this more complex?
    It's probably not too tricky if you know where Essentials stores the information about which Pokémon are waiting to mega evolve. Basically all you'd need to do is edit pbDefaultChooseEnemyCommand to send and receive that information. The sending code starts with @connection.send do |writer| and the receiving code starts with @connection.update do |record|. They both manipulate @choices which I had hoped would encapsulate all the state needed to deal with battle choices, but I guess the details about mega evolution are found elsewhere.

    Hello, and excuse me... I'm getting a Syntax error in the line 16, and i don't understeand whats happening u.u.

    Script 'Server' line 16: SyntaxError occurred.

    The line 16 is: class Server:

    So... I don't know... I'm sorry if this a kind of basic question but I truly don't understeand and i really like the idead of online :(.

    Than
    Sounds like you've copied the Python server code into RMXP (from cable_club.py), but you only want to copy the Ruby client code (from cable_club.rb). The Python server you need to run using Python 3.
     

    Canal_do_Lontra

    Oshawott uses Razor Shell
    207
    Posts
    4
    Years
  • It works with v18.1? I am needing so much online battle and trade, I am making my fan game on essentials v18.1
     
    Back
    Top