nutmix's Forum Posts

  • If I have two text objects on the layout, e.g. one saying "balance" and the other saying "stake". I have 3 options:

    1) insert two new text objects

    2) insert one text object, then clone it & change text

    3) insert one text object, and copy and paste it & change text.

    All three methods seem to work, but which is best?

    I'm guessing copying is best, as it puts less objects in the "object types" project tree so is easier to navigate, but what are the gotchas to this approach? I.e. what are the limitations?

    I even seem to be able to assign different values of instance variables to copied (not cloned) objects.

  • I get the below error every time I try and update one of my posts. sometimes i can just hit back and resubmit and it works, sometimes nothing will get rid of this error. What is this? I am logged in, there is nothing wrong with my browsers cookie handling - it looks like a bug in the forum SW:

    Error

    Only members with sufficient permission can access this page.

    A security error has occurred with authentication.

    Please ensure that all cookies are enabled on your web browser, you are not using a saved or cached copy of the page, and your Firewall/Proxy settings are not hiding or masking your IP address.

  • I have a blank project and made the layer background light blue.

    I then put some text objects on, and changed the font to Verdana(18).

    all good.

    however, if I now change the font colour to white, and run it, the text comes out like some 8-bit font, totally different to if I change the font to red or black or any other colour (in which case it looks perfect).

    Any ideas why white text would go horribly wrong?

  • rexrainbow - good tip.

    I see that the flags are things like "ef_return_string". The is no ef_return_array. ef_return_any is an integer, float or string, according to the doc, so no way to return an array. I guess i could return JSON, or a coma separated string list, but parsing this is adding as much work than the plugin saves. I dont understand what ef_variadic_parameters are. These are designed for input, looks like the plugin system was not really designed to return data more complicated that a string or number. I need to return hundreds of numbers, unfortunately.

    The plugin stuff looks very clever, but pretty bewildering and daunting as i don't have the time to invest to reverse engine it from examples.

  • You guys are awesome!

    Great work.

  • I need to call javascript to do some calculations which would not be feasible in C2. I've read the plugin docs, and looked through some plugins which draw stuff, but cant see how to return a value.

    Could someone write a very simple plugin which say adds two numbers (passed to the plugin as parameters) and returns the result back the game?

    This would make a great tutorial too (there is one for drawing a grid, which is good, but not relevant in this case).

    Or is there another way to call a simple JS function without the complexity of plugins?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmm, so you would use a horizontal image, and a separate vertical line image, then stretch them to the right hight and thickness, duplicate them, then place them in the right possitions? Would the corners not overlap/look ragged? i need to put numbers in the centers of the grid, which seems tricky too. This has to work on html5 mobile, so will have to scale for any screen size, and will need to move around to support landscape and portrait with a single layout (two layouts breaks the game state).

  • Imagine a simple bingo ticket - if we did it in HTML/CSS it could be a simple table containing numbers, and the table lines stroked with CSS.

    how would one do this in C2?

    I guess I could write a plugin, but expect this would take a number of days/weeks as, having read the SDK docs there is a lot of complexity and things to know to develop something like this.

    Anyone know any existing plugins?

  • I have looked at the plugin template, and under Parameter Types it lists things like:

    Number

    String

    CmpParam

    etc.

    These are for input (passed to the plugin).

    How are values passed back from the plugin call to the game? Either an action, like "connect()" or an event, such as "onError()"). I think events are called conditions in the SDK.

    If its possible pass data back, can a two dimensional array of numbers be passed back? If so, how, if no, is there a way to hack into arrays already defined in the project, and modify them?

    There is no mention of returning data in the SDK documentation that I can find, except for expressions.

    Many thanks for any help.

  • OK, being new to web sockets, and socket.io (but have been programming unix sockets for 30 years), i realise where i was going wrong.

    Socket.io is not compatible with web sockets.

    I installed the ws package on node.js, and changed the server side test program to this:

    var WebSocketServer = require('ws').Server

    , wss = new WebSocketServer({port: 8080});

    wss.on('connection', function(ws) {

        ws.on('message', function(message) {

            console.log('received: %s', message);

        });

        ws.send('something');

    });

    And it works with the C2 web sockets.

    However, web sockets suck compared with the features of socket.io and jwebsockets, so I will be developing plugins for one of those. (could not get Zacks socket.io to work).

  • Hi, the bingo logic, and server side stuff, and socket communication is my bag, baby. Where I fall down is the client side graphics. E.g. animating a ball rolling, or popping up like you get on say chitchatbingo.co.uk. Where I really fail is popping up things like "game starting in 5.4.3".

  • Ok, got it to connect now, but no joy on transferring messages in either direction. Neither side sees the messages from the other. I am guessing its because node.js uses two parameters, and the web socket implentation only uses one. I.e. the "balls" and "daub" in my example. Unfortunately, the official web socket manual page has no examples or info on what it expects on the server side, and i cant find a server side web socket implementation which is compatible with it.

    I think my only option here is to develop my own plugin, as my client and server javascript works fine, its just the 3 or 4 existing web socket and socket.io plugins for C2 dont work with node.js and socket.io.

    I chose node.js and socket.io for speed of prototyping and compatibility, but will probably switch to smartfoxserver 2x, kaazing or jwebsocket for production.

  • Hi Rex.

    I have tried both the official websocket and Zacks socketio plugin, and neither work (neither try and make any connection, nor send any data, nor repsond to any message).

    Do you have a general purpose socket.io plugin which you use? I looked at your list of plugins, and you only seem to have lobby, bottleneck and chat plugins, not one I can use.

    I have a very simple test node.js app:

    var io = require("socket.io").listen(8080);

    io.sockets.on('connection', function (socket) {

        console.log("connected");

        socket.emit('balls', { ball:42 });

        socket.on('daub', function (data) {

          console.log(data);

        });

    });

    And if I hit it with a simple js page:

    <html>

    <head>

    </head>

    <body>

    <script src="socket-io/socket.io.js"></script>

    <script>

    var socket = io.connect('http://localhost:8080');

    socket.on('balls', function (data) {

        console.log(data);

        socket.emit('daub', { my: 'data' });

    });

    </script>

    </body>

    </html>

    It works perfectly. But i have yet to find any socketio or web socket plugin which will work (or even connect), e.g. this doesnt:

    System=>On start of layout: Socket - Connect to "ws://localhost" (set to 8080 in dialogue)

    does not make, or attempt to make, any connection to node server.

  • I have spent days trying to get this plugin (and the official web socket plugin) working, but they do nothing.

    I tried the echo test project, does nothing but create a blank page.

    I.e. something is seriously not working.

    Also, neither work at all with node.js.

    I am running node.js with socket.io on port 8080, using this very simple app:

    var io = require("socket.io").listen(8080);

    io.sockets.on('connection', function (socket) {

        console.log("connected");

        socket.emit('balls', { ball:42 });

        socket.on('daub', function (data) {

          console.log(data);

        });

    });

    If I just write a dumb HTML page, it works perfectly:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    </head>

    <body>

    <script src="socket-io/socket.io.js"></script>

    <script>

    var socket = io.connect('http://localhost:8080');

    socket.on('balls', function (data) {

        console.log(data);

        socket.emit('daub', { my: 'data' });

    });

    </script>

    </body>

    </html>

    I get 42 logged in the console

    I have tried various plugins, (there are lot of versions floating round), none of them work at all, no error, nothing in console, no error events, no events what so ever.

    E.g. this 3 line socket.io plugin app doesn't do anything:

    <img src="https://www.dropbox.com/s/zh8dmd6ylxstkm0/sio.PNG" border="0" />

    Nor does this one using the official plugin:

    <img src="https://www.dropbox.com/s/mkommxixt23e1l2/WSProj.PNG" border="0" />

    I am trying on the latest chrome and FF. Neither work. using the developerconsole/firebug, they show no socket connections being made. Ill try using wireshark, but the impression I get is that the "connect to" method is simply not making any connection attempt.

    I have also tried exporting the projects as html5 sites, and running them from there. no joy.

  • I have a tiny test app running on node.js with socket.io installed:

    var io = require("socket.io").listen(8080);

    io.sockets.on('connection', function (socket) {

        console.log("connected");

        socket.emit('balls', { ball:42 });

        socket.on('daub', function (data) {

          console.log(data);

        });

    });

    As you can see, it sends one message, and logs when it receives one.

    I know its all working as when I try this test js outside of C2, it works:

    <html>

    <head>

    </head>

    <body>

    <script src="socket-io/socket.io.js"></script>

    <script>

    var socket = io.connect('http://localhost:8080');

    socket.on('balls', function (data) {

        console.log(data);

        socket.emit('daub', { my: 'data' });

    });

    </script>

    </body>

    </html>

    Using the official C2 web sockets plugin, nothing happens.

    Using Zacks socket.io plugin: scirra.com/forum/plugin-zack0wack0s-socketio-mod_topic56503.html

    Nothing happens.

    My capx simply says:

    system->On load complete=WebSocket connect to "ws://localhost:8080" (required protocol "").

    It never connects to the server. no errors no nothing.

    WebSocket->On message is never fired.

    WebSocket->On connection error is never fired.

    WebSocket->On connection opened is never fired.

    The same using the Socket object provided by Zacks plugin, it does nothing. i.e.

    system->On load complete=Socket Connect to "ws://localhost" (port 8080 specified in the dialogue) never connects. It also never calls any events, such as On Connect or on error.

    They are both just "dead". But I know the server side is working fine.

    any ideas?