Fengist's Forum Posts

  • 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

  • Ok, after 2 months and no reply on how to get an app working on google play, I'm just going to assume it can't be done.

    Good thing I can work in Unity.

  • About the easiest way to do this is using Ajax and json on the construct side. You'll need some sort of server to send and receive your json data and to communicate with the mysql server.

    What you're asking for is not a simple, here you go, 2 lines of code. I've done this myself in php. There's lots of things to consider when making a user registration system.

  • You'll need to make sure you have a 'tag' in your Ajax Send. Then create a new event Ajax On Completed and use the same 'tag'. Your post reply will be in Ajax Last Data. To detect a failed post you add a new event Ajax On Error and again, use the same 'tag'. You can also use an Ajax Any Error event.

  • 1. Donations? LOL, right. Created mods for KSP. My big mod had over 300,000 downloads and after years of not even caring any more I still get people wanting to download it. Total donations? $50.00.

    2. No, Construct isn't cheap. Of course you could buy other coding languages like Dephi. I think the architect version is $3,700 this year. Or, you could do Unity and C# in Visual Studio for free (until they change the rules again) if you wanna get buried for the next 5 years in their API where the minute you learn how to do something they depreciate it and end up throw your hands up in disgust.

    There are other options.

    My opinion, if you can't somehow manage to find the money for an annual subscription then perhaps you should consider a real job and save money until you can. Bill Gates started out writing code for a power plant.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, got a test plugin uploaded to google play. SLOWLY figuring this crap out.

    Here's what I know. I download and run the app from the play store and it shows my google play login name so I know the oauth and such is working. However, I can't get the C3 plugin to work. None of the text fields are changing so it appears the plugin is not signing in. I have the app ID correct and when it didn't run with just that I added the client ID. Still not doing anything. Where am I going wrong?

    + System: On start of layout

    -> Text: Set text to "It Works V2"

    + GooglePlay: On error

    -> Text: Set text to GooglePlay.ErrorMessage

    + GooglePlay: On loaded

    -> GooglePlay: Sign in

    + GooglePlay: On signed in

    -> GooglePlay: Request player details

    -> Text: Set text to "Signed in"

    + GooglePlay: On player details received

    -> Text: Set text to GooglePlay.MyDisplayName

    -> Text2: Set text to GooglePlay.MyFamilyName

    -> Text3: Set text to GooglePlay.MyGivenName

    -> Text4: Set text to GooglePlay.MyID

    + GooglePlay: On auto-sign in failed

    -> Text: Set text to "auto signin failed"

    + GooglePlay: On sign in failed

    -> Text: Set text to "signin failed"

  • I'll give it a try. Thanks!

  • Ok, screw the tokenat. Found a working solution with regex.

    "^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$"

    Here's what I have and it mostly works. The theory, if the text input is a valid IPV4, it sets the opacity of a search sprite to 100%, otherwise it sets the opacity to 50%. The problem is, if a user enters a.a.asd.aawd It's seeing those as integers. I've tried various combinations of !NaN and checking to see if it is an integer and it always evaluates the character as a valid integer.

    What am I forgetting??

    Thanks!

    * On function 'CheckIP'

    ----+ System: tokencount(IPInput.Text, ".") = 4

    --------+ System: Repeat tokencount(IPInput.Text, ".") times

    ------------+ System: tokenat(IPInput.Text,LoopIndex, ".") > ""

    ----------------+ System: int(tokenat(IPInput.Text,LoopIndex, ".")) ≤ 255

    -----------------> IPSearchIcon: Set opacity to 100

    ----------------+ System: Else

    -----------------> IPSearchIcon: Set opacity to 50

    -----------------> System: Stop loop

    ------------+ System: Else

    -------------> IPSearchIcon: Set opacity to 50

    -------------> System: Stop loop

    ----+ System: Else

    -----> IPSearchIcon: Set opacity to 50

  • Found one slight problem with this. It doesn't work when in debug mode.