Noncentz705's Forum Posts

  • Its worth noting template strings have access to eval `token:${ extJS() }`

    Besides the js awesomeness ( which I hope you will consider );

    • String concats `${myprop} : ${myvar}` vs ""&myprop&" : "&myvar
    • Loading JSON

      *

      `{"prop":"val"}` vs "{""prop"":""val""}"

    * I know you'll frown upon not loading assets via ajax request

    but it adds an extra layer of asynchronous logic and it's not always convenient for small stuff you plan on storing in a variable to begin with.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [REQUEST] Template strings in the editor

    Ashley

    This :

    Browser.ExecJS(`alert(${MY_VARIABLE})`)[/code:2tgjv3oy]
    instead of : [code:2tgjv3oy]Browser.ExecJS("alert('"&MY_VARIABLE&"')")[/code:2tgjv3oy]
    
    // CODE
    [code:2tgjv3oy]
    var interpolate = new Function("str","scope","tagFn",`
      /* The function constructor ignores strict mode
         allowing the 'with' statement for scoping
      */
      if(!scope){ if(tagFn) return (eval("tagFn " + str)); 
        else return (eval(str));
      } else with(scope){ if(tagFn) return eval("tagFn " + str); 
        else return eval(str);
      };
    `);[/code:2tgjv3oy]
    
    // TESTS
    [code:2tgjv3oy]
    var scope = { two:"2" };
    console.log( interpolate("`${ parseInt(two) + 2 }`",scope) ); 
    // [4]
    
    console.log(
      interpolate("`${two}`",scope, 
      function(strs,...vals){ // optional template function
          return strs.map(function(val,ind,arr) {
             if(vals[ind]){ return val + vals[ind];} 
             else return val;
          }).join('');   
      }) 
    ); 
    // [2][/code:2tgjv3oy]
  • It seems to return a 127 address when offline.

  • Ashley , is there any chance we could have es6 template strings in the editor to avoid this kind of thing?

    maybe for c3?

  • Mylon , it's not an error - the form elements sit above the canvas and the cursor style is applied to the canvas element only. If you'd like a custom cursor for your form elements you can try using css.

  • On function your_function

    • set your_str to function.param(0);
    • set your_num to function.param(1);

    On some event

    - browser.execjs("

    /* do some stuff maybe async then */

    c2_callFunction('your_function', ['string', 1]);

    ");

  • To apply new styles based on events you might consider using the browser plugin and jquery.

    For all the time and css it takes to get a solution working you'll have been better off using sprites and the eventsheet.

    To style things consistently across desktop browsers you'll need to make you own progress element.

    I've made an example here

    Here's the same example in a capx (You'll need to install the plugin before you can run the example)

  • Colludium

    Mylon

    No problem..

  • Mylon

    As you likely noticed, support for styling progress elements varies by the browser.

    Doing so requires vendor prefixes and a fallback for older browsers if you want things to look consistant.

    To achieve your desired look and keep things consistent it might be easiest to create your own

    progress bar by using sprites or a HTML solution with a custom plugin.

    The fiddle you sent would use the later.

    If your target export is nw.js you can safely ignore that advice and use some of the webkit prefixes from the link bellow.

    Here's an article that covers the process and pitfalls of styling progress elements

    https://css-tricks.com/html5-progress-element/

    About loading CSS with the web font action,

    The CSS is included for the lifetime of your app, so it would be best moved to the loading layout.

    Your HTML elements may show without style for an instant while the stylesheet is fetched.

    It's worth asking Ashley for 'On web font loaded' and '.. failed' conditions if this is a problem.

    To apply different styles based on events you can add/remove class's to your element (with jquery for example).

    Colludium

    It's one of the default themes

    • View/Style/Visual Studio styles/Visual Studio Dark 2012
    • File/Preferences/Colors/Choose theme/Default

    The style on the tabs won't seem to change until you restart the editor.

  • mylo

  • Here's one line version that doesn't try to write a css parser with tokenat... <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz"> <img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question">

    https://dl.dropboxusercontent.com/u/139 ... t_css.capx

  • Let the browser handle validation for you.

  • It's frustrating when addons go missing, especially if you have projects that rely on them...

    jabedbd here