factorycode's Recent Forum Activity

  • I exported my application made in Construct 3 to HTML5 and I want to run a web page in reactjs, as a react component, does anyone know if this is possible?

    import { useEffect } from 'react'; const ContructRoulette = () => { useEffect(() => { const scripts = [ '/assets/roulette/scripts/c3runtime.js', '/assets/roulette/scripts/supportcheck.js', '/assets/roulette/scripts/offlineclient.js', '/assets/roulette/scripts/main.js', '/assets/roulette/scripts/register-sw.js', ]; const loadScripts = () => { return new Promise((resolve, reject) => { let loadedScripts = 0; scripts.forEach((scriptSrc) => { const script = document.createElement('script'); script.src = scriptSrc; script.async = true; script.onload = () => { console.log(`${scriptSrc} carregado com sucesso`); loadedScripts++; if (loadedScripts === scripts.length) { resolve(); } }; script.onerror = () => { console.error(`Erro ao carregar ${scriptSrc}`); reject(new Error(`Erro ao carregar ${scriptSrc}`)); }; document.body.appendChild(script); }); }); }; const initC3Runtime = () => { if (window.C3_Init) { window.C3_Init().then(() => { if (window.C3_RuntimeInstance) { window.C3_RuntimeInstance.Initialize(); } else { console.error('C3_RuntimeInstance não está definido'); } }).catch((error) => { console.error('Erro ao inicializar C3_Init', error); }); } else { console.error('C3_Init não está definido'); } }; loadScripts() .then(() => { // Espera um pequeno tempo para garantir que C3_Init esteja definido setTimeout(() => { initC3Runtime(); }, 1000); // Ajuste o tempo conforme necessário }) .catch((error) => { console.error('Erro ao carregar scripts', error); }); return () => { // Limpeza de scripts scripts.forEach((scriptSrc) => { const script = document.querySelector(`script[src="${scriptSrc}"]`); if (script) { document.body.removeChild(script); } }); }; }, []); return ( <div id="construct-container" style={{ width: '100%', height: '100%' }}> <div id="construct-canvas"></div> </div> ); }; export default ContructRoulette;

    GOT THIS ERROR: C3_Init is not defined

  • I got it, thanks

  • I would like to know why I can't replicate my account and I still have an account that I paid

  • I already know javascript, I just don't understand why I can't call the function according to the video I saw on YouTube

    https://youtu.be/uFp7nYsqzAk?si=CCsc96WY3ZUmTTWm&t=120

  • your html should use the websocket client and find the WS

    let socket = new WebSocket("ws://yourws.com");

    socket.onopen = function(e) {

    alert("[open] Connection established");

    alert("Sending to server");

    socket.send("My name is John");

    };

    socket.onmessage = function(event) {

    alert(`[message] Data received from server: ${event.data}`);

    };

    socket.onclose = function(event) {

    if (event.wasClean) {

    alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);

    } else {

    // e.g. server process killed or network down

    // event.code is usually 1006 in this case

    alert('[close] Connection died');

    }

    };

    socket.onerror = function(error) {

    alert(`[error]`);

    };

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm new to construct and I came across a problem, I saw a tutorial on the internet where at the end of the EVENT SHEET line there is an option +Add and I chose add script and called an example function:

    msgTest("Testando");// isso em EVENT SHEET

    a function em Scripts.js

    function msgTest( message ){

    alert("msg = " + message );

    }

    I want to know why I can't run it

    sou novo no construct e me deparei com um problema, vi na internet um tutorial onde no final da linha do EVENT SHEET existe uma opção +Add e escolho add script e fiz chamei uma function exemplo:

    msgTest("Testando");// isso em EVENT SHEET

    a function em Scripts.js

    function msgTest( message ){

    alert("msg = " + message );

    }

    <<--------------------->>

    quero saber por que não consigo executar

factorycode's avatar

factorycode

Member since 24 Jan, 2024

None one is following factorycode yet!

Trophy Case

  • RTFM Read the fabulous manual
  • Email Verified

Progress

2/44
How to earn trophies