troublesum's Forum Posts

  • There isn't one unfortunately... C2 doesn't have any referencing for "null" values. For official plugins everything is forced to Numbers, Strings or Boolean. nulls are usually returned as int(0) and then converted to what ever you are setting to.

    Example:

    You have a var myString that you set from a function return and some how that return value is null (shouldn't be possible unless using a 3rd party plugin) this would be the resulting outcome.

    var myString = ""; (defined as type string)

    myString = myfunction.returnValue; (set myString from function return value. if null it will return int(0))

    myString equals "0" (stringified version of int(0))

    Based on looking at the plugins this appears to be by design to either prevent system errors or non-programmers from making mistakes. We just have to work around this limitation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're all very welcome.. ... I'm glad it helped.. Don't forget that for each C2 window that's open at the same time it increments the port number so adding a range of 50000-50010 might be needed in some cases if you have more than 1 project open for testing.

  • Surprisingly yes! You just need to forward port 50000 on your router to you local computer.

    Example:

    • Your computer at your home is located at 192.168.1.101 and you have a public IP of 65.23.45.65
    • Login to your router and forward port 50000 to 192.168.1.101
    • Open construct and open the project you want to preview.

    On your computer you can go to 192.168.1.101:50000 and see the preview.

    On your friends computer located remotely he will open chrome and go to 65.23.45.65:50000 which your router will forward to your computer and you computer will see the construct is listening to the port and launch the preview

    Your question got me curious so i tested my own so i can say for sure this works. Good luck!

  • sorry about that.. try it again

  • RexMundane - For that you need to work with and understand containers and picking instances. I updated the example for you. I think from the example it will cover the basics. The Person Sprite has a container that has the Dialog Dictionary and the DialogBox has a container that contains the text box and button. When you pick the Person it also picks the dictionary and when you create or destroy the dialog box it also creates or destroys the text and button... Good luck.

    [attachment=0:cm5uqnwb][/attachment:cm5uqnwb]

    [attachment=1:cm5uqnwb][/attachment:cm5uqnwb]

  • RexMundane - No worries I created an example for you... Sorry if it seams over complicated but as a developer I'm usually pretty thorough in code layout.. It does require some understanding but I think it will make sense once you see it working and can go over the code. Hopefully this helps.

    [attachment=2:u9gylaq3][/attachment:u9gylaq3]

    [attachment=0:u9gylaq3][/attachment:u9gylaq3]

    [attachment=1:u9gylaq3][/attachment:u9gylaq3]

    Edit: I made it easier and took out the processor part and its simply a triggered event now.

  • RexMundane - You want create a processor that executes thread chains of functions in a given order waiting for the previous one to finished before calling the next.

    The easiest method is as follows:

    First define variables

    • Create a stack of function names and store in an dictionary. (This will be your thread)
    • Create var functionIndex and set to -1 (Represents the next function to call)
    • Create var currentFunctionIndex and set to -1 (Represents the current function that was called)

    Now setup the processor

    • EveryTick if (functionIndex > -1) call Function from stack of that index (IE functionIndex = 0 call function name where dictionary index = 0)
    • Set currentFunctionIndex = functionIndex (to store for incremental purpose)
    • And then set functionIndex back to -1 so you stop calling functions

    Last is the control

    • When user presses a button (or some triggered event takes place) you take the currentFunctionIndex that was stored when the function was called and then set functionIndex to (currentFunctionIndex +1) so the next function will be called by the processor and so on
  • Love this game... I'm working on a scorched earth clone (physics shooter like gorillas) my self. Nice job!

  • skelooth - Sorry no I haven't put that in yet as my projects don't involve saving... but ill look at the API this week end and see whats involved... ill message you and let you know.

  • skelooth - I made these a while back. I don't officially support them but they work and I use them in my project. Your welcome to give them a try.

    Plugins

    [attachment=2:2gpmif2e][/attachment:2gpmif2e]

    Example Capx

    [attachment=1:2gpmif2e][/attachment:2gpmif2e]

    Preview of usage

    [attachment=0:2gpmif2e][/attachment:2gpmif2e]

    Storage = 3D Object

    Table = 2D Object

    List = 1D Object (Basically the same as a dictionary)

    They function like a normal Array/Hash table would in most programming languages. They support merging/loading raw JSON to them which is what you looking for. I provided a few example capx files that i work on to test them when i make an update to them. They should explain how to use it. Hopefully this helps

  • While I don't see a kick option for the Host to act with you could just send a message to a peer that they then will call a function on their side to leave the room or disconnect them selves. The Host will need a loop to verify and resend if peer is still in room after x amount of time.

  • imothep85 google is one of the few sites that does not allow its self to be run from iframe. You should pick another site for testing.

  • NicholasMDS Oh boy... that SQL statement needs a lot of work.

    To start you need to specify table name to select values from.

    This will select all rows from table "names" and order them by Id

    $sql="SELECT * FROM names ORDER BY id";
    $results=mysql_query($sql);
    [/code:jtioblbm]
    
    But then how you use $results is also wrong. $results is a SQL object return by the statement. To get results from the SQL object you need to 
    [code:jtioblbm]
    $output = array();
    while($row = mysql_fetch_array($results, MYSQL_ASSOC)){
         $output[] = $row;
    }
    [/code:jtioblbm]
    
    $output is now an array representing the data from the table names. What you do with the data now is up to you. I don't really see what your trying to accomplish with this though?
  • NicholasMDS Its strange that you are getting "<br/>". That means your PHP file that the Ajax request is accessing is returning HTML as well? I can't really help you on where that HTML coming from. Check your file or create a new one. If you willing to attach your PHP file i can take a look at it.

    Secondly that SQL looks does wrong. You have "SELECT * FROM nameIsOk" but you made it sound like "nameIsOk" is a column in the table. Is that also the table name as well? If not then there is one problem and if so I would recommend changing the table or column name so they dont match. Everything should still work but it will be less confusing.

    Do you self a favor and don't store the AJAX.Lastdata in a global number variable. If the AJAX.Lastdata ends up being string because it failed you will get the NaN (Not a Number) value. Just store it a as a string and work with it like that. As you PHP and C2 skills get better you should look into sending and recieving data as JSON (dont worry about that now but it will be useful to learn later).

  • I gave an answer to this a while back for someone else. Maybe it will help you...

    https://www.scirra.com/forum/viewtopic.php?f=147&t=111694&p=813850#p813850