Problem building plugin (plugin error created)

0 favourites
  • 6 posts
From the Asset Store
7 Errors
$15 USD
7 Errors is a game where you have to find the 7 mistakes before time runs out. Can you find all 7? Have fun looking.
  • Hello

    I converted the peerjs plugin built for construct2 to a plugin for construct 3 but it gives an error and I could not fix the error

    I put the plugin here so that if anyone could fix the problem and share or help

    Thankful

    ------------------------------------------------------

    I made a change to connect to the server we are building

    And it works well inside construct 2

    -------------------------------------------------------

    Can not find peer(class)

    error console:

    aught (in promise) ReferenceError: Peer is not defined

    -------------------------------------------------------

    Visit this page to run the server

    https://github.com/peers/peerjs-server

    ------------------------------------------------------

    To download the plugin, refer to the following link

    https://ufile.io/9m1wqv5t

    ------------------------------------------------------

    Image of console error

    -----------------------------------------------------

    Thank you for your attention

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Construct 3 now uses JavaScript Modules, meaning each file has its own separate scope. If Peer is used as a global variable, you should refer to it with globalThis.Peer.

  • Construct 3 now uses JavaScript Modules, meaning each file has its own separate scope. If Peer is used as a global variable, you should refer to it with globalThis.Peer.

    Do I just need to convert this.peer to globalThis.Peer?

    Excuse me for asking again

    Because I did not understand correctly

  • please help

  • Do I just need to convert this.peer to globalThis.Peer?

    If Peer is used as a global variable, then yes. Make this change where this variable is declared. It should look like this:

    globalThis.Peer(params)
    {
     // custom code here
    }
    
  • GameSoul - I don't believe that code is valid syntax.

    Do I just need to convert this.peer to globalThis.Peer?

    this.peer does not refer to a global variable. If you have to ask a question like this, I think you need to learn more about the basics of the JavaScript language. There are plenty of resources for that on the web.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)