Juryiel's Forum Posts

  • Not sure if this is working as intended but just FYI, this doesn't wrap correctly when the offset causes a wrap. E.g. one easy way to reproduce is to make the subwidth the same as the texture size, then offset x by some amount. I was planning to use this to randomly sample different parts from one repeating texture to procedurally generate some content but it seems like I'll have to pad my texture with itself on all sides if this is the intended behavior.

    EDIT: The problem seems to only happen in the editor. It looks like it's correctly wrapping in game.

  • I think it depends on the game. Maybe if you're playing angry birds yes. If I make a quality game with a bit of depth etc, I imagine the audience would be different. I would in fact like the option to have it played on Win XP in an accelerated form when possible, and besides, my game is not playable without webGL anyway. If users care enough complain I would be more than happy to walk them through how to deal with the option.

    I guess I don't see why having such an option available can hurt. And not having it means that essentially C2 no longer supports Win XP for my game. Not that any of this matters since I just do this as a hobby and no one who isn't me will play this game, but in theory

  • Aphrodite - ideally, end users shouldn't have to make a choice like that. Generally if you ask a non-technical user a technical question, they will give up, try to cancel it, or pick a random choice because they don't understand the consequences.

    Wouldn't this depend on how it's presented? I'm not sure if this is feasible, but having the user choose "This will improve performance but may cause crashes" in-game option should make things pretty clear. 'I'll try this, if I get crashes I'll just turn it off'. They don't need to know what it is.

  • I can't find the setting that lets me set which object comes next when switching between textboxes and buttons etc with 'tab'. Any help would be appreciated!

  • I added a few actions to allow to set the max and min X and Y through the event sheet. Not really tested well but it seemed simple enough, so if anyone wants that functionality here it is:

    https://dl.dropboxusercontent.com/u/308 ... nction.zip

  • So I finally got back to this. The AJAX thing doesn't work unfortunately, but just having a condition with "Compare two values" with one value being (typeof functionname == 'function' ) and the other being 1 works pretty well.

  • lennaert R0J0hound

    Sorry I didn't copy/paste the actual code because I changed it to the working Textbox version I mentioned, so I introduced some red herrings on the board that are not part of the actual code.

    First, the variable is not called var, that was just a dummy name, it's called window.unencryptedresponse.

    Second, there are in fact quotes around the C2 data structure (either the ajax or textbox etc), here's the actual call.

    Browser.ExecJS("window.unencryptedresponse=encrypt ('mykeystring', atob('" & AJAX.LastData & "'), 0, 0,0, 1);  ")[/code:23l4u1k7]
    
    encrypt is the enryption function and its various parameters, atob and btoa are functions that convert from base64 and back.
    
    This is another call that fails for the same reason:
    
    [code:23l4u1k7]Browser.ExecJS("window.encryptedresponse='" & AJAX.LastData & "';") [/code:23l4u1k7]
    
    All of these actually work when using Textbox.Text instead of AJAX.LastData, (but not when using TextLabel.Text).  So that makes me fairly convinced that it must be some illegal characters in there that Textbox does not support and removes, and that error message is known to come up in chrome in those zero-width-space situations.
  • I'm using encryption in my game to communicate with a server. The response I get back is a base64 encoded string that looks like this:

    hAqJMf1lc4wnqtMgYhrzVCoPrE2q5c6xb7ivwqYzmKUrHFQR/hYj5l9zOrJY8DyUGrUmTyoAral9/a2m7agRkfzWB5udiqieSVAjXWXknWDEYzmWyu4uVA6ZYdFpE3gkxUq7YOq4XB3HJiN/RIT03/+BrO40maUHhhaAGbIeMGvlBNran051RVB5M7EHuaQdSUqnOSWerlaqB0xfmlBFtrLzY6PM0HeCpBC1p4tXRvtcxS7umb61TYXZ1A7/RAfS118j/9YpD3ZdBEA/sllLARoS4HeR/0k+RwQqPgN0cpWyRV+z3a5UR/GscBt89S8OcnYGQQgD11ouAsqR1bvktuHdPRKpXB7W2C4e/fLUxwp8GFyQ9v7Ss2WiXLOCziOg1Tz6sV6NdKDJe8mO0oODIKhUy8ldG3QLhKWjWdMZPSkuG2w6CB62Itc3NDaXqMEaTkSyD7340nXVPPqxXo10oB1ZZy9NgG8m1dz95ROMx0NW2Gal75K2La0GylfqJmFLS02sYp2NErgRnupVOqW6YBwtH/boeYz+wrv4iiFSa0npxyBzZrBHE24D2+soMOl42Q5ymK3biK99nWX1w8XbyCj775NsLn63vCoOjaacqXG65YjIULpXvSy31pypluxGtF3TRKrMSlG/orMJjHUc9zt47VBl6aNiVpQD3bMBcxhfTQjONeGHhMKZil7w93P9x07XVqVGG3R1m6+IOo8dxdEw3u1eOhAWO3jtUGXpo2JWlAPdswFzGE2v4JhGOs7IWxI+NisbWxl1LD9jydKIyPug/Tbxs+rt0qQJDCLvobB2xtb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9R1BsD8br/Z8BTi52HltSlXdCkvklPxXr1Jq+avr39xboG0PAu2vZTmoyr7yvd5XOxP2b4L+fjvk9pKX9uiIrHFQR/hYj5l9zOrJY8DyUGrUmTyoAral9/a2m7agRkfzWB5udiqieSVAjXWXknWDEYzmWyu4uVA6ZYdFpE3gkxUq7YOq4XB0M3gMX6zipgnWbr4g6jx3F0TDe7V46EBY7eO1QZemjYlaUA92zAXMYTa/gmEY6zshbEj42KxtbGXUsP2PJ0ojI+6D9NvGz6u3SpAkMIu+hsO9jsRzR6xutvsDhe9WI1T6p+0t3Y0KezFxoaZ3n/fE7[/code:k8ge7qwv]
    
    To clarify, that's the type of value that comes back in AJAX.LastData 
    
    So then whenever I try to use this in ExecJS in this form:  
    Browser.ExecJS("window.var =" & AJAX.LastData & ";")
    I get the following error
    Uncaught SyntaxError: Unexpected token ILLEGAL
    It's likely that this is due to invisible zero-width space chars that may find themselves in the string, I'm not sure, I don't know how to save AJAX.LastData to a textfile to check.
    
    However, if I make a textbox and set its text to AJAX.LastData, then load its text in javascript, it works.  The textbox probably removes the bad characters (though a text label does not).  
    
    Is it possible to get C2 to remove these characters with a system expression? (trim does not work).  I tried looking with RegExp to find them but it's poorly documented so I was not sure how.  Something like trim() that removes all whitespace everywhere would probably work.
  • This sounds like much more than an array plugin extension. You can probably achieve this easily enough with an existing javascript matrix library though, or even build a plugin around an existing library.

  • Don't need one, I get what you're saying. I'll try it in a bit and report back. Thanks!

  • So just to clarity, Request File with Ajax, On Request Complete, ExecJS('myscript.js')? I don't think I quite understand how to set up Ajax correctly with this. Could you be a little bit more explicit? I appreciate the help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't think loading a js files works with ajax, it needs to be included as a script. I'm not sure how to do that with ajax. The method I'm using now injects it into the document header as a script.

    I'll see if there's a way to check if a function exists with JS though, that might work.

  • Looks like it's because it takes a while for the js script to load, and the C2 action does not wait for that to happen prior to calling FunctionA. A 'Wait' as a sloppy workaround works, but is there a better method?

  • Hmm almost there but not quite working. So far I have this:

    var loader = document.createElement('script');  
    loader.type='text/javascript';  
    loader.src = 'myscript.js';  
    document.getElementsByTagName('head')[0].appendChild(loader); "[/code:1an8idce]
    
    in an execJS action.  When I do this 'myscript.js' shows under Sources in chrome dev tools.
    
    Next, I try to use the function FunctionA from the library in a browser ExecJS expression, but I get "Reference error: FunctionA is not defined"
    
    What am I doing wrong?
  • Perfect, thanks! One more question, what is the path to the files uploaded to C2?

    EDIT: Also, can I access variables made in JS in C2 expressions? I'm not quite sure I understand how the Browser.ExecJS works in terms of what it returns. E.g. if in that JS I assign some JS var variable1 to something how can I access it or return it?