Fengist's Forum Posts

  • someone else answered a similar question in a much easier way.

    construct.net/en/forum/construct-3/how-do-i-8/game-saved-file-183408

  • Well I'm not sure how your game works but local storage is a simple var storage. I use it in my game to store the users login info (remember me). It's not secure so don't store anything important. But you could for example set the level they last completed. Next time the game runs, get the level from local storage and go to the next level layout. Store points, coins, etc.

  • There's even a Unity decompiler. Used it to figure out the code to mod Kerbals.

    Years ago a guy wrote a packet sniffer that ripped Eve Online packets apart to get market data.

    No game is safe.

    Good news! The instant your software gets cracked, you join an elite rank of programmers. It means you did something right.

  • Local storage?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tried that. GPT even recognized the link to the sdk git. Asked it to create a simple addon. It totally screwed it up.

  • Umm not positive what you're referring to. If you're talking about adding an object to a layout, it's right click, insert new object, select the object like "sprite" then click the button "Insert". Don't think you can drag and drop those.

  • Right, both the uuid and sha are setting a c3 variable which will be ajax posted to the server. The general idea is a basic verification system that can't be copy/pasted.

    Saved me much gnashing of teeth. Appreciate it!

  • Figured it out. passed a string and runtime, I got a hash back.

    Thanks again!!!!

  • IT WORKED! THANK YOU... hours and hours spent on that.

    Now, one more question. I have a sha256 function I need to pass a string to.

    function sha256(ascii)

    How would I call it?

    function sha256(ascii, runtime)?????

  • I'm just trying to call it when I need it. It's purpose is to create a random nonce to pass to the server.

  • Put the file into Scripts folder and change its purpose to "Import for events".

    However, if you need to access runtime in the function, you might have to pass it as a parameter.

    And tried it by just running UUID();

    Didn't work.

  • If you're not doing any sort of multiplayer, why not save things in local storage? Or are you trying to show them scores/progress of other players?

  • and I tried this:

    globalThis.UUID = function UUID() {
    	runtime.globalVars.UUID = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    		const r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
    		return v.toString(16);
    	});
    }

    And then

    globalThis.UUID;

    Doesn't produce an error but it doesn't appear to set the UUID global var to anything

  • Ok, so I have this function:

    function UUID() {
    	runtime.globalVars.UUID = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    		const r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
    		return v.toString(16);
    	});
    }
    

    If I click add script to an event (and remove the function UUID() bits) and then assign the global var UUID to say a text object, it works exactly as intended.

    However, I plan on calling this a bunch of times. Seems a tad wasteful to keep copy/pasting this script all over the place. I'd like to put it in a js file in either the files or scripts folder (dunno which) and then call the function with an event. I tried the whole browser.execjs thing and it can't find it.

    So, the question is (after spending several hours digging through the JS tutorial to no avail), how can I call this as a function from an event????

    Oh and I tried this: runtime.callFunction("FunctionName")

    Strangely enough, the code completion for callfunction finds the function name.

    But apparently I'm not holding my mouth right. I put the function in files/stuff.js and I tried putting it in scripts/main.js. Doesn't find it.

    Thanks